简体   繁体   English

Beagle骨交叉编译动态链接混乱

[英]Beagle bone cross compilation dynamic linking confusion

i'm not on here asking to solve a bug or problem , but just to get an understanding about something from those who have more experience. 我不是在这里要求解决错误或问题,而只是想从有更多经验的人那里了解一些事情。

I bought a BeagleBone Black (Debian installed). 我买了BeagleBone Black(已安装Debian)。 I am cross compiling C++ for it on Windows by using gcc-linaro and the make utility that comes with yagarto tools. 我正在使用gcc-linaro和yagarto工具随附的make实用程序在Windows上交叉编译C ++。

All works and executes fine when developing C code with the C compiler. 使用C编译器开发C代码时,所有工作均正常执行。

With C++ however when I build an executable and transfer it to the bone (via WinSCP), I get the following linker error on execution : 但是,使用C ++生成可执行文件并将其传输到骨骼(通过WinSCP)时,执行时出现以下链接器错误:

"./leds1: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./leds1)" “ ./leds1:/usr/lib/arm-linux-gnueabihf/libstdc++.so.6:找不到版本“ GLIBCXX_3.4.21”(./ leds1要求)”

I'm not asking to solve that issue exactly. 我不是要完全解决这个问题。

Does it mean that when building on the host, the library path defined on the host is different to that on the bone? 这是否意味着在主机上构建时,主机上定义的库路径与骨骼上定义的库路径不同?

If however I add "-static" to my linker command in my makefile to statically link libraries at compile time on the host, the code then executes on the bone, but not sure if this is the cause of some other issue i'm having. 但是,如果我在makefile中的链接器命令中添加“ -static”以在主机上进行编译时静态链接库,则代码将在骨骼上执行,但不确定这是否是我遇到的其他问题的原因。

Is it ok to statically link the libraries in this case? 在这种情况下可以静态链接库吗? I'm wondering then could the library code which is statically linked be different to the code it would link to on the bone in the case of dynamic linking? 我想知道静态链接的库代码是否与动态链接情况下链接到骨骼的代码不同?

When I do static linking, does it mean there will be no more unresolved linkages whatsoever (every function is implemented) when the executable is built? 当我执行静态链接时,这是否意味着在构建可执行文件时,将不再存在任何未解决的链接(实现了每个功能)? The linux system() function that I am calling for example is completely built into my executable then? 例如,我正在调用的linux system()函数完全内置于我的可执行文件中了吗?

Many questions sorry, but all relating to the same misunderstanding. 许多问题对不起,但所有问题都与相同的误解有关。 Thanks in advance for your knowledge. 预先感谢您的知识。

What that error means is simply that a dynamic libstdc++.so.6 was not found on the device. 该错误仅表示在设备上找不到动态libstdc ++。so.6。 Whether such a library is actually available is something I do not know. 我不知道这样的库是否实际可用。

It may well be that static linking is the only configuration that will work for libstdc++. 很有可能静态链接是唯一适用于libstdc ++的配置。 I know it's possible to static link some libraries and dynamically link others but I don't know either gcc or clang well enough to tell you what options would do that. 我知道可以静态链接某些库,而动态链接其他库,但是我不知道gcc或clang是否足以告诉您什么选项可以做到这一点。

If you static link and there are no unresolved symbols then yes, your binary is complete. 如果您是静态链接,并且没有未解析的符号,那么可以,您的二进制文件已完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM