Force Perl to work in 32-bit mode

自闭症网瘾萝莉.ら 提交于 2019-12-11 00:32:45

问题


We have an old Perl application. Recently we moved to a new server which runs 64-bit Ubuntu. Old application uses pack/unpack functions and bitwise operations and now it fails because bitwise operations return 64-bit integers instead of 32-bit.

Is there a way to force perl into 32-bit mode? If not, is there a way to install 32-bit perl on 64-bit machine?

Thanks!


回答1:


Is there a way to force perl into 32-bit mode?

No, but you could switch to using the correct (portable) pack/unpack patterns and using & 0xFFFFFFFF where appropriate when bit twiddling.

If not, is there a way to install 32-bit perl on 64-bit machine?

From INSTALL:

Natively 64-bit systems need neither -Duse64bitint nor -Duse64bitall. On these systems, it might be the default compilation mode, and there is currently no guarantee that passing no use64bitall option to the Configure process will build a 32bit perl. Implementing -Duse32bit* options is planned for a future release of perl.

So the answer is: maybe, but probably not.




回答2:


It appears that you can install 32-bit packages by suffixing the package name with :i386. At least this worked for me when installing a library.

$ sudo apt-get install libelf1:i386

I don't know if this works with non-libraries, as there would likely be filename and path conflicts. With libraries, 32-bit and 64-bit libraries are packaged to fall into separate directories.



来源:https://stackoverflow.com/questions/6931307/force-perl-to-work-in-32-bit-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!