我需要用 uClibc++ 和 musl 编译 c++ 代码。为此,首先我必须重新编译 uClibc++。但是尝试这样做时,我遇到了一些错误,例如丢失__snprintf_chk
和__cxa_thread_atexit_impl
简而言之:您如何正确地做到这一点?我很确定这与 g++ 标志有关,但是哪个?
这是我迄今为止尝试过的(对于mips):
- 我为 mips 编译了 musl
- 将 musl-gcc 传递给
CROSS_COMPILE
uClibc++ make 的参数。我还在同一路径中创建了 musl-g++(这基本上与具有相同 .spec 文件的 musl-gcc 完全相同,但使用 mips-linux-gnu-g++ 而不是 gcc)我的.spec
文件是 musl 自动生成的文件,我没摸。 这是我的编译命令:
make install CROSS_COMPILE=/path/to/my/musl/mips CPU_CFLAGS=' -lsupc++ -lgcc -nostdlib -nostdinc -nostdinc++ -mmusl -I/path/to/musl/include -Os -fno-use-cxa-atexit -fno-use-stack-protector -D_FORTIFY_SOURC=0 -L/path/to/my/musl/lib -lc
输出:
In function '__cxa_thread_atexit':
Undefiend reference to __cxa_thread_atexit_impl
In function 'd_append_chk':
Undefiend reference to __sprintf_chk