[Bug 533563] New: openSUSE-Factory: Several builds fail on linking when running chrooted with "osc build" (but not with rpmbuild) LDFLAGS?
http://bugzilla.novell.com/show_bug.cgi?id=533563 Summary: openSUSE-Factory: Several builds fail on linking when running chrooted with "osc build" (but not with rpmbuild) LDFLAGS? Classification: openSUSE Product: openSUSE.org Version: unspecified Platform: x86 OS/Version: SuSE Other Status: NEW Severity: Normal Priority: P5 - None Component: BuildService AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: AxelKoellhofer@web.de QAContact: adrian@novell.com Found By: --- User-Agent: Opera/9.80 (X11; Linux x86_64; U; de) Presto/2.2.15 Version/10.10 I experience really strange behaviour with some packages on OBS when building them for Factory (all those packages build fine with openSUSE_10.3-11.1). The builds fail on linking although the correct LDFLAGS seem to be set. One example (xboard 4.4.0.beta1 would be another one with exactly the same behaviour, see also P.S.): osc build openSUSE_Factory x86_64 togaII-141.spec (BTW: It also fails on i586) Building togaII-141.spec for openSUSE_Factory/x86_64 Getting buildinfo from server Updating cache of required packages Verifying integrity of cached packages Writing build configuration Getting buildconfig from server Running build Passwort: logging output to /tmp/build-root/.build.log... Memory limit set to 5396952KB Using BUILD_ROOT=/tmp/build-root --------- snip ----- gcc -pipe -O3 -fno-exceptions -fno-rtti -Wall -fstrict-aliasing -fomit-frame-pointer -c -o util.o util.cpp gcc -pipe -O3 -fno-exceptions -fno-rtti -Wall -fstrict-aliasing -fomit-frame-pointer -c -o value.o value.cpp gcc -pipe -O3 -fno-exceptions -fno-rtti -Wall -fstrict-aliasing -fomit-frame-pointer -c -o vector.o vector.cpp gcc -pipe -O3 -fno-exceptions -fno-rtti -Wall -fstrict-aliasing -fomit-frame-pointer -c -o probe.o probe.cpp probe.cpp: In function 'int LoadEgbbLibrary(char*, uint32)': probe.cpp:58: warning: suggest parentheses around assignment used as truth value gcc -lm -ldl -lpthread -o toga2 attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o search.o search_full.o see.o sort.o square.o trans.o util.o value.o vector.o probe.o search.o: In function `start_suspend_threads()': search.cpp:(.text+0x2cf): undefined reference to `pthread_create' util.o: In function `my_round(double)': util.cpp:(.text+0x42d): undefined reference to `floor' util.o: In function `my_random(int)': util.cpp:(.text+0x47d): undefined reference to `floor' probe.o: In function `LoadEgbbLibrary(char*, unsigned int)': probe.cpp:(.text+0x240): undefined reference to `dlclose' probe.cpp:(.text+0x24d): undefined reference to `dlopen' probe.cpp:(.text+0x268): undefined reference to `dlsym' probe.cpp:(.text+0x27c): undefined reference to `dlsym' collect2: ld returned 1 exit status make: *** [toga2] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.80715 (%build) As you can see, "-ldl" (references to dl*), "-lm" (reference to floor) and "-lptread" (reference to pthread_create) are set, but to make things even more puzzling (at least to me) see the following. - I chroot into the build environment: chroot /tmp/build-root/ and cd /usr/src/packages/BUILD/src/ make gcc -ldl -pthread -lm -o toga2 attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o search.o search_full.o see.o sort.o square.o trans.o util.o value.o vector.o probe.o Works. - I chroot into build environment and: cd /usr/src/packages/SOURCES/ rpmbuild -bb togaII-141.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.6094 + umask 022 + cd /usr/src/packages/BUILD + cd /usr/src/packages/BUILD + rm -rf src ----------- snip ------- gcc -lm -ldl -lpthread -o toga2 attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o move.o move_check move_do.o move_evasion.o move_gen.o move_legal.o option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog search.o search_full.o see.o sort.o square.o trans.o util.o value.o vector.o probe.o + exit 0 -- snip ----- rote: /usr/src/packages/RPMS/x86_64/togaII-141-1.4.1-0.1.x86_64.rpm Wrote: /usr/src/packages/RPMS/x86_64/togaII-141-debugsource-1.4.1-0.1.x86_64.rpm Wrote: /usr/src/packages/RPMS/x86_64/togaII-141-debuginfo-1.4.1-0.1.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.50640 + umask 022 + cd /usr/src/packages/BUILD + cd src + /bin/rm -rf /var/tmp/togaII-141-1.4.1-0.1-root + exit 0 Works. - I run rpmbuild (non-chrooted) on an installation of openSUSE_Factory (Milestone 6) => Works. What is even more strange, I can get rid of one of the above errors by changing LDFLAGS = -lm -ldl -lpthread to LDFLAGS = -lm -ldl -pthread I get: gcc -lm -ldl -pthread -o toga2 attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o search.o search_full.o see.o sort.o square.o trans.o util.o value.o vector.o probe.o util.o: In function `my_round(double)': util.cpp:(.text+0x42d): undefined reference to `floor' util.o: In function `my_random(int)': util.cpp:(.text+0x47d): undefined reference to `floor' probe.o: In function `LoadEgbbLibrary(char*, unsigned int)': probe.cpp:(.text+0x240): undefined reference to `dlclose' probe.cpp:(.text+0x24d): undefined reference to `dlopen' probe.cpp:(.text+0x268): undefined reference to `dlsym' probe.cpp:(.text+0x27c): undefined reference to `dlsym' collect2: ld returned 1 exit status make: *** [toga2] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.52426 (%build) Notice that the error "undefined reference to `pthread_create'" is gone now, however I could not get rid of the other ones. Normally I would always think of an error on my side or in the code itsself, but as it _does_ build without any problems when not using "osc build" even inside the same chroot created by the "osc build"-command, I decided to file this report. P.S. Yes, I know that the package is not being built with $RPM_OPT_FLAGS, but it makes no difference and the other packages (i.e. xboard) that fail are being built with $RPM_OPT_FLAGS. I also found another repository offering xboard 4.4.0 for openSUSE_Factory http://download.opensuse.org/repositories/home://apersaud/openSUSE_Factory/ As you can see the last successful build was on july 1st 2009, examining the last build logs of that package showed the same problems on linking. gcc -lm -lXaw -o xboard backend.o lists.o pgntags.o xedittags.o xhistory.o zippy.o childio.o moves.o uci.o xengineoutput.o xoptions.o gamelist.o parser.o xboard.o xgamelist.o book.o backend.o: In function `TimeString': backend.c:(.text+0x20e2f): undefined reference to `floor' backend.c:(.text+0x20e7e): undefined reference to `floor' + another several 100 lines like this: xgamelist.c:(.text+0x10fc): undefined reference to `XtStrings' xgamelist.c:(.text+0x1121): undefined reference to `XtStrings' xgamelist.c:(.text+0x1146): undefined reference to `XtStrings' Reproducible: Always Steps to Reproduce: 1. 2. 3. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=533563
User meissner@novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=533563#c1
Marcus Meissner
http://bugzilla.novell.com/show_bug.cgi?id=533563
User AxelKoellhofer@web.de added comment
http://bugzilla.novell.com/show_bug.cgi?id=533563#c2
--- Comment #2 from Axel Köllhofer
factory builds with as-needed to remove unnecessary library dependencies.
Thanks a lot for your reply Markus, it gave me the decisive hint. I previously found something about this "as-needed" when searching the web on the problem (for Mandriva in this case) http://wiki.mandriva.com/en/Overlinking but I could not directly "link it" (pun intended) to a solution. However:
gcc -lm -ldl -lpthread -o toga2 attack.o board.o book.o eval.o fen.o hasho list.o main.o material.o move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o search.o search_full.o see.o sort.o square.o trans.o util.o value.o vector.o probe.o
should be: gcc -o toga2 attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o recog.o search.o search_full.o see.o sort.o square.o trans.o util.o value.o vector.o probe.o -lm -ldl -lpthread
This is directly on the spot, so a little patch for the Makefile: --- Makefile.orig 2008-10-22 09:50:44.000000000 +0200 +++ Makefile 2009-08-23 03:07:53.000000000 +0200 @@ -47,7 +47,7 @@ # dependencies $(EXE): $(OBJS) - $(CXX) $(LDFLAGS) -o $@ $(OBJS) + $(CXX) -o $@ $(OBJS) $(LDFLAGS) .depend: $(CXX) -MM $(OBJS:.o=.cpp) > $@ and sc build openSUSE_Factory togaII-141.spec --clean Building togaII-141.spec for openSUSE_Factory/x86_64 Overriding config value for build-root='/tmp/build-root' with '/tmp/build-root' Getting buildinfo from server Updating cache of required packages ---snip---- ét voilà RPMLINT report: =============== 2 packages and 0 specfiles checked; 0 errors, 0 warnings. Fatboy finished "build togaII-141.spec" at Sun Aug 23 03:10:41 CEST 2009. /tmp/build-root/usr/src/packages/SRPMS/togaII-141-1.4.1-0.1.src.rpm /tmp/build-root/usr/src/packages/RPMS/x86_64/togaII-141-debuginfo-1.4.1-0.1x86_64.rpm /tmp/build-root/usr/src/packages/RPMS/x86_64/togaII-141-1.4.1-0.1.x86_64.rpm
(basically libraries need to be after the .o files at the end of the link line). LDFLAGS is the wrong place for them, they need to be in a seperate variable (LIBS in autoconf speak)
Thanks for that second hint, unfortunately the above example does not come with "autoconf" or "automake" features (just a plain Makefile) but this will be _very_ helpful for the other "candidates" (like xboard). -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com