程序是Xenomai测试套件的一部分,从Linux PC交叉编译到Linux+Xenomai ARM工具链。

# echo $LD_LIBRARY_PATH                                                                                                                                          
/lib                                                                                                                                                             
# ls /lib                                                                                                                                                        
ld-2.3.3.so         libdl-2.3.3.so      libpthread-0.10.so                                                                                                       
ld-linux.so.2       libdl.so.2          libpthread.so.0                                                                                                          
libc-2.3.3.so       libgcc_s.so         libpthread_rt.so                                                                                                         
libc.so.6           libgcc_s.so.1       libstdc++.so.6                                                                                                           
libcrypt-2.3.3.so   libm-2.3.3.so       libstdc++.so.6.0.9                                                                                                       
libcrypt.so.1       libm.so.6                                                                                                                                    
# ./clocktest                                                                                                                                                    
./clocktest: error while loading shared libraries: libpthread_rt.so.1: cannot open shared object file: No such file or directory                                 

.1是文件名的最后部分吗?这到底是什么意思?


当前回答

你可以在这里阅读有关图书馆的内容: https://domiyanyue.medium.com/c-development-tutorial-4-static-and-dynamic-libraries-7b537656163e

其他回答

我要做的就是跑

sudo apt-get install libfontconfig1

我在位于/usr/lib/x86_64-linux-gnu的文件夹中,它工作得很好。

我使用Ubuntu 18.04

安装相应的-dev包对我来说很有效,

sudo apt install libgconf2-dev

在安装上面的包之前,我得到了以下错误:

turtl: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

尝试安装lib32z1:

Sudo apt-get lib32z1

您的库是一个动态库。 您需要告诉操作系统在运行时可以在哪里定位它。

为了做到这一点, 我们需要做这些简单的步骤:

Find where the library is placed if you don't know it. sudo find / -name the_name_of_the_file.so Check for the existence of the dynamic library path environment variable(LD_LIBRARY_PATH) echo $LD_LIBRARY_PATH If there is nothing to be displayed, add a default path value (or not if you wish to) LD_LIBRARY_PATH=/usr/local/lib We add the desired path, export it and try the application. Note that the path should be the directory where the path.so.something is. So if path.so.something is in /my_library/path.so.something, it should be: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my_library/ export LD_LIBRARY_PATH ./my_app

引用来源

如果在Microsoft Windows上运行应用程序,则需要在path环境变量中定义动态库(.dll)的路径。

如果在UNIX上运行应用程序,则需要在LD_LIBRARY_PATH环境变量中定义动态库(.so)的路径。