简体   繁体   English

在ubuntu上构建32位应用程序并使用64位lib运行它

[英]Building 32 bit app on ubuntu and running it using a 64 bit lib

I need to build a 32 bit version of my program (no options to build it 64 bitly), but there is a certain lib (nvidia provided gles) that is of 64 bit. 我需要构建程序的32位版本(没有选项可以按64位构建它),但是有一个特定的lib(nvidia提供的gles)是64位的。 I wonder if there is a way to link the 32bit program against the 64 bit lib. 我想知道是否有一种方法可以将32位程序与64位库链接起来。 Or if I can simply use the 64 bit lib with it. 或者,如果我可以简单地使用64位库。 It's an nvidia tx1 with 64 bit kernel and userspace (latter used to be 32 bit but not anymore) running ubuntu 16.04 . 这是一个运行ubuntu 16.04的nvidia tx1,具有64位内核和用户空间(过去是32位,但现在不再使用)。 I'm using arm-linux-gnueabihf-g++. 我正在使用arm-linux-gnueabihf-g ++。

Thanks in advance :) 提前致谢 :)

No, that simply cannot work. 不,那根本行不通。 There are simply far too many problems for that to work. 只是有为工作太多的问题。

A 64 bit kernel can work with 32 bits programs because the kernel doesn't trust programs anyway. 64位内核可以与32位程序一起使用,因为内核始终不信任程序。 Every argument is carefully checked and marshalled, which works for a small and fixed interface. 每个参数都经过仔细检查和整理,这适用于小型固定接口。

However, a compiler has no effective way to determine the exact API of a library. 但是,编译器没有有效的方法来确定库的确切API。 Is that char* an input argument, output or both? 那个char*是输入参数,输出还是两者? You need to know, in order to do the 32/64 marshalling. 您需要知道,才能进行32/64编组。 (And I'm ignoring efficiency here) (我在这里忽略了效率)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM