Am Mittwoch, 16. Dezember 2009 18:15:03 schrieb Peter Pöml:
Hi,
I had a failing build on openSUSE 11.2, for no apparent reason.
Compiling with -Wall, no error or warning was issued, just:
/tmp/ccg01MtC.o: In function `main': /usr/src/packages/BUILD/mirrorbrain-2.11.3/tools/ geoiplookup_continent.c:56: undefined reference to `GeoIP_open' /usr/src/packages/BUILD/mirrorbrain-2.11.3/tools/ geoiplookup_continent.c:57: undefined reference to `GeoIP_database_edition' /usr/src/packages/BUILD/mirrorbrain-2.11.3/tools/ geoiplookup_continent.c:66: undefined reference to `GeoIP_record_by_name' /usr/src/packages/BUILD/mirrorbrain-2.11.3/tools/ geoiplookup_continent.c:60: undefined reference to `GeoIP_country_id_by_name' /tmp/ccg01MtC.o: In function `printf': /usr/include/bits/stdio2.h:105: undefined reference to `GeoIP_country_continent' collect2: ld returned 1 exit status
However, the gcc command executed manually in the build system without a problem.
After some thinking (I have been building packages for 9 years only), I figured that only something in the environment could be influencing the strange behaviour.
A strategically placed 'env' showed that "SUSE_ASNEEDED=1" is exported, and that proved to be the culprit.
http://old.nabble.com/Strange-build-behaviour-td26741825.html explains the behaviour.
The "fix" is reordering arguments:
-gcc $RPM_OPT_FLAGS -Wall -lGeoIP -o geoiplookup_continent geoiplookup_continent.c +gcc $RPM_OPT_FLAGS -Wall -o geoiplookup_continent geoiplookup_continent.c -lGeoIP
Critique: --------- IMHO, this could have been made more obvious. The above shown linker error isn't really elucidating. In fact, it doesn't seem to make any sense at all. I doubt that all build service users read the opensuse-specific packaging list. And new users won't know that it might have been discussed there. Some kind of keyword as a start for a Google recherche is lacking.
Well, yes, but this is a typical problem which can happen at any time with the gnu tools. Link order just matters, even when this particular case was introduced with the asneeded feature of gcc, it can happen also without. So, a better message would be a task to the linker people. But I think it is quite hard to list all possible reasons there in a readable way. The OBS solution for such kind of problems would be a kind of generic expert system for the error analyses. But we don't have that yet. However, if someone wants to draft a concept .... ;) bye adrian -- Adrian Schroeter SUSE Linux Products GmbH email: adrian@suse.de -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org