[opensuse-packaging] Help with stupid link error
Hi, Working on packaging OpenStack as part of my Hackweek 6 endeavor. Nova (one part of OpenStack) needs a newer version of redis than is available in OBS, thus I am sticking a copy into Virtualization:Cloud:OpenStack for now. I have run into a stupid link error that makes no sense to me, thus help is much appreciated. /usr/src/packages/BUILD/redis-2.0.4/redis.c:9293: undefined reference to `log' The math library is on the link line: cc -o redis-server -std=c99 -pedantic -O2 -Wall -W -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -lm -pthread -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -rdynamic -ggdb adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o This happens when building locally and in the build service. A log file can be found here: https://build.opensuse.org/package/live_build_log?arch=i586&package=redis&project=Virtualization%3ACloud%3AOpenStack&repository=openSUSE_11.3 The offending source line is: return (double)age*log(1+asize); don't see anything wrong wit that. This produces -> nm -Bg /var/tmp/build-root/usr/src/packages/BUILD/redis-2.0.4/redis.o | grep log U log in the object file and of course: -> nm -Bg /var/tmp/build-root//lib64/libm.so.6 | grep log 000000000001a520 T __clog10 0000000000027ca0 T __clog10f 0000000000030410 T __clog10l 0000000000019020 W clog 000000000001a520 W clog10 0000000000027ca0 W clog10f 0000000000030410 W clog10l 00000000000263c0 W clogf 000000000002eb50 W clogl 0000000000010670 W ilogb 000000000001fb20 W ilogbf 000000000002c140 W ilogbl 0000000000014230 W log 00000000000146c0 W log10 0000000000022fb0 W log10f 000000000002d5e0 W log10l 0000000000010720 W log1p 000000000001fb90 W log1pf 000000000002c170 W log1pl 000000000001aaa0 W log2 0000000000028100 W log2f 00000000000307b0 W log2l 0000000000010ad0 W logb 000000000001feb0 W logbf 000000000002c1b0 W logbl 0000000000022bf0 W logf 000000000002d530 W logl shows that log is defined in the math library. As a weak symbol, but never the less that should be good enough at link time. Help is much appreciated. Thanks, Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU Software Engineer Consultant LINUX rschweikert@novell.com 781-464-8147 Novell Making IT Work As One -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
2011/1/26 Robert Schweikert
Hi,
Working on packaging OpenStack as part of my Hackweek 6 endeavor. Nova (one part of OpenStack) needs a newer version of redis than is available in OBS, thus I am sticking a copy into Virtualization:Cloud:OpenStack for now.
I have run into a stupid link error that makes no sense to me, thus help is much appreciated.
/usr/src/packages/BUILD/redis-2.0.4/redis.c:9293: undefined reference to `log'
The math library is on the link line:
cc -o redis-server -std=c99 -pedantic -O2 -Wall -W -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -lm -pthread -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -rdynamic -ggdb adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o
...but in the wrong place. Because of this: https://build.opensuse.org/package/view_file?file=binutils-build-as-needed.diff&package=binutils&project=devel:gcc and /etc/profile.d/suse-buildsystem.sh from post-build-checks The man from ld applies: -l namespec --library=namespec Add the archive or object file specified by namespec to the list of files to link. This option may be used any number of times. If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a. On systems which support shared libraries, ld may also search for files other than libnamespec.a. Specifically, on ELF and SunOS systems, ld will search a directory for a library called libnamespec.so before searching for one called libnamespec.a. (By convention, a ".so" extension indicates a shared library.) Note that this behavior does not apply to :filename, which always specifies a file called filename. ********The linker will search an archive only once, at the location where it is specified on the command line********. If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again. Usually caused because of a confusion between _LIBADD/_LDADD and _LDFLAGS in automake: http://www.gnu.org/software/automake/manual/automake.html#Libtool-Flags -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Hi, On 01/26/2011 04:10 PM, Cristian Morales Vega wrote:
2011/1/26 Robert Schweikert
: Hi,
Working on packaging OpenStack as part of my Hackweek 6 endeavor. Nova (one part of OpenStack) needs a newer version of redis than is available in OBS, thus I am sticking a copy into Virtualization:Cloud:OpenStack for now.
I have run into a stupid link error that makes no sense to me, thus help is much appreciated.
/usr/src/packages/BUILD/redis-2.0.4/redis.c:9293: undefined reference to `log'
The math library is on the link line:
cc -o redis-server -std=c99 -pedantic -O2 -Wall -W -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -lm -pthread -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -rdynamic -ggdb adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o
...but in the wrong place.
Because of this: https://build.opensuse.org/package/view_file?file=binutils-build-as-needed.diff&package=binutils&project=devel:gcc and /etc/profile.d/suse-buildsystem.sh from post-build-checks
Ah yes. Thanks, that's what I get for not keeping up with what's going on in the world of compiled languages. Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU Software Engineer Consultant LINUX rschweikert@novell.com 781-464-8147 Novell Making IT Work As One -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
El 26/01/11 17:56, Robert Schweikert escribió:
The offending source line is:
return (double)age*log(1+asize);
Makes all sense.. se the line where it fails cc -o redis-server -std=c99 -pedantic -O2 -Wall -W -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -lm -pthread -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -rdynamic -ggdb adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o redis.o: In function `computeObjectSwappability': /usr/src/packages/BUILD/redis-2.0.4/redis.c:9293: undefined reference to `log' Note, -lm MUST be AFTER object files, not before. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (3)
-
Cristian Morales Vega
-
Cristian Rodríguez
-
Robert Schweikert