Opened 15 years ago

Closed 15 years ago

Last modified 5 years ago

#4217 closed defect (fixed)

MinGW32 build problems/errors

Reported by: dhewg Owned by: dhewg
Priority: normal Component: Port: Win32
Version: Keywords: build
Cc: Game:

Description

noted while setting up buildot on linux and crosscompiling trunk with mingw32:

1) when using flac i get this error upon linking: /opt/toolchains/i586-mingw32msvc/lib/libFLAC.a(bitreader.o):bitreader.c:(.text+0x1a0): undefined reference to `_ntohl@4'

2) when compiling with mt32emu i get: /usr/lib/gcc/i586-mingw32msvc/3.4.5/libstdc++.a(stubs.o): multiple definition of `_powf'

3) the native linux nasm is not detected by configure

i could fix 1) and 3), but couldn't figure out 2) - some google results hint at libstdc++ crosscompile problems

Ticket imported from: #2673362. Ticket imported from: bugs/4217.

Attachments (2)

configure.diff (792 bytes ) - added by dhewg 15 years ago.
mt32.diff (2.7 KB ) - added by dhewg 15 years ago.

Download all attachments as: .zip

Change History (13)

by dhewg, 15 years ago

Attachment: configure.diff added

comment:1 by Kirben, 15 years ago

1. That build of FLAC needs to be linked against wsock32, in order to compile. Send your complaint to FLAC developers, for requiring a network library to be linked in, when using a Windows build.

comment:2 by fingolfin, 15 years ago

Re 1): If it is only ntohl, then maybe one can get away by just providing that. It is, after all, trivial to implement (endian conversion code, see <http://linux.die.net/man/3/ntohl>). Of course, if there is more that is needed from winsock... If it *is* indeed all that is needed, then we should kick the FLAC people for using it in the first place (I always wondered why ntohl was a library function, i mean, there is no "int add(int, int)" in the std C lib either, is there???

2) According to Debian devs this is indeed due to a bug in libstdc++, see <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484299>. One workaround for this might be to not use powf but rather use pow. We already do so on OSX (old versions didn't have powf) and Solaris. The checks in the MT32 sources which re#define powf, sinf etc. could be augmented to also include the Mingw cross compiler (and the comments be augmented to point to the bug report.

by dhewg, 15 years ago

Attachment: mt32.diff added

comment:3 by dhewg, 15 years ago

1) You're both right, its just ntohl. Using Kirbens patch at https://sourceforge.net/tracker/?func=detail&atid=313478&aid=1761712&group_id=13478 on 1.2.1 works fine without linking to wsock32 :)

2) It indeed can be fixed with 'pow' instead of 'powf', I tried the attached patch on - Debian 4.0, with 'i586-mingw32msvc-gcc -v' = 'gcc version 3.4.5 (mingw special)' - Ubuntu 9.04, with 'i586-mingw32msvc-gcc -v' = 'gcc version 4.2.1-sjlj (mingw32-2)'

Both not working before, and fixed afterwards. Looks like that only happens on cross-compiled mingw32 toolchains (oh, the irony...)

3) This one is still valid ;) the linux nasm is not detected, but I'm not sure if I took the correct approach to get EXEEXT out of the way. At least its beeing picked up now and produces valid output. File Added: mt32.diff

comment:4 by fingolfin, 15 years ago

Feel free to commit the mt32 patch.

comment:5 by Kirben, 15 years ago

Component: --Unset--
Owner: set to lordhoto
Resolution: fixed
Status: newclosed

comment:6 by Kirben, 15 years ago

Owner: lordhoto removed
Resolution: fixed
Status: closednew

comment:7 by dhewg, 15 years ago

#3 is now fixed with r39635, closing this.

comment:8 by dhewg, 15 years ago

Status: newclosed

comment:9 by sev-, 15 years ago

Resolution: fixed

comment:10 by Kirben, 15 years ago

Owner: set to dhewg

comment:11 by digitall, 5 years ago

Component: --Unset--Port: Win32
Note: See TracTickets for help on using tickets.