gpt4 book ai didi

Where is the standard 'C' shared library on MacOS-11 or higher?(MacOS-11或更高版本上的标准“C”共享库在哪里?)

转载 作者:bug小助手 更新时间:2023-10-22 15:47:05 34 4
gpt4 key购买 nike



Hi I'm trying to create a shared library on MacOS-11.x.x but I get the following errors related to standard C library symbols missing:

嗨,我正试图在MacOS-11.x.x上创建一个共享库,但我遇到了以下与标准C库符号丢失有关的错误:


(venv) ELSPHIM-223046:pyembed wolf2$ ./linkit
ld: warning: object file (pyembed.o) was built for newer macOS version (11.0) than being linked (10.4)
ld: warning: dylib (/Users/Shared/venv/lib/libpython3.11.dylib) was built for newer macOS version (11.7) than being linked (10.4)
Undefined symbols for architecture x86_64:
"___stderrp", referenced from:
_main in pyembed.o
"_atoi", referenced from:
_main in pyembed.o
"_fprintf", referenced from:
_main in pyembed.o
"_printf", referenced from:
_main in pyembed.o
ld: symbol(s) not found for architecture x86_64
fatal error: /Library/Developer/CommandLineTools/usr/bin/libtool: internal link edit command failed

I tried:

我尝试过:


libtool -dynamic pyembed.o  /Users/Shared/venv/lib/libpython3.11.dylib -o dddd.dylib -current_version 1.0 -compatibility_version 1.0

As you can see, I'm trying to build another shared library to invoke an embedded Python function, which works when linked as an application. I think that detail is unimportant since the only undefined symbols are from libc.

正如您所看到的,我正在尝试构建另一个共享库来调用嵌入式Python函数,该函数在作为应用程序链接时可以工作。我认为细节并不重要,因为唯一未定义的符号来自libc。


So now I try to find libc by: otool -L /bin/ls - that reports:

所以现在我尝试通过:otool-L/bin/ls找到libc,它报告:


$ otool -L /bin/ls
/bin/ls:
/usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.120.1)

But then I do:

但后来我做到了:


$ ls -l /usr/lib/libSystem*
ls: /usr/lib/libSystem*: No such file or directory

So how does /bin/ls even work? Where is libc (either .a or .dylib) on MacOS?

那么/bin/ls是如何工作的呢?MacOS上的libc(.a或.dlib)在哪里?


I already included that information in my post.

我已经在帖子中包含了这些信息。


更多回答

Have a look at stackoverflow.com/questions/70549365/… and the link in the answer

看看stackoverflow.com/questions/70549365/…和答案中的链接

优秀答案推荐
更多回答

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