LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-30-2017, 07:32 PM   #1
Borneq
Member
 
Registered: Aug 2014
Posts: 30

Rep: Reputation: Disabled
Shared object and PIC (docker) problem


I want compile shared object with database HBase classes.
I have error:
/usr/bin/ld: /usr/src/hbase/hbase-native-client/buck-out/gen/third-party/gen_libevent/gen_libevent/libevent.a(event.o): relocation R_X86_64_PC32 against symbol `event_global_current_base_' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

libevent is not HBase, but system library. In /usr/ I have no libevent.a, but libevent.so.
Problem is docker, I don't know from where is copied libevent.a.
 
Old 08-31-2017, 04:57 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,482
Blog Entries: 6

Rep: Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413
Please place your code and error message snippets inside [CODE]...[/CODE] tags for better readability. You may type those yourself or click the "#" button in the edit controls.

Did you read the linker error message and follow the instructions for recompiling? If so, what was the result?
 
Old 09-13-2017, 12:26 PM   #3
Borneq
Member
 
Registered: Aug 2014
Posts: 30

Original Poster
Rep: Reputation: Disabled
I did not look into this forum, because I have changed shared object to server-client architecture.
 
Old 09-13-2017, 12:36 PM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,276

Rep: Reputation: 994Reputation: 994Reputation: 994Reputation: 994Reputation: 994Reputation: 994Reputation: 994Reputation: 994
If you wish to create a shared object, you cannot use non-PIC code, such as libevent.a
 
Old 09-29-2017, 04:31 PM   #5
Borneq
Member
 
Registered: Aug 2014
Posts: 30

Original Poster
Rep: Reputation: Disabled
libevent can be compiled as PIC?
There is BUCK file HBASE-14850/hbase-native-client/third-party/BUCK
https://pastebin.com/7jDZTTPN
Note: I have add compiler_flags=['-fPIC'] and changed force_static to False but not helps...
 
  


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
shared object linkin problem rohaanembedded Red Hat 7 07-18-2013 06:10 AM
data sharing between c++ shared object and Fortran shared object Madhubala Debian 2 08-19-2011 02:22 AM
Linking PIC and non-PIC code...into a shared library debuser123 Programming 2 03-27-2011 09:50 PM
Problem in Loading a shared object in linux phani@tcs Programming 1 01-11-2006 08:29 AM
problem in loading a shared object in linux phani@tcs Linux - General 2 01-10-2006 03:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:43 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration