[BUG]: relocation R_X86_64_PC32 against symbol `_ZTV10ConfigFile' can not be used when making a shared object; recompile with -fPIC
Open
Nobody has claimed this yet.
triage
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
master
Problem description
When using cmake, the third-party library has interdependence and an error occurs.
Looking forward to your reply.
Errors:
/usr/bin/ld: /home/xxx/lib/libobjMesh.a(objMesh.o): warning: relocation against `_ZTIi@@CXXABI_1.3' in read-only section `.text.unlikely'
/usr/bin/ld: /home/xxx/lib/libconfigFile.a(configFile.o): relocation R_X86_64_PC32 against symbol `_ZTV10ConfigFile' can not be used when making a shared object; recompile with -fPIC
Complete cmakelists:
cmake_minimum_required(VERSION 3.4...3.18)
project(corn_deformable)
SET(CMAKE_CXX_STANDARD 11)
SET(SOURCES src/main.cpp src/CornDeform.cpp)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_subdirectory(pybind11)
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/VEGA_FEM_4_0/include
)
LINK_DIRECTORIES(
${PROJECT_SOURCE_DIR}/VEGA_FEM_4_0/lib
)
pybind11_add_module(${PROJECT_NAME} ${SOURCES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC
-Wl,--start-group
-lGL -lGLU -lglut -lGLEW
libbasicAlgorithms.a
libcamera.a
libclothBW.a
libconfigFile.a
libconstrainedDOFs.a
libcorotationalLinearFEM.a
libforceModel.a
libgetopts.a
libgraph.a
libimageIO.a
libintegrator.a
libintegratorSparse.a
libinterpolationCoordinates.a
libisotropicHyperelasticFEM.a
liblighting.a
liblistIO.a
libmassSpringSystem.a
libmatrixIO.a
libmesh.a
libminivector.a
libobjMesh.a
libopenGLHelper.a
libperformanceCounter.a
libpolarDecomposition.a
libsceneObject.a
libsparseMatrix.a
libsparseSolver.a
libstencilForceModel.a
libstvk.a
libvolumetricMesh.a
-Wl,--end-group
)
# EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a
# define (VERSION_INFO) here.
target_compile_definitions(${PROJECT_NAME}
PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided CMakeLists.txt and the linker diagnostics, then verify how the listed third-party static libraries were built and whether their position-independent-code settings are available. Done would be a confirmed project-side or third-party build cause with a reproducible configuration or documented limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100