Previous Thread
Next Thread
Print Thread
Joined: Mar 2004
Posts: 656
Senior Member
OP Offline
Senior Member
Joined: Mar 2004
Posts: 656
Hello,

we have just discovered that mame is not building on linux arm target due to use of -m32 flag:
Quote:
g++ -MMD -MP -DNDEBUG -DCRLF=2 -DLSB_FIRST -DUSE_SYSTEM_JPEGLIB -DUSE_SYSTEM_PORTMIDI -DUSE_SYSTEM_SQLITE -DMAME_NOASM -DLUA_COMPAT_APIINTCASTS -I../../../../../src/osd -I../../../../../src/emu -I../../../../../src/lib -I../../../../../src/lib/util -I../../../../../3rdparty -g -m32 --pipe -g2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wno-deprecated-declarations -O2 -fno-strict-aliasing -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -Wno-unknown-pragmas -Wall -Wcast-align -Wundef -Wformat-security -Wwrite-strings -Wno-sign-compare -Wno-conversion -Wno-unused-result -Wno-narrowing -Wno-attributes -Wno-array-bounds -D__USE_MINGW_ANSI_STDIO=1 -m32 -DINLINE="static inline" -x c++ -std=gnu++98 -Woverloaded-virtual -o "../../../../linux_gcc/obj/x32/Release/src/lib/formats/2d_dsk.o" -MF ../../../../linux_gcc/obj/x32/Release/src/lib/formats/2d_dsk.d -c "../../../../../src/lib/formats/2d_dsk.c"
Compiling src/lib/util/avhuff.c...
g++: error: unrecognized command line option '-m32'

I have tried to investigate but it looks like some fixes to Genie might be required as well.

Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
It *was* building on ARM, I assume there probably are indeed GEnie problems.

Joined: Mar 2004
Posts: 656
Senior Member
OP Offline
Senior Member
Joined: Mar 2004
Posts: 656
In the snippet you can see that it tries to pass -m32 to g++ not once but twice. As this option is not supported on arm, the build fails.
I *think* the first instance comes from 3rdparty/genie/src/tools/gcc.lua and the second from scripts/toolchain.lua. I unfortunately do not have any ideas how to fix this yet.

Joined: Feb 2007
Posts: 507
C
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 507
The simplest solution is a shell script. Let's call it "iprentendtobeg++". Same approach for ld. You build mame with
make CC=iprentendtobeg++

and within iprentendtobeg++ scan the options and remove what you don't want. I used the approach some years ago while trying icc.

Of course, it's a workaround.

Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
Yeah, we did natively have some cross-compilation support in the previous build system so it should be possible to get it back without such workarounds.

Joined: Mar 2004
Posts: 656
Senior Member
OP Offline
Senior Member
Joined: Mar 2004
Posts: 656
How about something like this:
Code:
diff -up mame-0.163/makefile.armfix mame-0.163/makefile
--- mame-0.163/makefile.armfix	2015-07-13 20:26:49.305781343 +0200
+++ mame-0.163/makefile	2015-07-13 20:34:09.560350725 +0200
@@ -903,13 +903,14 @@ $(PROJECTDIR)/gmake-linux/Makefile: make
 linux_x64: generate $(PROJECTDIR)/gmake-linux/Makefile
 	$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-linux config=$(CONFIG)64
 
-.PHONY: linux
-linux: linux_x86
-
 .PHONY: linux_x86
 linux_x86: generate $(PROJECTDIR)/gmake-linux/Makefile
 	$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-linux config=$(CONFIG)32
 
+.PHONY: linux
+linux_x64: generate $(PROJECTDIR)/gmake-linux/Makefile
+	$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-linux config=$(CONFIG)
+
 #-------------------------------------------------
 # gmake-linux-clang
 #-------------------------------------------------

It still needs to be tested but should work in theory

Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
Fine with me if it works.

Joined: Mar 2004
Posts: 656
Senior Member
OP Offline
Senior Member
Joined: Mar 2004
Posts: 656
This is the final version of the patch:
Code:
diff -up mame-0.163/makefile.armfix mame-0.163/makefile
--- mame-0.163/makefile.armfix	2015-07-14 23:17:36.286907839 +0200
+++ mame-0.163/makefile	2015-07-15 00:10:24.957685782 +0200
@@ -240,6 +240,7 @@ endif
 endif
 
 ifeq ($(findstring arm,$(UNAME)),arm)
+ARCHITECTURE :=
 ifndef NOASM
 	NOASM := 1
 endif
@@ -903,13 +904,14 @@ $(PROJECTDIR)/gmake-linux/Makefile: make
 linux_x64: generate $(PROJECTDIR)/gmake-linux/Makefile
 	$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-linux config=$(CONFIG)64
 
-.PHONY: linux
-linux: linux_x86
-
 .PHONY: linux_x86
 linux_x86: generate $(PROJECTDIR)/gmake-linux/Makefile
 	$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-linux config=$(CONFIG)32
 
+.PHONY: linux
+linux: generate $(PROJECTDIR)/gmake-linux/Makefile
+	$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-linux config=$(CONFIG)
+
 #-------------------------------------------------
 # gmake-linux-clang
 #-------------------------------------------------

With it, -m32 is no longer being passed to gcc.

Joined: Mar 2004
Posts: 656
Senior Member
OP Offline
Senior Member
Joined: Mar 2004
Posts: 656
While the build is still ongoing, I have noticed that lots of warnings are being produced on armv7hl:
Quote:
../../../../../src/emu/memory.h: In member function 'UINT16& memory_region::u16(offs_t)':
../../../../../src/emu/memory.h:709:75: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT16* {aka short unsigned int*}' increases required alignment of target type [-Wcast-align]
UINT16 &u16(offs_t offset = 0) { return reinterpret_cast<UINT16 *>(base())[offset]; }
^
../../../../../src/emu/memory.h: In member function 'UINT32& memory_region::u32(offs_t)':
../../../../../src/emu/memory.h:710:75: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT32* {aka unsigned int*}' increases required alignment of target type [-Wcast-align]
UINT32 &u32(offs_t offset = 0) { return reinterpret_cast<UINT32 *>(base())[offset]; }
^
../../../../../src/emu/memory.h: In member function 'UINT64& memory_region::u64(offs_t)':
../../../../../src/emu/memory.h:711:75: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT64* {aka long long unsigned int*}' increases required alignment of target type [-Wcast-align]
UINT64 &u64(offs_t offset = 0) { return reinterpret_cast<UINT64 *>(base())[offset]; }
^
../../../../../src/emu/memory.h: In member function 'UINT16 direct_read_data::read_raw_word(offs_t, offs_t)':
../../../../../src/emu/memory.h:938:84: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT16* {aka short unsigned int*}' increases required alignment of target type [-Wcast-align]
return *reinterpret_cast<UINT16 *>(&m_raw[(byteaddress ^ directxor) & m_bytemask]);
^
../../../../../src/emu/memory.h: In member function 'UINT16 direct_read_data::read_decrypted_word(offs_t, offs_t)':
../../../../../src/emu/memory.h:945:90: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT16* {aka short unsigned int*}' increases required alignment of target type [-Wcast-align]
return *reinterpret_cast<UINT16 *>(&m_decrypted[(byteaddress ^ directxor) & m_bytemask]);
^
../../../../../src/emu/memory.h: In member function 'UINT32 direct_read_data::read_raw_dword(offs_t, offs_t)':
../../../../../src/emu/memory.h:958:84: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT32* {aka unsigned int*}' increases required alignment of target type [-Wcast-align]
return *reinterpret_cast<UINT32 *>(&m_raw[(byteaddress ^ directxor) & m_bytemask]);
^
../../../../../src/emu/memory.h: In member function 'UINT32 direct_read_data::read_decrypted_dword(offs_t, offs_t)':
../../../../../src/emu/memory.h:965:90: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT32* {aka unsigned int*}' increases required alignment of target type [-Wcast-align]
return *reinterpret_cast<UINT32 *>(&m_decrypted[(byteaddress ^ directxor) & m_bytemask]);
^
../../../../../src/emu/memory.h: In member function 'UINT64 direct_read_data::read_raw_qword(offs_t, offs_t)':
../../../../../src/emu/memory.h:978:84: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT64* {aka long long unsigned int*}' increases required alignment of target type [-Wcast-align]
return *reinterpret_cast<UINT64 *>(&m_raw[(byteaddress ^ directxor) & m_bytemask]);
^
../../../../../src/emu/memory.h: In member function 'UINT64 direct_read_data::read_decrypted_qword(offs_t, offs_t)':
../../../../../src/emu/memory.h:985:90: warning: cast from 'UINT8* {aka unsigned char*}' to 'UINT64* {aka long long unsigned int*}' increases required alignment of target type [-Wcast-align]
return *reinterpret_cast<UINT64 *>(&m_decrypted[(byteaddress ^ directxor) & m_bytemask]);


There are a few other files where -Wcast-align fires but this one comes up by far the most often.

Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
Yeah, most of those are actually harmless.


Moderated by  R. Belmont 

Link Copied to Clipboard
Who's Online Now
2 members (Richard Bannister, Golden Child), 40 guests, and 2 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,835
Posts116,215
Members4,921
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.5