警告:在编译为 .so 时找不到入口符号 _start [英] warning: cannot find entry symbol _start - while compiling to .so
问题描述
您好,我正在运行 Linux Ubuntu 并且正在使用 icpc(英特尔编译器)进行编译,我想获得一个共享库,所以我使用了命令:
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
我收到警告:
ld:警告:找不到入口符号_start;默认为 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.
有人知道如何解决吗?
非常感谢!
推荐答案
删除 -fPIE 和 -pie 标志解决了我的问题.-pie 在您尝试创建共享库时不应使用,并且在大多数情况下不应使用 -fPIE.
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.
这篇关于警告:在编译为 .so 时找不到入口符号 _start的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!