Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 334403 - dev-lang/helium: fails with forced --as-needed
Summary: dev-lang/helium: fails with forced --as-needed
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High QA (vote)
Assignee: Gentoo's Haskell Language team
Depends on:
Blocks: as-needed
  Show dependency tree
Reported: 2010-08-25 10:56 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2010-08-29 18:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---

Build log (helium-1.6:20100824-212528.log,181.85 KB, text/plain)
2010-08-25 10:58 UTC, Diego Elio Pettenò (RETIRED)

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-25 10:56:40 UTC
I'm reporting this bug because the package in summary fails to build when forcing --as-needed on through spec files (check out for details).

Please note that this bug _might_ apply to -Wl,--as-needed in LDFLAGS as well; in both cases it should be fixed. Also, if this is due to the package in question not respecting user-defined LDFLAGS, you should get to fix that too.

Check the attached build log.

Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-25 10:58:13 UTC
Created attachment 244509 [details]
Build log
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2010-08-29 06:41:29 UTC
gcc -o lvmrun -lm -ldl core/main.o core/stats.o <another-objects>...
core/dynamic.o: In function `dynamic_close':
dynamic.c:(.text+0x62): undefined reference to `dlclose'
<other dl libs>...
primfloat.c:(.text+0x271): undefined reference to `sqrt'
core/primfloat.o: In function `fp_pow':
<other math functions>...
collect2: ld returned 1 exit status
make[1]: *** [lvmrun] Error 1

Moving libraries after objects in command line should fix it.

I wonder why i can't reproduce it.
Does --as-needed force proper link order or it's just a consequence you've got the failure?
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2010-08-29 06:59:01 UTC
> I wonder why i can't reproduce it.

Oh nevermind, it really disregards --as-needed.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-29 14:48:15 UTC
Forced a--as-needed is sidestepping the fact that the package is ignoring LDFLAGS ;)

And yes, --as-needed require proper linking order to be respected.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2010-08-29 18:52:58 UTC
(In reply to comment #4)
> Forced --as-needed is sidestepping the fact that the package is ignoring

I was confused by faulty assumption helium respecting LDFLAGS. Realized the real problem right after 'Commit' button. Sorry.

> And yes, --as-needed require proper linking order to be respected.

Hm... Nice feature :]

Committed the fix to the tree.
Fix forces 'lvmrun' (C program) to respect CFLAGS and LDFLAGS. It will fix the breakage, but will not fix LDFLAGS ignorance for haskell-built binaries (a common problem for all haskell binaries, bug #333217):

 * QA Notice: Files built without respecting LDFLAGS have been detected
 *  Please include the following list of files in your report:
 * /usr/lib/helium/bin/helium
 * /usr/lib/helium/bin/texthint

The haskell and ghc teams still need to work out canonical solution for all haskell built binaries how to deal with external CFLAGS/LDFLAGS 

Resolving as FIXED.

Thank you for the report and explanation, Diego!