Search code examples
c++clinuxshared-librariesicc

warning: cannot find entry symbol _start - while compiling to .so


Hello I am running Linux Ubuntu and am compiling using icpc (intel compiler), I want to get a shared library so I used the command:

icpc -o myShared.so -std=c++11 -shared -DSTDC_HEADERS -D __cplusplus=201103L -fpermissive -DPT_XX_DEV -fexceptions -frtti -DANDROID -w -fstack-protector -fPIE -fPIC -pie -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security  -I/home/admins/aaa/include  -I/home/admins/bbb/include a.cpp b.cpp c.cpp  -lpthread -L./../../static_libs -lmyStatic

I an getting a warning:

ld: warning: cannot find entry symbol _start; defaulting to 0000000000007040

I read about this warning in previous topics, and I discovered that this warning connected to the entry point of the program, but as far as I understand - there shouldn't be entry point in shared library.

Does Anyone have an idea how to resolve it?


Solution

  • Removing -fPIE and -pie flags solved my problem. -pie shouldn't be used when you are trying to create shared library, and also -fPIE shouldn't be used in most of the cases.