Opened 16 years ago
Closed 16 years ago
#6795 closed defect (fixed)
[win32] mythmusic compilation fails at linker stage
| Reported by: | Owned by: | Nigel | |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.22 |
| Component: | Ports - Windows | Version: | head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
It seems the link stage of compiling mythmusic fails because libflac on windows is compiled against winsock (), as this is not in the LIBS setting of mytmusic it fails to compile with the following error:
u:/Msys/1.0/lib/libFLAC.a(bitwriter.o): In function `FLACbitwriter_get_buffer' : u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:286: undefined reference to `ntohl @4' u:/Msys/1.0/lib/libFLAC.a(bitwriter.o): In function `FLACbitwriter_write_rice_ signed_block': u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:611: undefined reference to `ntohl @4' u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:645: undefined reference to `ntohl @4' u:/Msys/1.0/lib/libFLAC.a(bitwriter.o): In function `FLACbitwriter_write_raw_u int32': u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:367: undefined reference to `ntohl @4' u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:373: undefined reference to `ntohl @4' u:/Msys/1.0/lib/libFLAC.a(bitwriter.o):u:/sources/flac-1.2.1/src/libFLAC/bitwrit er.c:321: more undefined references to `ntohl@4' follow collect2: ld returned 1 exit status make[1]: * [libmythmusic.dll] Error 1 make[1]: Leaving directory `/u/mythtv/mythplugins/mythmusic/mythmusic' make: * [sub-mythmusic-make_default] Error 2
Making a minor tweak to the LIBS line in the Makefile (mythplugins/mythmusic/myshmusic/Makefile) fixes it. Unfortunately I do not know how to make the modifications to the makefile macros to incorporate linking winsock, but the desired result, but I think there are others who know how to do this. The desired change in the eventual Makefile is shown in the attached unified diff file.
If I make this modification manually the errors are gone after rerunning make.
Attachments (3)
Change History (13)
by , 16 years ago
| Attachment: | win32-mythmusic-winsock-linkstage.patch added |
|---|
comment:1 by , 16 years ago
Makefiles are generated from .pro files. Take a look at mythmusic/mythmusic/mythmusic.pro, line 80.
follow-up: 3 comment:2 by , 16 years ago
I aim to remove the libflac dependancy in the next week or so ...
by , 16 years ago
| Attachment: | win32-mythmusic-configure-wsock32.patch added |
|---|
Actual patch to include -lwsock32 in the linking stage
follow-up: 5 comment:3 by , 16 years ago
Even better when we do not need libFLAC anymmore, saves us some hassle as it does not even compile under MinGW anymore due to their move to CMake on top off that it seems my patch does not work after all. It seems the linker is picky on the order in which libs are linked. Linking with my patch links them before all QT related stuff and then it still errors out:
{{g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -mthreads -Wl -shared -Wl,--out-implib,liblibmythmusic.a -o libmythmus ic.dll object_script.libmythmusic -L'u:/Qt/4.5.2/lib' -lopengl32 -lglu32 -lgdi3 2 -luser32 -LU:/mythtv/build//lib -LU:/mythtv/build//bin -L/bin -lmyth-0.22 -lmy thui-0.22 -lmythtv-0.22 -lmythavformat-0.22 -lmythavcodec-0.22 -lmythavutil-0.22
-LU:/mythtv/build//lib -lfreetype -lmp3lame -lmythdb-0.22 -lmythavutil-0.22 -lm
ythavcodec-0.22 -lmyth-0.22 -lmythui-0.22 -lmythupnp-0.22 -lmythswscale-0.22 -LU :/mythtv/buildbin -L/usr/lib -lmingw32 -lSDLmain -lSDL -mwindows -lwsock32 -lm ythtv-0.22 -lmythavformat-0.22 -ltag -logg -lvorbisfile -lvorbis -lvorbisenc -lF LAC -lmp3lame -lmythfreemheg-0.22 -logg -lQt3Support4 -lQtSql4 -lQtXml4 -lQtOpen GL4 -lQtGui4 -lQtNetwork4 -lQtCore4 Creating library file: liblibmythmusic.a u:/Msys/1.0/lib/libFLAC.a(bitwriter.o): In function `FLACbitwriter_get_buffer' : u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:286: undefined reference to `ntohl @4' u:/Msys/1.0/lib/libFLAC.a(bitwriter.o): In function `FLACbitwriter_write_rice_ signed_block': u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:611: undefined reference to `ntohl @4' u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:645: undefined reference to `ntohl @4' u:/Msys/1.0/lib/libFLAC.a(bitwriter.o): In function `FLACbitwriter_write_raw_u int32': u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:367: undefined reference to `ntohl @4' u:/sources/flac-1.2.1/src/libFLAC/bitwriter.c:373: undefined reference to `ntohl @4' u:/Msys/1.0/lib/libFLAC.a(bitwriter.o):u:/sources/flac-1.2.1/src/libFLAC/bitwrit er.c:321: more undefined references to `ntohl@4' follow collect2: ld returned 1 exit status make[1]: * [libmythmusic.dll] Error 1 make[1]: Leaving directory `/u/mythtv/mythplugins/mythmusic/mythmusic' make: * [sub-mythmusic-make_default] Error 2}}
But after I manually remove it from in between all the libs and put it at the end of the line it seems to work OK:
{{bash.exe"-3.1$ make cd mythmusic/ && make -f Makefile make[1]: Entering directory `/u/mythtv/mythplugins/mythmusic/mythmusic' g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -mthreads -Wl -shared -Wl,--out-implib,liblibmythmusic.a -o libmythmus ic.dll object_script.libmythmusic -L'u:/Qt/4.5.2/lib' -lopengl32 -lglu32 -lgdi3 2 -luser32 -LU:/mythtv/build//lib -LU:/mythtv/build//bin -L/bin -lmyth-0.22 -lmy thui-0.22 -lmythtv-0.22 -lmythavformat-0.22 -lmythavcodec-0.22 -lmythavutil-0.22
-LU:/mythtv/build//lib -lfreetype -lmp3lame -lmythdb-0.22 -lmythavutil-0.22 -lm
ythavcodec-0.22 -lmyth-0.22 -lmythui-0.22 -lmythupnp-0.22 -lmythswscale-0.22 -LU :/mythtv/buildbin -L/usr/lib -lmingw32 -lSDLmain -lSDL -mwindows -lmythtv-0.22
-lmythavformat-0.22 -ltag -logg -lvorbisfile -lvorbis -lvorbisenc -lFLAC -lmp3l
ame -lmythfreemheg-0.22 -logg -lQt3Support4 -lQtSql4 -lQtXml4 -lQtOpenGL4 -lQtGu i4 -lQtNetwork4 -lQtCore4 -lwsock32 Creating library file: liblibmythmusic.a make[1]: Leaving directory `/u/mythtv/mythplugins/mythmusic/mythmusic' cd theme/ && make -f Makefile make[1]: Entering directory `/u/mythtv/mythplugins/mythmusic/theme' gcc -c -march=pentium4 -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FIL E_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -g -Wall -Wno-switch -Wdisabled -optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -W write-strings -Wundef -fno-math-errno -fomit-frame-pointer -O3 -fomit-frame-poin ter -DNDEBUG -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DUSING_MINGW -D_GNU_SOURCE -DPREFIX="U:/mythtv/build/" -DMMX -Di386 -DUSING_DIRECTX -D_FILE_OFFSET_BITS=64 -DQT_NEEDS_QMAIN -I'../../../build/include' -I'/usr/include' -I'../../../build' -I'../../../../qt/4.5.2/mkspecs/win32-g++' -o themedummy.o ../../themedummy.c g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o themenop.exe themedummy.o -LU :/mythtv/buildlib -LU:/mythtv/build//bin -L/bin -lmyth-0.22 -lmythui-0.22 -lmy thtv-0.22 -lmythavformat-0.22 -lmythavcodec-0.22 -lmythavutil-0.22 make[1]: Leaving directory `/u/mythtv/mythplugins/mythmusic/theme' cd i18n/ && make -f Makefile make[1]: Entering directory `/u/mythtv/mythplugins/mythmusic/i18n' gcc -c -march=pentium4 -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -D_FIL E_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-common -g -Wall -Wno-switch -Wdisabled -optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -W write-strings -Wundef -fno-math-errno -fomit-frame-pointer -O3 -fomit-frame-poin ter -DNDEBUG -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DUSING_MINGW -D_GNU_SOURCE -DPREFIX="U:/mythtv/build/" -DMMX -Di386 -DUSING_DIRECTX -D_FILE_OFFSET_BITS=64 -DQT_NEEDS_QMAIN -I'../../../build/include' -I'/usr/include' -I'../../../build' -I'../../../../qt/4.5.2/mkspecs/win32-g++' -o dummy.o dummy.c g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o i18n.exe dummy.o -LU:/mythtv/ buildlib -LU:/mythtv/build//bin -L/bin -lmyth-0.22 -lmythui-0.22 -lmythtv-0.22
-lmythavformat-0.22 -lmythavcodec-0.22 -lmythavutil-0.22
make[1]: Leaving directory `/u/mythtv/mythplugins/mythmusic/i18n' bash.exe"-3.1$}}
I am puzzled and out of clues...
comment:4 by , 16 years ago
Oops, one missing accolade in the wikiformatting makes it fairy hard to read, but I can not correct it. Perhaps some one with more rights can add them so my verbatim output reads a little easier.
comment:5 by , 16 years ago
Replying to Jonathan Martens <jonathan@snetram.nl>:
Even better when we do not need libFLAC anymmore, saves us some hassle as it does not even compile under MinGW anymore due to their move to CMake on top off that it seems my patch does not work after all.
Oops2, it was a little and mixed up libFLAC and libtag. The latter uses CMake as of version 1.5 IIRC
follow-up: 7 comment:6 by , 16 years ago
Well I'm sorry to say that we're moving towards libtag and not away from it. I don't really know what to suggest, but I'm sure you'll figure it out.
comment:7 by , 16 years ago
Replying to stuartm:
Well I'm sorry to say that we're moving towards libtag and not away from it. I don't really know what to suggest, but I'm sure you'll figure it out.
I understand, there is a workaround already (although not a really clean one). It just makes things a little more difficult on windows, but hey what do you expect :)
comment:8 by , 16 years ago
Since it seems that the libcdaudio library also needs it:
u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_skip_http_header': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:841: undefined reference to `recv@16' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:841: undefined reference to `recv@16' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_read_line': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:861: undefined reference to `recv@16' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_vread': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:1222: undefined reference to `send@16 ' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_quit': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:1359: undefined reference to `send@16 ' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:1361: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_sites': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:1326: undefined reference to `send@16 ' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:1326: undefined reference to `send@16 ' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_query': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:950: undefined reference to `send@16' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_connect': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:683: undefined reference to `htons@4' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:685: undefined reference to `inet_add r@4' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:696: undefined reference to `socket@1 2' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:702: undefined reference to `connect@ 12' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:687: undefined reference to `gethostb yname@4' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_connect_server': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:770: undefined reference to `send@16' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:789: undefined reference to `send@16' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_proxy_sites': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2224: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_sites': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2203: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_proxy_read': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2183: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_read': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2159: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_proxy_query': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2137: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cddb.o):u:/sources/libcdaudio-0.99.12p2/src/cddb.c: 2115: more undefined references to `shutdown@8' follow u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_submit': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2322: undefined reference to `send@16 ' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2326: undefined reference to `send@16 ' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2330: undefined reference to `send@16 ' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2334: undefined reference to `send@16 ' u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2338: undefined reference to `send@16 ' u:/MSys/1.0/lib/libcdaudio.a(cddb.o):u:/sources/libcdaudio-0.99.12p2/src/cddb.c: 2343: more undefined references to `send@16' follow u:/MSys/1.0/lib/libcdaudio.a(cddb.o): In function `cddb_http_submit': u:/sources/libcdaudio-0.99.12p2/src/cddb.c:2375: undefined reference to `shutdow n@8' u:/MSys/1.0/lib/libcdaudio.a(cdindex.o): In function `cdindex_http_submit': u:/sources/libcdaudio-0.99.12p2/src/cdindex.c:904: undefined reference to `shutd own@8' collect2: ld returned 1 exit status make[1]: *** [libmythmusic.dll] Error 1 make[1]: Leaving directory `/u/mythtv/mythplugins/mythmusic/mythmusic' make: *** [sub-mythmusic-make_default] Error 2 bash-3.1$
I looked a little further on how to properly implement the linker flag and finally succeeded, I will attach a new patch for it.
by , 16 years ago
| Attachment: | win32-mythmusic-mythmusic-mythmusic_pro.patch added |
|---|
Proper patch to include -lwsock32 in links stage when building mythmusic
comment:9 by , 16 years ago
| Status: | new → assigned |
|---|
comment:10 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

Unified diff showing the desired change in the generated makefile for mythwmusic