← Back to team overview

maria-developers team mailing list archive

Re: Cassandra plugin build error: _S_empty_rep_storage' can not be used when making a shared object; recompile with -fPIC

 

Hello!

Thanks for a quick reply! So I should add -fPIC to cmake arguments?
Why isn't it in MariaDB sources by default, what are the downsides?

GCC manual said "This option makes a difference on the m68k, PowerPC
and SPARC." -> I am running amd64


For background, in my Debian packaging the build command looks like this:

sh -c  'PATH=${MYSQL_BUILD_PATH:-"/bin:/usr/bin"} \
    CC=${MYSQL_BUILD_CC:-gcc} \
CFLAGS=${MYSQL_BUILD_CFLAGS:-"-O2 -DBIG_JOINS=1 -fno-strict-aliasing "} \
    CXX=${MYSQL_BUILD_CXX:-g++} \
    CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1
-felide-constructors -fno-exceptions -fno-rtti -fno-strict-aliasing "}
\
   cmake -DCMAKE_INSTALL_PREFIX=/usr \
\
   -DCOMPILATION_COMMENT="(Ubuntu)" \
   -DMYSQL_SERVER_SUFFIX="-1" \
   -DSYSTEM_TYPE="debian-linux-gnu" \
   -DWITHOUT_TOKUDB=true \
   -DBUILD_CONFIG=mysql_release \
   -DINSTALL_LIBDIR=lib/x86_64-linux-gnu \
   -DINSTALL_PLUGINDIR=lib/mysql/plugin \
   -DINSTALL_SUPPORTFILESDIR=share/mysql \
-DDEB=1 ..'


In upstream MariaDB the build command is:

sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin:/usr/local/bin"} \
CC=$${MYSQL_BUILD_CC:-gcc} \
CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O2 -fno-omit-frame-pointer -g -pipe
-Wall -Wno-uninitialized $$(case `lsb_release -sc` in (lenny) echo
-DWORKAROUND_GCC_4_3_2_BUG ;; esac)"} \
CXX=$${MYSQL_BUILD_CXX:-g++} \
CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O2 -fno-omit-frame-pointer -g
-pipe -Wall -Wno-uninitialized"} \
cmake .. \
-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
-DBUILD_CONFIG=mysql_release \
-DCOMPILATION_COMMENT="mariadb.org binary distribution" \
-DSYSTEM_TYPE="debian-linux-gnu" \
-DDEB=debian'


2014-04-01 16:21 GMT+03:00 Peter W Bowey <support@xxxxxxxxxxxxx>:
> You require -fPIC to compile. See the info you reported = "> object;
> recompile with -fPIC"
>
> Info is here (via GCC manual):
>
> -fPIC
> If supported for the target machine, emit position-independent code,
> suitable for dynamic linking and avoiding any limit on the size of the
> global offset table. This option makes a difference on the m68k, PowerPC and
> SPARC.
> Position-independent code requires special support, and therefore works only
> on certain machines.
>
> When this flag is set, the macros __pic__ and __PIC__ are defined to 2.
>
> In brief, the term position independent code (PIC) refers to the generated
> machine code which is memory address agnostic, i.e. does not make any
> assumptions about where it was loaded into RAM. Only position independent
> code is supposed to be included into shared objects (SO) as they should have
> an ability to dynamically change their location in RAM.
>
>
> ----- Original Message ----- From: "Otto Kekäläinen" <otto@xxxxxxxxx>
> To: <maria-developers@xxxxxxxxxxxxxxxxxxx>
> Cc: "Roger Meier" <roger@xxxxxxxxxxxxxxxxx>; "Jake Farrell"
> <jfarrell@xxxxxxxxxx>
> Sent: Tuesday, April 01, 2014 11:16 PM
> Subject: [Maria-developers] Cassandra plugin build error:
> _S_empty_rep_storage' can not be used when making a shared object; recompile
> with -fPIC
>
>
>> Hello!
>>
>> I am testing out building MariaDB 10.0.10 on a Ubuntu 12.04 system
>> with libthrift-dev installed (latest 0.9.0 from repo 'deb
>> http://ppa.launchpad.net/wnoronha/thrift/ubuntu precise main').
>>
>> Building fails with this error:
>>
>> make[4]: Siirrytään hakemistoon
>> "/home/otto/MariaDB/pkg-mariadb-10.0/mariadb-10.0/builddir"
>> Scanning dependencies of target cassandra
>> make[4]: Poistutaan hakemistosta
>> "/home/otto/MariaDB/pkg-mariadb-10.0/mariadb-10.0/builddir"
>> make[4]: Siirrytään hakemistoon
>> "/home/otto/MariaDB/pkg-mariadb-10.0/mariadb-10.0/builddir"
>> [ 75%] Building CXX object
>> storage/cassandra/CMakeFiles/cassandra.dir/ha_cassandra.cc.o
>> [ 75%] Building CXX object
>> storage/cassandra/CMakeFiles/cassandra.dir/cassandra_se.cc.o
>> [ 75%] Building CXX object
>> storage/cassandra/CMakeFiles/cassandra.dir/gen-cpp/Cassandra.cpp.o
>> [ 75%] Building CXX object
>> storage/cassandra/CMakeFiles/cassandra.dir/gen-cpp/cassandra_types.cpp.o
>> [ 75%] Building CXX object
>>
>> storage/cassandra/CMakeFiles/cassandra.dir/gen-cpp/cassandra_constants.cpp.o
>> Linking CXX shared module ha_cassandra.so
>> /usr/bin/ld.bfd.real:
>>
>> /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libthrift.a(TApplicationException.o):
>> relocation R_X86_64_32S against `std::basic_string<char,
>> std::char_traits<char>, std::allocator<char>
>>>
>>> ::_Rep::_S_empty_rep_storage' can not be used when making a shared
>>
>> object; recompile with -fPIC
>> /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libthrift.a: could
>> not read symbols: Bad value
>> collect2: ld:n paluuarvo oli 1
>> make[4]: *** [storage/cassandra/ha_cassandra.so] Virhe 1
>>
>>
>> Ideas?
>>
>>
>> --
>> Check out our blog at http://seravo.fi/blog
>> and follow @ottokekalainen
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~maria-developers
>> Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~maria-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
> ---
> This email is free from viruses and malware because avast! Antivirus
> protection is active.
> http://www.avast.com
>



-- 
Check out our blog at http://seravo.fi/blog
and follow @ottokekalainen


References