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开发者_StackOverflow社区 32-bit mode? If not, is there a way to install 32-bit perl on 64-bit machine?
Thanks!
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.
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.
精彩评论