如何用gcc / cmake的编译一个32位二进制64位Linux机器上如何用、机器上、gcc、cmake

2023-09-07 17:30:22 作者:温暖的阳光

是否有可能在64位系统上编译32位与cmake并GCC项目?它可能是,但我怎么办呢?

当我尝试它的无知的方式,无需设置任何参数/标志/等,只设置LD_LIBRARY_PATH找到在〜/工具链接库/ lib下似乎忽略它,只能看在名为lib64的子目录。

解决方案

 导出CFLAGS = -m32
 

vscode搭建C C 环境以及使用gcc g cmake编译总结

Is it possible to compile a project in 32-bit with cmake and gcc on a 64-bit system? It probably is, but how do I do it?

When I tried it the "ignorant" way, without setting any parameters/flags/etc, just setting LD_LIBRARY_PATH to find the linked libraries in ~/tools/lib it seems to ignore it and only look in subdirectories named lib64.

解决方案

export CFLAGS=-m32