bitemyapp / bitemyapp/flightcrew
Shared library fails to build on linux
- Dominant language
- C++
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
```
What steps will reproduce the problem?
1. cmake -G "Unix Makefiles" -DBUILD_SHARED_FC=1 /path/to/extracted/folder
2. make
What is the expected output? What do you see instead?
[ 87%] Building CXX object
src/FlightCrew/CMakeFiles/FlightCrew.dir/Misc/DetermineMimetype.cpp.o
Linking CXX shared library libFlightCrew.so
/usr/bin/ld: ../../lib/libzipios.a(zipextraction.cpp.o): relocation R_X86_64_32
against `zipios::IOException::~IOException()' can not be used when making a
shared object; recompile with -fPIC
../../lib/libzipios.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [src/FlightCrew/libFlightCrew.so] Error 1
make[1]: *** [src/FlightCrew/CMakeFiles/FlightCrew.dir/all] Error 2
make: *** [all] Error 2
What version of the product are you using? On what operating system?
7.2
Ubuntu 10.04 LTS
My solution isn't very elegant, but for each of these files:
src/zipios/CMakeLists.txt
src/BoostParts/CMakeLists.txt
src/XercesExtensions/CMakeLists.txt
src/zlib/CMakeLists.txt
src/Xerces/CMakeLists.txt
after the add_library line, I add this line:
if ( UNIX AND BUILD_SHARED_FC AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fPIC")
endif()
then delete the build directory and build again.
```
Original issue reported on code.google.com by `bmaupinc...@gmail.com` on 10 Oct 2012 at 11:11
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with the listed CMake and make commands on Linux, then inspect the add_library sections in src/zipios/CMakeLists.txt, src/BoostParts/CMakeLists.txt, src/XercesExtensions/CMakeLists.txt, src/zlib/CMakeLists.txt, and src/Xerces/CMakeLists.txt. Compare the reported -fPIC approach and verify that the shared build completes without the relocation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, linux
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100