Linux executable

77 views
Skip to first unread message

vasi vasi

unread,
May 22, 2024, 7:38:20 AM5/22/24
to jal...@googlegroups.com
Hi Rob,

I see you provide executables for linux that are dynamically linked...
A statically linked executable can work on both glibc and musl based distributions (Alpine and Void linux as two main examples as musl platforms) no matter on which platform this was compiled (be it glibc or musl), and it can also work on much older linux distros. It will help also with old projects that require a specific version of jalv2 compiler. Right now, a static link edit is possible only by modifying the Makefiles at source level.

I have a lot of old applications dynamically linked that do not work on today's computers and operating systems. Is not only that many are written in an old standard, not supported by the compiler, but in many cases, even the GUI libraries are not available anymore. And jalv2 can be linked statically. Maybe you don't know, but there are "recent" changes in GLIBC that will prevent shared programs to work on linux distributions that have GLIBC at a lower version than 2.34 (don't know if is the case of the jalv2 compiler though).  

I think is in Jalv2 interest to avoid this vulnerability of Linux/UNIX world.

--
Vasi

Rob CJ

unread,
May 22, 2024, 1:01:40 PM5/22/24
to jal...@googlegroups.com
Hi Vasi,

I had problems with GLIBC version 2.29. In order to solve that I recompiled the JAL compiler with an older version of gcc and that solved that issue. 

I can have a look a linking it statically. Are you - or other JAL users - experiencing problems with the current version (2.5r8) of the JAL compiler?

Kind regards,

Rob


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens vasi vasi <fun...@gmail.com>
Verzonden: woensdag 22 mei 2024 13:38
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: [jallib] Linux executable
 
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CABsDq%3D9%3D%3DPqrr7ffPaVDg3qSYTiwQKKhbroLpWucDDNjb9XrVA%40mail.gmail.com.

vasi vasi

unread,
May 22, 2024, 1:43:23 PM5/22/24
to jal...@googlegroups.com
Hi Rob,

No problems for me because I recompiled it to be statically linked.



--
Vasi

Rob CJ

unread,
May 23, 2024, 1:32:33 PM5/23/24
to jal...@googlegroups.com
Hi Vasi,

I am no Linux expert (always using Windows) and I had a quick look on the internet and I read that you are not allowed to statically link GLIBC due to licensing.

I saw some info about musl but no clue (yet) what to do.

Any hints would help.

Thanks.

Kind regards,

Rob



Verzonden: woensdag 22 mei 2024 19:43
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: Re: [jallib] Linux executable
 

Rob CJ

unread,
May 23, 2024, 3:51:55 PM5/23/24
to jal...@googlegroups.com
Hi Vasi,

I tried this:
  • sudo apt -y install musl-tools
  • Added: -static in the Makefile.inc to the linker flag
  • Changed (as a hack): $(CC) by musl-gcc
Compiled the compiler but the size is exactly the same with and without the -static option. I would expect the file to be bigger for the static version.

Any suggestions?

Kind regards,

Rob


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Rob CJ <rob...@hotmail.com>
Verzonden: donderdag 23 mei 2024 19:32

vasi vasi

unread,
May 25, 2024, 8:34:59 PM5/25/24
to jal...@googlegroups.com
I never heard that you are not allowed to create static executables!! Any linux provide also a set of static libraries. Only certain libraries are dynamic and these days, you do not get a static version of glibc. So, don't worry, you can compile jalv2 statically, it won't include glibc. You don't need musl, I will look into it, but it is not needed.



--
Vasi

vasi vasi

unread,
May 25, 2024, 8:50:30 PM5/25/24
to jal...@googlegroups.com
Using musl-gcc, with -Werror and -fPIC removed and adding -static to LFLAGS, I get a size of 530272 bytes, statically linked and striped.  LinuxMint LMDE 6 here.

musl library is a very small library compared to glibc.
--
Vasi

vasi vasi

unread,
May 25, 2024, 9:01:02 PM5/25/24
to jal...@googlegroups.com
this is the Makefile.inc I used
--
Vasi
Makefile.inc

vasi vasi

unread,
May 25, 2024, 9:13:57 PM5/25/24
to jal...@googlegroups.com
You can check with the following command if you executable is static:
$=>  ldd jalv2-native
And you must get the following message:
not a dynamic executable

Or, you can install MIdnight Commander (it looks like Norton COmmander from MS-DOS) with
sudo apt install mc
then run it, navigate to the jalv2 executable, position the bas/cursor over it and press F3 button. After a red dialog that announces you that there are no symbols, press enter and you will get a window with details about the executable.  You get more info than using just the ldd command.
--
Vasi

Rob CJ

unread,
May 26, 2024, 4:10:31 AM5/26/24
to jal...@googlegroups.com
Hi Vasi,

Thanks for the info.

I made an error before and adding static works. The size of the compiler is then more than doubled to about 1.2 Mbyte and it still works OK.

I will do a test on another computer where I got issues with the GLIBC to see if that is gone.


So it looks that one problem might then be replaced by another problem.  Are there any other JAL users that have problems with the Linux version of jalv2?

"If it ain't broken don't fix it" 🙂

Kind regards,

Rob




Verzonden: zondag 26 mei 2024 03:13

vasi vasi

unread,
May 26, 2024, 8:52:38 AM5/26/24
to jal...@googlegroups.com
Sorry Rob,

that really is not our problem. We do not statlically ling glibc. We statically link our executable that do NOT use any shared lib, so it does not need a dynamic loader. Is that simple. Statically linking you app (where is possible) gives you the freedom to run on ANY Linux distribution, old or new. Again, nothing to do with glibc. And also, musl has absolutely nothing to do with glibc.  Compiling it dynamically, it means it will... but I already explained you why you don't need to create such vulnerability in Linux.



--
Vasi

vasi vasi

unread,
May 26, 2024, 9:07:25 AM5/26/24
to jal...@googlegroups.com
This discussion or a similar subject was here some time ago... the compiler becomes an educational tool, when you write books about it, with examples and specific libraries and that book must remain relevant in time, with a compiler and projects still usable. As is possible in WIndows. In Linux, you get this with a statically linked compiler. This compiler does not use or need a dynamic loader. Ask Kyle if you don't get it.
--
Vasi

Rob CJ

unread,
May 27, 2024, 1:25:30 PM5/27/24
to jal...@googlegroups.com
Hi Vasi,

I did the following test:
-) Build the compiler without the static on my Ubuntu laptop on which I got the GLIBC problem.
-) Ran that compiler on my Laptop running Virtual Box and Linux Mint. Got the GLIBC error
-) Build the compiler with the static on my Ubuntu laptop on which I got the GLIBC problem.
-) Ran that compiler on my Laptop running Virtual Box and Linux Mint. Did not get the GLIBC error

Screenshot of both runs on my Linux Mint version:


So that seems to work nicely. 

One question though. Somebody suggested me to have a look at the Appimage format:

I did not look into that yet, but is that also an option?

Kind regards,

Rob






Verzonden: zondag 26 mei 2024 15:07

vasi vasi

unread,
May 27, 2024, 5:47:49 PM5/27/24
to jal...@googlegroups.com
Many say that AppImage can be the solution on the long term.. I personally can't make it work... But I use some applications that come in AppImage format.... I think this is a way to provide dynamically compiled apps to any Linux, but you have to package all teh required libraries. If you forget one, it won't work. It will be the only working solution for a dynamic app that uses dynamic libraries like Qt... but jalv2 does not use such libraries and is easier to compile it statically. But of course, you can try AppImage and decide if is worth the effort.



--
Vasi

Rob CJ

unread,
May 30, 2024, 3:32:17 PM5/30/24
to jal...@googlegroups.com
Hi Vasi,

I uploaded the static version. I did some checking of older version of the JAL compiler and I saw it was a static version before.

Not sure why the original Makefile did not have this option.

Anyway it will be in the next bee-package. Compiler version is still the same btw.

Kind regards,

Rob


Verzonden: maandag 27 mei 2024 23:47

vasi vasi

unread,
Jun 22, 2024, 11:40:51 PM6/22/24
to jal...@googlegroups.com
Thank you very much Rob, I appreciate it!



--
Vasi
Reply all
Reply to author
Forward
0 new messages