compile perl script using par::packer and run it on different linux versions - perl

I have a Perl script which I tried to use PAR::Packer in order to make it a standalone executable so it runs without having Perl on the target machine (because of security reasons).
I used WSL on Windows to pack the Perl script, but the problem I have when I run it on the target machine is the error: "version `GLIBC_2.29' not found".
I ran the command ldd --version and the version on the target machine is 2.17.
The problem I am facing is I cannot install anything on the target machine so I cannot install Perl + PAR::Packer to compile the script and then distribute it to the other machines that are gonna use the script (it's gonna be used in an image so lots of machines).
I cannot seem to find a solution or alternative for this, would love any help from the community.
Edit:
the ubuntu on my WSL was ubuntu 22, the target machines runs redhat and not debian variant, IDK which version as they are a custom linux made by the company i work in.
why am i stuck?
the main problem is that PAR::Packer isn't working on old ubuntu builds ( before 14) and at ubuntu 14 the glibc is already 2.22 while on version 12 its 2.15 so I need to compile the script on old ubuntu (version 12) but the compiling program (PAR::Packer) only works on ubuntu 14 and above so I am stuck in a loop and would apprentice any help or even alternatives for this problem.
Thanks!

Edit: the ubuntu on my WSL was ubuntu 22, the target machines runs redhat
Your problem is that you are trying to build on newer Linux machine, and run the resulting binary on older Linux. That doesn't work (without additional effort).
The simplest solution is to build on the oldest Linux distribution you need to support, possibly in a docker container.
Some other solutions are listed here.

Related

How to compile something using arm-none-eabi-gcc on windows

I am trying to build a project for a raspberry pi 4, using windows 10 as the building platform, I have the compiler installed, arm-none-eabi-gcc however every piece of information I've learned about it relates to how to run it on a linux machine, and I don't really want to run a vm just to load the linux environment, so how do I run the compiler on windows 10, Do I run it from Cmd? or is there a different method to do this?
You could check this PreBuilt GNU Toolchain for building natively on Win10.
Otherwise you could also setup a WSL environment in your win10, then you would also be able use any linux toolchains.
You can download the IDE DS-5 Community Edition
https://developer.arm.com/tools-and-software/embedded/legacy-tools/ds-5-development-studio/editions/community-edition
You can download the toolchains:
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
Then follow the steps in this tutorial:
https://developer.arm.com/tools-and-software/embedded/legacy-tools/ds-5-development-studio/resources/tutorials/getting-started-with-ds-5-ce-and-armv8-foundation-platform
https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/running-bare-metal-software-on-the-raspberry-pi-3-using-arm-ds-5
You should have the arm-none-eabi-gcc.exe for Windows Compile.
Also, you have the linux environment like MinGW and use installed terminal(xterm).
then, you have to copy the .so files into MinGW /lib or /usr/lib folder under C:/MinGW.
Hope this would be helpful for you.

buildroot new fs can't install grub2

I'm traing to use buildroot and compile new embedded system for testing.
Everything looks ok I use last kernel 4.9.16 and buildroot is from 02.2017. After compiling I can't install grub2 there's now grub software on new root file system and second there's now bash in /bin and anywhere? There's only ash shell.
It's weird because the same procedure I made on mint 17 couple days ago and it works like a charm. I changed disk in my laptop and now I'm using fresh manjaro. I don't think this could be a problem because when I compile new system I can't chose bash in menu but I chose grub2 as bootloader.
Regarding bash: Buildroot by default only installs Busybox, which provides a more minimalistic shell called ash, which is sufficient for most purposes. If you really need bash, you can also get it by enabling it in the Buildroot menuconfig.
Regarding grub2, please have a look at the help text of the Grub2 option in Buildroot, it explains how to install it.

Installing Canopy in OSX and Linux in same home directory

I have a networked home directory, which is used by linux and OSX machines. I want to install the linux and OSX versions of Canopy so that I can use it from any machine.
I first installed the linux version by running the '.sh' file. Despite asking where I wanted to put Canopy, the installer puts most of the stuff in ~/Library/Enthought/Canopy_64bit/. This is a problem because later, when I try to install Canopy in OSX, it just assumes again that Canopy is in ~/Library/Enthought so somethings will be overwritten but other binaries will be kept untouched, and the whole thing doesn't work in OSX or Linux.
Is there a way to force the linux version to be installed somewhere else? From the documentation it seems that it used to be ~/Enthought, but it doesn't work for me.
I suspect the problem is with having your locations.cfg file in ~/.canopy which is shared by both the versions of Canopy. Can you try the following:
Install the Linux version of Canopy and run it.
Remove your ~/.canopy/locations.cfg
Install your OSX version, and see if that works?
When you go back to running your Linux version, it'll again prompt you for install locations for the user environment, where you could select the old Linux install location.
Even if this works, I'm not sure, this would be too convenient. Let me know, how it goes. :)

Is it possible to create a 32bit standalone executable on a 64bit machine?

I'm creating a standalone executable from MATLAB .m file using mcc.
My machine is a 64bit machine and the target machine is 32bit machine, is it possible to create such an application (and to be able to run it on the target machine of course)?
Probably the simplest way to do this is to install the 32 bit version of MATLAB and use the mcc from that installation.
Don't worry about the warnings that you get about installing 32 bit MATLAB on 64 bit Windows. It works just fine. I have lots of different versions of MATLAB installed on my machine for development purposes, both 32 and 64 bit, all happily co-existing side by side.
The documentation also mentions a -win32 option that can be passed to mcc:
-win32 Run in 32-Bit Mode
Use this option to build a 32-bit application on a 64-bit system only
when the following are both true:
You use the same MATLAB installation root (matlabroot) for both 32-bit and 64-bit versions of MATLAB.
You are running from a Windows command line (not a MATLAB command line).
Since you have to install 32 bit MATLAB, no matter what, it seems to me that it's just easier to run the 32 bit mcc directly.

Compile GTK+ with Cygwin

I have created an application in linux with GTK2 as GUI. It uses some linux-specific headers (e.g. arpa/inet.h) so to run under Windows I have to compile it with Cygwin. I downloaded the latest installer and choose to install GTK2 and its dependencies. My program compiled fine. But it needs X server to be running! I has old-style, ugly graphics and it doesn't open in a different window, like all Windows' applications do, but inside X server's window. Because of this it can't be portable. I found that guide, which is exactly what I need, but I get an error when I run "make" for GTK2 (undefined reference for _IID_IFilePersist, although I have uuid installed - also tried it with gtk2.20). Can you suggest what to do to build my application with cygwin? Or what do I need to install for the "_IID_IFilePersist" error? Thanks in advance!
There's prebuilt packages for windows that doesn't rely on X. http://gtk-win.sourceforge.net/home/index.php/Downloads
If you don't want X server to be running, then you're going to have to port the linux-specific parts of your code and compile with MinGW rather than Cygwin.