Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 485690 - app-arch/bzip2-1.0.6-r4[static]: building more than one ABI at a time leaks -static in LDFLAGS
Summary: app-arch/bzip2-1.0.6-r4[static]: building more than one ABI at a time leaks -...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-22 18:51 UTC by Greg Turner
Modified: 2014-01-05 17:47 UTC (History)
0 users

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


Attachments
fix app-arch/bzip2 multi-ABI support (fixbzip2.patch,491 bytes, patch)
2013-09-24 18:14 UTC, Greg Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Turner 2013-09-22 18:51:35 UTC
# MAKEOPTS=-j1 USE="static abi_x86_32 abi_x86_64" CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe" emerge -1 =app-arch/bzip2-1.0.6-r4
.
.
>>> Compiling source in /var/tmp/portage/app-arch/bzip2-1.0.6-r4/work/bzip2-1.0.6 ...
 * x86: running multilib-minimal_abi_src_compile
.
.
x86_64-pc-linux-gnu-gcc -m32 -O2 -pipe -fpic -fPIC -Wall -Winline -D_FILE_OFFSET_BITS=64  -c bzlib.c
x86_64-pc-linux-gnu-gcc -m32 -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o
x86_64-pc-linux-gnu-gcc -m32 -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -O2 -pipe -fpic -fPIC -Wall -Winline -D_FILE_OFFSET_BITS=64  -o bzip2-shared bzip2.c libbz2.so.1.0.6
bzip2.c: In function 'testStream':
bzip2.c:612:37: warning: variable 'nread' set but not used [-Wunused-but-set-variable]
bzip2.c: In function 'applySavedFileAttrToOutputFile':
bzip2.c:1128:4: warning: ignoring return value of 'fchown', declared with attribute warn_unused_result [-Wunused-result]
rm -f libbz2.so.1.0
ln -s libbz2.so.1.0.6 libbz2.so.1.0
.
.
# (ed: everything seemingly went fine, so far, but...)
 * amd64: running multilib-minimal_abi_src_compile
.
.
x86_64-pc-linux-gnu-gcc -O2 -pipe -static -fpic -fPIC -Wall -Winline -D_FILE_OFFSET_BITS=64  -c bzlib.c
x86_64-pc-linux-gnu-gcc -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o
x86_64-pc-linux-gnu-gcc -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -O2 -pipe -static -fpic -fPIC -Wall -Winline -D_FILE_OFFSET_BITS=64  -o bzip2-shared bzip2.c libbz2.so.1.0.6
bzip2.c: In function 'testStream':
bzip2.c:612:37: warning: variable 'nread' set but not used [-Wunused-but-set-variable]
bzip2.c: In function 'applySavedFileAttrToOutputFile':
bzip2.c:1128:4: warning: ignoring return value of 'fchown', declared with attribute warn_unused_result [-Wunused-result]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: attempted static link of dynamic object `libbz2.so.1.0.6'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
 * ERROR: app-arch/bzip2-1.0.6-r4::gentoo failed (compile phase):
 *   emake failed


notice the differing gmake status lines:

x86_64-pc-linux-gnu-gcc -m32 -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -O2 -pipe -fpic -fPIC -Wall -Winline -D_FILE_OFFSET_BITS=64  -o bzip2-shared bzip2.c libbz2.so.1.0.6 # x86
x86_64-pc-linux-gnu-gcc -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed -O2 -pipe -static -fpic -fPIC -Wall -Winline -D_FILE_OFFSET_BITS=64  -o bzip2-shared bzip2.c libbz2.so.1.0.6 # amd64

Haven't delved into the mechanics at all, but seems intuitive that bzip2-shared shouldn't be statically linked :)

IIRC the build-geist of upstream bzip2 is to make a static executable and a second shared-lib-consuming equivalent, side-by-side, but gentoo, being a unique and beautiful snowflake, adds a -static cflag instead.  imo it would be nicer to leave CFLAGS alone, build both executables like upstream, and just deploy to /bin/bzip2 as appropriate to the USE-flag setting.  Then again, perhaps I don't quite have my facts straight.

still, either we should fix the compile-failure or throw some kind of REQUIRED_USE in there.

Glancing at the ebuild, I think the problem is that multilib_src_compile() tries to build the shared library normally, then set the -static use flag, then build the executable.  But the -static use-flag is here to stay, so when those extra ABI's get compiled, the flag is still "live".
Comment 1 Greg Turner 2013-09-24 18:14:18 UTC
Created attachment 359380 [details, diff]
fix app-arch/bzip2 multi-ABI support

How about this
Comment 2 SpanKY gentoo-dev 2014-01-05 17:47:25 UTC
should be all set now in the tree; thanks for the report!

Commit message: Only set -static in LDFLAGS for prog building
http://sources.gentoo.org/app-arch/bzip2/bzip2-1.0.6-r4.ebuild?r1=1.3&r2=1.4