[opensuse-buildservice] Pitfall with building on oS 11.2 (SUSE_ASNEEDED in environment)
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
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.
this change was even announced and a wiki article to explain it was posted long ago: http://en.opensuse.org/Packaging/Fixing darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Am 16.12.2009 um 18:19 schrieb Marcus Rueckert:
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.
this change was even announced and a wiki article to explain it was posted long ago: http://en.opensuse.org/Packaging/Fixing
Think 5 meters farther :-) or read again: that's my point -- it doesn't help new users if something was announced at a time where there weren't subscribed. The error message doesn't give a hint. So where do you expect users to start searching? And as you see, it doesn't even help me, even though I was subscribed at the time. Because, how do you expect me to think of that particular thing? There are numerous examples where a very useful pointer is given (or appended to the build log) that helps to understand and fix issues. Good examples galore. Clearer now? Peter
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
On Wednesday 2009-12-16 20:49, Adrian Schröter wrote:
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
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.
I concur. Link order matters. It does for static libraries and, perhaps not seen very often, does for some non-GNU tools. It just so happens that GNU ld seems to default to relaxing when dynamic libraries are used, almost as if the -( and -) options were given. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Hi, Am 16.12.2009 um 20:49 schrieb Adrian Schröter:
Am Mittwoch, 16. Dezember 2009 18:15:03 schrieb Peter Pöml:
-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.
The error as such - indeed, it could happen in various situations. However, the particular situation here is that it unexpectedly happens only on a certain platform, for code that has worked for years and on several platforms, and is not reproducible at first.
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.
I see your point. But I think it would be enough if the linker issues a hint only if SUSE_ASNEEDED=1 is set in the environment (which seems to be special enough a situation to me). ("Note: experimental linker feature enabled by SUSE_ASNEEDED=1 in the environment; watch your link argument order carefully.") I agree that it's more a job for the linker (people). Or for those who set SUSE_ASNEEDED=1 in the build environment.
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 .... ;)
I realize that it's not easy to give advice for universally occurring errors. Still, something like http://ubuntu-virginia.ubuntuforums.org/showpost.php?p=6577455&postcount=2 would be useful. It might be a good start, cover a majority of the problems that you could run into, at least by pointing to the documentation. On 11.2, it could include a hint on the asneeded thing. Peter-- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (4)
-
Adrian Schröter
-
Jan Engelhardt
-
Marcus Rueckert
-
Peter Pöml