如何使用 gcc/cmake 在 64 位 linux 机器上编译 32 位二进制文​​件 [英] How to compile a 32-bit binary on a 64-bit linux machine with gcc/cmake

查看:31
本文介绍了如何使用 gcc/cmake 在 64 位 linux 机器上编译 32 位二进制文​​件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在64位上使用cmakegcc编译32位的项目> 系统?可能是,但我该怎么做?

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?

当我以无知"的方式尝试时,没有设置任何参数/标志/等,只需设置LD_LIBRARY_PATH即可在~/tools/lib中找到链接库它似乎忽略了它,只查看名为 lib64 的子目录.

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

这篇关于如何使用 gcc/cmake 在 64 位 linux 机器上编译 32 位二进制文​​件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆