我运行PHP脚本并得到此错误:
PHP警告:PHP启动:无法加载动态库'/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions /no-debug-non-zts-20090626/ixed.5.2.lin:无法打开共享对象文件:第0行的"未知"中没有此类文件或目录
那是什么意思?
在Xcode 6.0.1中使用嵌入式框架(dyld)时,部署目标小于iOS 8,我得到:
错误:
dyld: Library not loaded: @rpath/ObjectiveLyricsTouch2.framework/ObjectiveLyricsTouch2
Referenced from: /private/var/mobile/Containers/Bundle/Application/DC65ACA9-98E5-46CD-95F8-829D3416F6C0/musiXmatch.app/musiXmatch
Reason: image not found
(lldb)
Run Code Online (Sandbox Code Playgroud) 我正在尝试为iOS应用程序制作动态框架.感谢新版本的Xcode(6),我们可以在创建新项目时选择Cocoa Touch Framework,不再需要添加聚合目标,运行脚本等等.构建框架时我没有问题.但是当我尝试在iOS应用程序中使用它时,我遇到了一些架构问题.
ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (arm64): /Library/Frameworks/MyFramework.framework/MyFramework
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_MyFrameworkWebService", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (armv7): /Library/Frameworks/MyFramework.framework/MyFramework
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MyFrameworkWebService", referenced …Run Code Online (Sandbox Code Playgroud) 我想控制在CMake中找到/链接我的二进制文件的库的类型.最终目标是,"尽可能静态地"生成二进制文件,以便静态链接每个具有可用静态版本的库.这很重要,因为在测试期间可以在不同系统中实现二进制文件的可移植性.
ATM这似乎很难实现,因为FindXXX.cmake软件包,或者更确切地说,只要静态和动态都可用,find_library命令总是会获取动态库.
有关如何实现此功能的提示 - 最好以优雅的方式 - 非常受欢迎!
linker cmake shared-libraries static-linking dynamic-library
我有一个共享库,由我无法控制的另一个应用程序使用,需要*.so对象.我的库使用sqlite3,它需要与它静态链接(我绝对需要一个自包含的二进制文件).
当我尝试编译和链接我的库时:
-fpic -flto -pthread -m64
-flto -static -shared
Run Code Online (Sandbox Code Playgroud)
我最终得到以下错误:
/usr/bin/ld: /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.1/crtbeginT.o: relocation R_X86_64_32 against `__DTOR_END__' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.1/crtbeginT.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
什么是与-fPIC相关的重新编译?我的代码还是CRT?
我已经尝试用-fPIC编译我的对象,结果相同.
谢谢.
编辑:
这个问题似乎与SQLite3无关.
我写了一个简单的单行无用库,它编译和链接如下:
g++ -c -fPIC -o bar.o bar.cpp
g++ -shared -o bar.so bar.o
Run Code Online (Sandbox Code Playgroud)
但不是这样的:
g++ -c -fPIC -o bar.o bar.cpp
g++ -static -shared -o bar.so bar.o
Run Code Online (Sandbox Code Playgroud)
问题似乎与CRT(crtbeginT.o)有关.我应该重新编译GCC - 用pic还是其他什么?
我正在尝试正常导入 TensorFlow python 包,但出现以下错误:
这是上面终端图像中的文本:
2020-02-23 19:01:06.163940: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory
2020-02-23 19:01:06.164019: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory
2020-02-23 19:01:06.164030: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
<module …Run Code Online (Sandbox Code Playgroud) 我最近在GNU ld中发现了链接器选项"-Bsymbolic-functions":
-Bsymbolic
When creating a shared library, bind references to global symbols to the
definition within the shared library, if any. Normally, it is possible
for a program linked against a shared library to override the definition
within the shared library.
This option is only meaningful on ELF platforms which support shared libraries.
-Bsymbolic-functions
When creating a shared library, bind references to global function symbols
to the definition within the shared library, if any.
This option is only meaningful …Run Code Online (Sandbox Code Playgroud) 我想使用函数'dlopen()'在iOS平台上调用动态库,是函数'dlopen()'私有API?
XCode中的静态库和动态库有什么区别?为什么Apple不允许我们在iOS应用程序中使用动态库?
如果您试图了解动态链接,这个问题很可能会引起关注.
该问题的答案之一提供了创建和使用动态库的一个很好的例子.基于它,我有一些简单的文件:
main.c中:
extern void someFunction (int x);
int main (int argc, char** argv ) {
someFunction(666);
}
Run Code Online (Sandbox Code Playgroud)
mylibrary.c:
#include <stdio.h>
void someFunction (int x) {
printf ("\nsomeFunction called with x=%d\n", x);
}
Run Code Online (Sandbox Code Playgroud)
生成文件:
main: mylibrary.c main.c
gcc -c mylibrary.c
gcc -dynamiclib -current_version 1.0 mylibrary.o -o libmylibrary.dylib
gcc -c main.c
gcc -v main.o ./libmylibrary.dylib -o main
clean:
rm *.o
rm main
rm *.dylib
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切都很好.如果我创建然后在命令提示符下输入./main,我会看到预期的输出:
someFunction called with x=666
Run Code Online (Sandbox Code Playgroud)
现在,我想把事情搞混一些.我创建了一个目录hidelib,它是我主目录的子目录.我在makefile中添加了一行:
main: mylibrary.c main.c
gcc -c mylibrary.c
gcc -dynamiclib -current_version …Run Code Online (Sandbox Code Playgroud)