本文介绍了静态链接 glibc,但使用 GCC 动态链接其他一些库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将 glibc 静态链接到我的项目,因为目标平台只支持一个非常旧的平台(但它适用于我的工具链中的静态链接 glibc,我已经检查过了)

I need to statically link glibc to my project, because the target platform supports only a very old one ( but it works with statically linked glibc from my toolchain, I have checked it)

不幸的是,这个应用程序必须使用 pthread 库,但是静态链接的 libpthread 占用了太多空间.

Unfortunately, this application has to make use of pthread library, but statically linked libpthread takes too much space.

我想静态链接glibc,动态pthread.

I would like to statically link glibc, and dynamically pthread.

运行此命令后

powerpc-unknown-linux-gnu-gcc object_files -lrt -lpthread -Wl,-Bstatic -lc

我明白了:

/powerpc-unknown-linux-gnu/bin/ld: cannot find -lgcc_s

推荐答案

有一个 -static-libgcc 如果有帮助的话

There is a -static-libgcc if that may help

这篇关于静态链接 glibc,但使用 GCC 动态链接其他一些库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 17:31