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

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

问题描述

可以使用 cmake gcc 32位中编译项目>在 64位系统上?

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

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

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