LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-01-2020, 11:07 PM   #1
mustang2049
LQ Newbie
 
Registered: Apr 2020
Posts: 4

Rep: Reputation: Disabled
'Recompile with -fPIC' errors (relocation R_X86_64_32S against symbol ` ' can not be used when making a shared object


Hello,

I have been having problems on LFS lately. Everything went well until 6.14 (the version of LFS is 9.1 released March 2020), when I had to compile File-5.38. I get the following error message:

Code:
(lfs chroot) root:/sources/file-5.38# make
make  all-recursive
make[1]: Entering directory '/sources/file-5.38'
Making all in src
make[2]: Entering directory '/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 '/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
/tools/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/../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
/tools/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/../lib/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
/tools/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/../lib/libbz2.a(decompress.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/tools/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/../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
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:499: libmagic.la] Error 1
make[3]: Leaving directory '/sources/file-5.38/src'
make[2]: *** [Makefile:380: all] Error 2
make[2]: Leaving directory '/sources/file-5.38/src'
make[1]: *** [Makefile:400: all-recursive] Error 1
make[1]: Leaving directory '/sources/file-5.38'
make: *** [Makefile:332: all] Error 2
I have searched Google and DuckDuckGo with no success so far, so if anyone here could help me, I would very much appreciate it.

- mustang2049

Last edited by mustang2049; 04-02-2020 at 04:06 PM. Reason: Edit to logs from Terminal
 
Old 04-02-2020, 02:59 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,399

Rep: Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611Reputation: 3611
Welcome to LQ.

http://www.linuxfromscratch.org/lfs/...ch-tools-bzip2
5.18.1. Installation of Bzip2
Quote:
The Bzip2 package does not contain a configure script. There are two Makefile, one for the shared library, and the other for the static library. Since we need both, We do the compilation in two stages. First the shared library
May be you forgot the shared libs ?
cp -av libbz2.so* /tools/lib && ln -sv libbz2.so.1.0 /tools/lib/libbz2.so

-
 
1 members found this post helpful.
Old 04-02-2020, 03:08 PM   #3
mustang2049
LQ Newbie
 
Registered: Apr 2020
Posts: 4

Original Poster
Rep: Reputation: Disabled
Code:
(lfs chroot) root:/sources/bzip2-1.0.8# cp -av libbz2.so* /tools/lib && ln -sv libbz2.so.1.0 /tools/lib/libbz2.so
removed '/tools/lib/libbz2.so.1.0'
'libbz2.so.1.0' -> '/tools/lib/libbz2.so.1.0'
ln: failed to create symbolic link '/tools/lib/libbz2.so': File exists
It appears that the libraries exist. Is there anything else that appears to be wrong? It does say something about relocation R_x86_64_32 against some files (symbol `BZ2_crc32Table', `.rodata.str1.1', `.rodata' in particular). Any help is appreciated.

Host OS: LXLE
LFS Version: 9.1
Chapter: 6
Chapter and Section: 6.14
Package being compiled: File-5.38
 
Old 04-02-2020, 03:41 PM   #4
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 184

Rep: Reputation: 50
I would consider the hints of knudfl, they point in the right direction.

During the build the static library is used, because you are building a static library.
My guess is that you forgot the make clean after making the dynamic library.
That could explain that objects meant for the dynamic library ended up in the static library.
 
1 members found this post helpful.
Old 04-02-2020, 04:06 PM   #5
mustang2049
LQ Newbie
 
Registered: Apr 2020
Posts: 4

Original Poster
Rep: Reputation: Disabled
While recompiling, I did make clean, but still came up with the same error. However, I simply deleted the original bzip2 directory and re-extracted the tarball and followed all the instructions again, and file-5.38 works correctly again. So it turns out that the problem is bzip2. Thanks for pointing me in that direction!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Error installing file 5.38: can not be used when making a shared object; recompile with -fPIC isochor Linux From Scratch 4 02-10-2020 10:36 AM
PIC compilation - error: relocation R_X86_64_32S against `vtable for hit' can not be tristandnv Programming 5 01-09-2013 08:25 AM
.../.../x86_64-suse-linux/bin/ld:pointerset.o:relocation R_X86_64_32S against '.rodat pradeepkoppaka SUSE / openSUSE 1 03-11-2011 03:01 PM
relocation R_X86_64_32S can not be used when making a shared object; recompile with - gopinath511 Linux - Software 8 04-15-2010 03:16 AM
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared jimmyjiang Linux - Software 3 07-13-2007 12:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:53 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