Mailinglist Archive: opensuse-buildservice (260 mails)

< Previous Next >
[opensuse-buildservice] Pitfall with building on oS 11.2 (SUSE_ASNEEDED in environment)
  • From: Peter Pöml <poeml@xxxxxxxxxxx>
  • Date: Wed, 16 Dec 2009 18:15:03 +0100
  • Message-id: <A0839A33-301C-4499-AA70-DAB43839E9E8@xxxxxxxxxxx>
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.

Peter

< Previous Next >