Skip to content

Can't compile as shared object #114

Open
@donbarthel

Description

@donbarthel

make build-all-dynamic
gives error:
/usr/bin/ld: /home/user/Code/nginx_upstream_module/third_party/yajl/build/yajl-2.1.0/lib/libyajl_s.a(yajl.c.o): relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

It appears to me that the yajl library is statically linked into our dynamic library but the Makefile for yajl compiles without the needed -fPIC flag. The -fPIC flag is used only when the yajl library is dynamically linked.

My work around is to specify the -fPIC flag for all compiles of yajl.

Change in ./third_party/yajl/CMakeLists.txt:
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
to:
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions