gpt4 book ai didi

c - 无法在Mac上编译C应用程序

转载 作者:行者123 更新时间:2023-11-30 16:50:19 25 4
gpt4 key购买 nike

我需要一位了解 Mac SDK 的 C 开发人员帮助。我尝试使用命令创建一个 c 可执行文件

./configure --enable-shared

我需要 --enabled-shared 才能重新分发我的二进制文件。

我偶然发现了这个编译器错误。其他人可以详细说明此错误消息吗?

gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
-L/usr/local/opt/openssl/lib Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/parsetok.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/pgenmain.o -ldl -framework CoreFoundation -o Parser/pgen
Undefined symbols for architecture x86_64:
"__PyMem_DebugFree", referenced from:
_PyTokenizer_Free in tokenizer_pgen.o
_tok_nextc in tokenizer_pgen.o
"__PyMem_DebugMalloc", referenced from:
_tok_new in tokenizer_pgen.o
_PyTokenizer_FromFile in tokenizer_pgen.o
_new_string in tokenizer_pgen.o
_tok_nextc in tokenizer_pgen.o
_PyOS_Readline in pgenmain.o
"__PyMem_DebugRealloc", referenced from:
_tok_nextc in tokenizer_pgen.o
_PyOS_Readline in pgenmain.o
"__PyObject_DebugFree", referenced from:
_getgrammar in pgenmain.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Parser/pgen] Error 1

我的 xcode 已安装并且是最新的。

$ xcode-select --install

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

最佳答案

我执行了 make distclean,然后使用此标志运行 make。

LD_RUN_PATH=/usr/local/lib make

它强制编译器查看 /usr/local/lib 并帮助我构建共享库。

关于c - 无法在Mac上编译C应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42238814/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com