Mailinglist Archive: opensuse-buildservice (260 mails)

< Previous Next >
Re: [opensuse-buildservice] Pitfall with building on oS 11.2 (SUSE_ASNEEDED in environment)
  • From: Adrian Schröter <adrian@xxxxxxx>
  • Date: Wed, 16 Dec 2009 20:49:06 +0100
  • Message-id: <200912162049.06722.adrian@xxxxxxx>
Am Mittwoch, 16. Dezember 2009 18:15:03 schrieb Peter Pöml:

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':
geoiplookup_continent.c:56: undefined reference to `GeoIP_open'
geoiplookup_continent.c:57: undefined reference to
geoiplookup_continent.c:66: undefined reference to
geoiplookup_continent.c:60: undefined reference to
/tmp/ccg01MtC.o: In function `printf':
/usr/include/bits/stdio2.h:105: undefined reference to
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. explains
the behaviour.

The "fix" is reordering arguments:

-gcc $RPM_OPT_FLAGS -Wall -lGeoIP -o geoiplookup_continent
+gcc $RPM_OPT_FLAGS -Wall -o geoiplookup_continent
geoiplookup_continent.c -lGeoIP

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 .... ;)


Adrian Schroeter
SUSE Linux Products GmbH
email: adrian@xxxxxxx

To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >