LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 02-07-2020, 03:05 PM   #1
isochor
LQ Newbie
 
Registered: Feb 2020
Posts: 2

Rep: Reputation: Disabled
Error installing file 5.38: can not be used when making a shared object; recompile with -fPIC


Hello,

I am trying to understand Linux better. Since the aimless using of Linux Mint brought me nowhere, I thought that LFS would be a good way of digging deeper in a structured way.

Unfortunately I am facing troubles installing the package File 5.38.

Code:
make  all-recursive
make[1]: Entering directory '/mnt/lfs/sources/file-5.38'
Making all in src
make[2]: Entering directory '/mnt/lfs/sources/file-5.38/src'
sed -e "s/X.YY/$(echo 5.38 | tr -d .)/" < ../src/magic.h.in > magic.h
make  all-am
make[3]: Entering directory '/mnt/lfs/sources/file-5.38/src'
  CC       file.o
  CC       seccomp.o
  CC       buffer.lo
  CC       magic.lo
  CC       apprentice.lo
  CC       softmagic.lo
  CC       ascmagic.lo
  CC       encoding.lo
  CC       compress.lo
  CC       is_csv.lo
  CC       is_json.lo
  CC       is_tar.lo
  CC       readelf.lo
  CC       print.lo
  CC       fsmagic.lo
  CC       funcs.lo
  CC       apptype.lo
  CC       der.lo
  CC       cdf.lo
  CC       cdf_time.lo
  CC       readcdf.lo
  CC       strlcpy.lo
  CC       strlcat.lo
  CC       fmtcheck.lo
  CCLD     libmagic.la
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib64/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
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib64/libbz2.a(compress.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib64/libbz2.a(decompress.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib64/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
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:499: recipe for target 'libmagic.la' failed
make[3]: *** [libmagic.la] Error 1
make[3]: Leaving directory '/mnt/lfs/sources/file-5.38/src'
Makefile:380: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/mnt/lfs/sources/file-5.38/src'
Makefile:400: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/mnt/lfs/sources/file-5.38'
Makefile:332: recipe for target 'all' failed
make: *** [all] Error 2
I googled for the string:

Code:
can not be used when making a shared object; recompile with -fPIC
and found an interesting result:
https://stackoverflow.com/questions/...with-fpic?rq=1

My problem is, that I don't know how to apply the suggestion of:
"Extending the compiler flags within the major CMakeLists.txt as required."

Is this the right approach for my problem?

I would be glad, if someone could give me a hint.

Thanks!
 
Old 02-08-2020, 10:38 PM   #2
arch-linq
Member
 
Registered: Sep 2018
Location: Midwest, USA
Distribution: Arch,LFS,BLFS
Posts: 110

Rep: Reputation: Disabled
Run the host version-chk script chk for missing pkgs. Your tools are broke.
 
1 members found this post helpful.
Old 02-09-2020, 12:36 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,516

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
LFS - Version 9.0 ?

@isochor : Welcome to LQ.

5.18. Bzip2-1.0.8 http://www.linuxfromscratch.org/lfs/...r05/bzip2.html
... Seems this will build libbz2.a only.

Quote:
File 5.38
A missing "libbz2.so" : Yes, that's strange as it seems not to be built until 6.22
http://www.linuxfromscratch.org/lfs/...r06/bzip2.html
→ $ make -f Makefile-libbz2_so


EDIT : The LFS version is missing in your question. Is it the unstable development version, Version SVN-20200201 ?
Maybe you forgot some of this this :
Code:
make PREFIX=/tools install
cp -v bzip2-shared /tools/bin/bzip2
cp -av libbz2.so* /tools/lib
ln -sv libbz2.so.1.0 /tools/lib/libbz2.so
Ref. http://www.linuxfromscratch.org/lfs/...r05/bzip2.html

-

Last edited by knudfl; 02-09-2020 at 12:51 AM.
 
1 members found this post helpful.
Old 02-09-2020, 05:00 AM   #4
isochor
LQ Newbie
 
Registered: Feb 2020
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank both of you for your input, it worked!

The problem was indeed the bzip2 package. I don't know which LFS version I am setting up, I started last weekend and followed so far the instructions:


Code:
http://linuxfromscratch.org/lfs/view/stable/
Linux From Scratch
Version 9.0
Published September 1st, 2019
 
Old 02-10-2020, 09:36 AM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Please mark as SOLVED
 
  


Reply

Tags
lfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
relocation R_X86_64_32S can not be used when making a shared object; recompile with - gopinath511 Linux - Software 8 04-15-2010 02:16 AM
Error recompile with fPIC, but fPIC is already as a compilation option eolmsan Linux - Software 4 12-03-2008 11:05 AM
how to find out shared object or ELF binay compiled with -fPIC dayalan_cse Programming 3 11-12-2008 06:58 PM
about -fpic/-fPIC option for gcc George2 Programming 2 09-04-2006 01:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration