Opened 10 years ago

Closed 9 years ago

#6795 closed defect (fixed)

[win32] mythmusic compilation fails at linker stage

Reported by: Jonathan Martens <jonathan@…> 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)

win32-mythmusic-winsock-linkstage.patch (2.5 KB) - added by Jonathan Martens <jonathan@…> 10 years ago.
Unified diff showing the desired change in the generated makefile for mythwmusic
win32-mythmusic-configure-wsock32.patch (809 bytes) - added by Jonathan Martens <jonathan@…> 10 years ago.
Actual patch to include -lwsock32 in the linking stage
win32-mythmusic-mythmusic-mythmusic_pro.patch (421 bytes) - added by Jonathan Martens <jonathan@…> 10 years ago.
Proper patch to include -lwsock32 in links stage when building mythmusic

Download all attachments as: .zip

Change History (13)

Changed 10 years ago by Jonathan Martens <jonathan@…>

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

comment:1 Changed 10 years ago by anonymous

Makefiles are generated from .pro files. Take a look at mythmusic/mythmusic/mythmusic.pro, line 80.

comment:2 Changed 10 years ago by stuartm

I aim to remove the libflac dependancy in the next week or so ...

Changed 10 years ago by Jonathan Martens <jonathan@…>

Actual patch to include -lwsock32 in the linking stage

comment:3 in reply to:  2 ; Changed 10 years ago by Jonathan Martens <jonathan@…>

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 Changed 10 years ago by Jonathan Martens <jonathan@…>

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 in reply to:  3 Changed 10 years ago by anonymous

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

comment:6 Changed 10 years ago by 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.

comment:7 in reply to:  6 Changed 10 years ago by anonymous

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 Changed 10 years ago by Jonathan Martens <jonathan@…>

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.

Changed 10 years ago by Jonathan Martens <jonathan@…>

Proper patch to include -lwsock32 in links stage when building mythmusic

comment:9 Changed 10 years ago by Nigel

Status: newassigned

comment:10 Changed 9 years ago by Nigel

Resolution: fixed
Status: assignedclosed

(In [23278]) Windows - pull in libwsock32. Closes #6795. Note that there are still unresolved symbols needed for libcdaudio, like lstat, readlink. I have no idea where to get those. Maybe the same place we get libcdaudio?

Note: See TracTickets for help on using tickets.