Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 487246

Summary: sys-libs/libapparmor-2.8.1 fails to build while python use flag is enabled
Product: Gentoo Linux Reporter: Victor Roman Archidona <vroman>
Component: HardenedAssignee: Michael Palimaka (kensington) <kensington>
Status: RESOLVED FIXED    
Severity: normal CC: hardened, zerochaos
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Fixes librar path
ebuild for -r1 release using epatch

Description Victor Roman Archidona 2013-10-07 22:46:28 UTC
I tried to get libapparmor from hardened-dev overlay just for fun.

When emerging such library using the python USE flag, I got the following message:

[snip]
running build_ext
building '_LibAppArmor' extension
creating build/temp.linux-i686-3.3
i686-pc-linux-gnu-gcc -pthread -O2 -march=i686 -pipe -fomit-frame-pointer -fpic -fPIE -fPIC -I../../src -I/usr/include/python3.3 -c libapparmor_wrap.c -o build/temp.linux-i686-3.3/libapparmor_wrap.o
i686-pc-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -O2 -march=i686 -pipe -fomit-frame-pointer -fpic -fPIE build/temp.linux-i686-3.3/libapparmor_wrap.o -L/usr/lib -lpython3.3 -o build/lib.linux-i686-3.3/LibAppArmor/_LibAppArmor.cpython-33.so -L../../src/.libs -lapparmor
/usr/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lapparmor
collect2: error: ld returned 1 exit status
error: command 'i686-pc-linux-gnu-gcc' failed with exit status 1
make: *** [all-local] Error 1
[snip]

The root cause is the libraries/libapparmor/swig/python/setup.py.in file, which looks for a ".libs" subdir where libapparmor.so resides at the wrong place.

I've wrote a patch which removes the macro usage and uses a fixed correct path to the right subdirectory, allowing libapparmor to be built.

As I took the ebuild from hardened-dev overlay I don't mind this needs to be quickly fixed.

Reproducible: Always

Steps to Reproduce:
1. Add hardened-dev overlay to your system
2. USE="python" emerge libapparmor
Comment 1 Victor Roman Archidona 2013-10-07 22:47:17 UTC
Created attachment 360356 [details, diff]
Fixes librar path
Comment 2 Victor Roman Archidona 2013-10-07 22:47:43 UTC
Created attachment 360358 [details]
ebuild for -r1 release using epatch
Comment 3 Rick Farina (Zero_Chaos) gentoo-dev 2013-10-07 22:57:25 UTC
looks sane here, this kind or thing can easily be missed on upgrade as it often only presents on fresh install.
Comment 4 Michael Palimaka (kensington) gentoo-dev 2013-12-03 17:45:10 UTC
Thanks, this is fixed in 2.8.2 which is in portage. Big thanks to mgorny for massive cleanup to python code.