Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Having an issue compiling Perl 5.24.1 per LFS 8.0 CH 6.40. Everything up to this point has compiled and passed the prescribed checks.
When I attempt to compile perl 5.24.1, I get the following errors at the end of the output:
Code:
/usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against symbol `BZ2_crc32Table' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(compress.o): relocation R_X86_64_32 agaisnt `.rodata.str1.8' can note be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(decompress.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(blocksort.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:484: ../../lib/auto/Compress/Raw/Bzip2/Bzip2.so] Error 1
make[1]: Leaving directory '/sources/8.0/perl-5.24.1/cpan/Comperss-Raw-Bzip2'
make[1]: Entering directory '/sources/8.0/perl-5.24.1/cpan/Compress-Raw-Bzip2'
rm -f ../../lib/auto/Compress/Raw/Bzip2/Bzip2.so
cc -shared -O2 -L/usr/local/lib -fstack-protector-strong -fPIC BZIP2.o -o ../../lib/auto/Compress/Raw/Bzip2/Bzip2.so \
-L/sources/8.0/perl-5.24.1/cpan/Compress-Raw-Bzip2/bzip2-src -lbz2
/usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against symbol `BZ2_crc32Table' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(compress.o): relocation R_X86_64_32 agaisnt `.rodata.str1.8' can note be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(decompress.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbz2.a(blocksort.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:484: ../../lib/auto/Compress/Raw/Bzip2/Bzip2.so] Error 1
make[1]: Leaving directory '/sources/8.0/perl-5.24.1/cpan/Comperss-Raw-Bzip2'
Unsuccessful make(cpan/Compress-Raw-Bzip2): code=512 at make_ext.pl line 569.
make: *** [makefile:599: lib/auto/Compress/Raw/Bzip2/Bzip2.so] Error 2
After googling and searching the last week I found a couple posts that suggest that a recompiling of the bzip package and re-installation should clean up this issue, but it hasn't solved it for me. I performed all the steps in 6.18 again, ran the check scripts with no errors, and verified that all of the installed files are located and linked in the right places (according to the instructions).
If I remove the two environmental build flags (BUILD_ZLIB=false;BUILD_BZIP2=0) then it will compile without error. This again (i think) points to the bzip library as flawed. Does anyone have any input on what I can try next to solve this issue?
Usually the first line that says error is the show stopper
Code:
/usr/bin/ld: /usr/local/lib/libbz2.a(blocksort.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Lol, yes. I should have mentioned that. I added the fPIC flags to Perl to no avail. Then I went back and re-re-compiled the bzip library with the fPIC flags and then tried Perl without and then with the flags again. It hasn't helped.
I'll back out here. It's been too long since I did LFS myself for me to be much use to you. I did LFS-3.3 & 5.0 back in the day, but that was a l-o-n-g time ago. I even did a HLFS, when such existed, and then diverted to Kevux, when that existed. All part of the learning curve.
EDIT: Maybe I have thought of something. libbz2.a is a static lib, and hardly is linked to perl. I did the basic check 'ldd /usr/bin/perl |grep libbz2 and it didn't show. I would go looking for it in blocksort.o or blocksort.* (blocksort.c probably), wherever that is, and see if it's there. There's always the possibility of a typo screwing you over in unbelievable ways with LFS. Maybe in the top source dir, try 'find -name 'blocksort.*'
Last edited by business_kid; 07-25-2017 at 12:48 PM.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
The build instructions for the basic system are CORRECT dont change them from the ones in the book you will cause problems later, also you should not be using '/usr/local ...' for building the system you have gone wrong back up and check what you have done.
I went back and reviewed my work from the beginning of chapter 6 and did not find any errors in what I had accomplished to this point. Unless I'm daft, I think my system is correct to this point.
Since you pointed out that it shouldn't be using /usr/local I dug into the cpan/Compress-Raw-Bzip2/ folder and edited the Makefile to redirect references to /usr/local to just /usr. This allowed it to compile properly and pass the self checks as described in the instructions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.