加载共享库时出错:foo.so:无法打开共享对象文件:没有这样的文件或目录

时间:2018-03-13 08:48:00

标签: c++ gcc arm debian raspberry-pi3

我已经为raspberry pi交叉编译了c ++代码。

以下是我遵循的流程

1)从raspberry pi github克隆官方工具链(URL:https://github.com/raspberrypi/tools) 设置arm-linux-gnueabihf-c ++的环境变量(在.bashrc文件中)

3)键入此命令以生成ARM体系结构的二进制文件

WARNING in ./node_modules/angular-select2-component/index.ts
[1, 41]: file should end with a newline

 @ ./src/main/webapp/app/home/home.module.ts 13:34-70
 @ ./src/main/webapp/app/app.module.ts
 @ ./src/main/webapp/app/app.main.ts

WARNING in ./node_modules/angular-select2-component/src/select2.component.ts
[22, 24]: Type boolean trivially inferred from a boolean literal, remove type annotation
[43, 22]: missing whitespace
[44, 40]: missing whitespace
[46, 14]: missing whitespace
[54, 45]: missing whitespace
[67, 14]: missing whitespace
[61, 32]: missing whitespace
[79, 18]: missing whitespace
[59, 51]: " should be '
[54, 33]: == should be ===
[35, 45]: missing whitespace
[44, 11]: missing whitespace
[54, 11]: missing whitespace
[61, 15]: missing whitespace
[30, 1]: Consecutive blank lines are forbidden
[13, 15]: The selector of the component "Select2Component" should be named kebab-case and include dash (https://angular.io/styleguide#style-05-02)

 @ ./node_modules/angular-select2-component/index.ts 6:9-43
 @ ./src/main/webapp/app/home/home.module.ts
 @ ./src/main/webapp/app/app.module.ts
 @ ./src/main/webapp/app/app.main.ts

WARNING in ./node_modules/angular-select2-component/src/custom-input.ts
[59, 2]: file should end with a newline
[20, 47]: missing whitespace

 @ ./node_modules/angular-select2-component/src/select2.component.ts 25:21-46
 @ ./node_modules/angular-select2-component/index.ts
 @ ./src/main/webapp/app/home/home.module.ts
 @ ./src/main/webapp/app/app.module.ts
 @ ./src/main/webapp/app/app.main.ts

4)现在已成功生成二进制文件。我尝试使用以下命令运行二进制文件,但没有运气。

arm-linux-gnueabihf-g++ ./test.cpp -L. -lfoo -o test

即使我在.bashrc文件中设置环境变量但没有运气

分别给出以下错误

LD_PRELOAD=/home/pi/Downloads/linux-sdk-demo-arm/foo.so ./test
LD_LIBRARY_PATH=/home/pi/Downloads/linux-sdk-demo-arm ./test

ERROR: ld.so: object './foo.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
./test: error while loading shared libraries: foo.so: cannot open shared object file: No such file or directory

我确定foo.so文件位于正确的路径,但找不到它。这是目录结构,

 ./test: error while loading shared libraries: foo.so: cannot open shared object file: No such file or directory

0 个答案:

没有答案