Skip to content

CMake Shared Library Quirk on 64 bit Linux #9

@jceipek

Description

@jceipek

Not sure whether this is a bug or not.

As I mentioned, I'm in the process of creating python wrappers for ShivaVG. While building these, I discovered a strange problem that only affects 64 bit Linux (I also tested this on 64 bit OS X and 32 bit Linux)

/usr/bin/ld: ../ShivaVG/src/libOpenVG.a(shPath.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
../ShivaVG/src/libOpenVG.a: could not read symbols: Bad value

I got around this by adding the following to the bottom of CMakeLists.txt in the src directory:
SET_TARGET_PROPERTIES( OpenVG PROPERTIES COMPILE_FLAGS -fPIC)

based on http://www.cmake.org/pipermail/cmake/2006-September/011316.html

I haven't done much linking before, so I'm not very familiar with the process of making and using static and shared libraries. Is the -fPIC flag a silly thing to add in this case? Should I be linking against a shared library instead (which the current system doesn't generate)? Should it be part of the CMake system, and if so, where should it be?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions