inexorgame-obsolete / deprecated-cube-engine-inexor

UNMAINTAINED: Please have a look at the vulkan-renderer
https://inexor.org
zlib License
11 stars 1 forks source link

libprotobuf.a can not be used when making a shared object #591

Closed jinq0123 closed 6 years ago

jinq0123 commented 6 years ago

Using Protobuf/3.5.1@inexorgame/stable outputs error:

libprotobuf.a ... can not be used when making a shared object; recompile with -fPIC

Full output:

[jinqing@localhost examples]$ conan install luapbintf/0.1@jinq0123/testing --build missing
luapbintf/0.1@jinq0123/testing: Not found in local cache, looking in remotes...
luapbintf/0.1@jinq0123/testing: Trying with 'conan-center'...
luapbintf/0.1@jinq0123/testing: Trying with 'conan-transit'...
luapbintf/0.1@jinq0123/testing: Trying with 'jinq0123'...
Downloading conanmanifest.txt
[==================================================] 778B/778B
Downloading conanfile.py
[==================================================] 1.2KB/1.2KB
luapbintf/0.1@jinq0123/testing: Installing package
Requirements
    Protobuf/3.5.1@inexorgame/stable from local cache
    lua-cpp/5.3.4@jinq0123/testing from 'jinq0123'
    lua-intf/0.1@jinq0123/testing from 'jinq0123'
    luapbintf/0.1@jinq0123/testing from 'jinq0123'
    zlib/1.2.11@conan/stable from 'conan-center'
Packages
    Protobuf/3.5.1@inexorgame/stable:55b076e244101059f1a4ed1c8053beccba78f95c
    lua-cpp/5.3.4@jinq0123/testing:41b4a670ac66e314bb644198013c12a53602fa3d
    lua-intf/0.1@jinq0123/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
    luapbintf/0.1@jinq0123/testing:e4870bde37f961bd976936d89feabce3c9d81e4a
    zlib/1.2.11@conan/stable:c6d75a933080ca17eb7f076813e7fb21aaa740f2

lua-cpp/5.3.4@jinq0123/testing: Already installed!
lua-intf/0.1@jinq0123/testing: Already installed!
zlib/1.2.11@conan/stable: Already installed!
Protobuf/3.5.1@inexorgame/stable: Already installed!
Downloading conan_sources.tgz
[==================================================] 5.9KB/5.9KB
luapbintf/0.1@jinq0123/testing: Building your package in /home/jinqing/.conan/data/luapbintf/0.1/jinq0123/testing/build/e4870bde37f961bd976936d89feabce3c9d81e4a
luapbintf/0.1@jinq0123/testing: Configuring sources in /home/jinqing/.conan/data/luapbintf/0.1/jinq0123/testing/source
luapbintf/0.1@jinq0123/testing: Copying sources to build folder
luapbintf/0.1@jinq0123/testing: Generator cmake created conanbuildinfo.cmake
luapbintf/0.1@jinq0123/testing: Calling build()
-- The CXX compiler identification is GNU 4.9.2
-- Check for working CXX compiler: /usr/local/bin/c++
-- Check for working CXX compiler: /usr/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: Checking correct version: 4.9
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: C++ stdlib: libstdc++
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jinqing/.conan/data/luapbintf/0.1/jinq0123/testing/build/e4870bde37f961bd976936d89feabce3c9d81e4a
Scanning dependencies of target luapbintf
[ 20%] Building CXX object CMakeFiles/luapbintf.dir/LuaPbIntf.cpp.o
[ 40%] Building CXX object CMakeFiles/luapbintf.dir/detail/LuaPbIntfImpl.cpp.o
[ 60%] Building CXX object CMakeFiles/luapbintf.dir/detail/MessageSetter.cpp.o
[ 80%] Building CXX object CMakeFiles/luapbintf.dir/detail/MsgToTbl.cpp.o
[100%] Linking CXX shared library lib/libluapbintf.so
/usr/bin/ld: /home/jinqing/.conan/data/Protobuf/3.5.1/inexorgame/stable/package/55b076e244101059f1a4ed1c8053beccba78f95c/lib64/libprotobuf.a(message_lite.cc.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/home/jinqing/.conan/data/Protobuf/3.5.1/inexorgame/stable/package/55b076e244101059f1a4ed1c8053beccba78f95c/lib64/libprotobuf.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [lib/libluapbintf.so] Error 1
gmake[1]: *** [CMakeFiles/luapbintf.dir/all] Error 2
gmake: *** [all] Error 2
luapbintf/0.1@jinq0123/testing:
luapbintf/0.1@jinq0123/testing: ERROR: Package 'e4870bde37f961bd976936d89feabce3c9d81e4a' build failed
luapbintf/0.1@jinq0123/testing: WARN: Build folder /home/jinqing/.conan/data/luapbintf/0.1/jinq0123/testing/build/e4870bde37f961bd976936d89feabce3c9d81e4a
ERROR: luapbintf/0.1@jinq0123/testing: Error in build() method, line 21
        self.run("cmake --build . %s" % cmake.build_config)
        ConanException: Error 512 while executing cmake --build .
[jinqing@localhost examples]$

I think protobuf's CMakeLists.txt should add:

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
jinq0123 commented 6 years ago

grpc/CMakeLists.txt has this:

set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
Croydon commented 6 years ago

We don't maintain our own Protobuf recipe anymore, please try https://github.com/bincrafters/conan-protobuf