Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
05569 Compiling Minor Always May 3, 2014, 10:17 May 4, 2014, 02:24
Tester robert_s View Status Public Platform MAME (Self-compiled)
Assigned To R. Belmont Resolution Fixed OS Linux
Status [?] Resolved Driver
Version 0.153 Fixed in Version 0.154 Build Normal
Fixed in Git Commit Github Pull Request #
Summary 05569: Makefile misinterprets host name in BIGENDIAN autodetection
Description The makefile incorrectly identifies my Linux/Debian system as big-endian due to the host name being "PowerBox". The offending lines in the makefile are:

# Autodetect BIGENDIAN
# MacOSX
ifndef BIGENDIAN
ifneq (,$(findstring Power,$(UNAME)))
BIGENDIAN=1
endif

$(UNAME), which is the output of "uname -a", is on this system:

Linux PowerBox 3.2.0-4-kirkwood #1 Debian 3.2.57-3 armv5tel GNU/Linux

The following lines in the makefile would probably also cause any hostname containing "ppc" to incorrectly identify a system as big-endian.

To fix this, I would suggest not using the "-a" option for the uname command, but rather only select options which are used for platform detection, and omit the "-n" option which outputs the host name. Since I don't know which options are available on the various supported platforms, I cannot make a specific suggestion.
Steps To Reproduce 1. Set up a Linux box and name it e.g. "PowerBox" or "Appcore"
2. Verify with "uname -a" that the name is part of the output
3. Run "make" to try to compile MAME on this box
4. The build will likely stop at an attempt to convert PNG files, since the PNG converter tool misinterprets the endianness in the PNG files
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
3
User avatar
No.10671
robert_s
Tester
May 3, 2014, 17:39
Analyzing the use of the uname output, I suppose using the command "uname -smpi" should provide all needed information.

Maybe even "uname -sm" would suffice, but that depends on whether the information output is sufficient for detection of 64-bit platforms and big-endian platforms. On my Debian x86_64 system, "p" and "i" output the same as "m", and on my Debian ARM system "p" and "i" output "unknown", so these operating systems apparently don't need these options.
User avatar
No.10672
R. Belmont
Developer
May 4, 2014, 00:19
I went with -mps since it seems to work with both GNU and BSD/MacOSX versions of uname.
User avatar
No.10675
robert_s
Tester
May 4, 2014, 02:24
Minimal nitpick: After the patch, the potential error message in line 103 still says uname was run with -a:

103: $(error Unable to detect TARGETOS from uname -a: $(UNAME))