Page 1 of 1
Executable Format:Linux makes shared library
Posted: Mon Sep 16, 2024 10:47 pm
by kaleid
I am using PureBasic 5.50 on Linux 18.04. Worked fine on 14.04. Now with the Executable Format set to Linux I get a shared library from Create Executable. Don't know how to make that an executable instead.
Re: Executable Format:Linux makes shared library
Posted: Tue Sep 17, 2024 8:31 am
by Fred
What about trying with PB 6.12 ?
Re: Executable Format:Linux makes shared library
Posted: Tue Sep 17, 2024 7:43 pm
by kaleid
Thanks for your reply, Fred. I had tried v6.11 and it would not run at all. Same with v6.12. All the install libraries are the newest version. The setup I have created for v6.12 is exactly the same as for v5.50 apart from the version numbers. v5.50 runs and compiles fine but the problem is Create Executable creates a shared library - probably a DLL - and not an executable program. Info in the INSTALL file cryptically suggests there might be a problem with 18.04. I don't know what is being suggested. I would be happy to stick with v5.50 if it worked.
Info: Required Webkit not available on Ubuntu bigger version 18.04. Support of Webkit2gtk with Purebasic v6.00 (Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04 with gtk3)
Re: Executable Format:Linux makes shared library
Posted: Tue Sep 17, 2024 8:26 pm
by DarkDragon
There is no Linux 18.04 or 14.04.
Please open a terminal, cd to the executable/shared object and write
Post the output here, please. Then try:
Code: Select all
chmod +x your_executable_filename
./your_executable_filename
There have been problems in the past with Ubuntu and default PIC/PIE compiler settings in gcc. This made the GUI file browsers sometimes think executables are libraries or something like that .. it has been a long time since I used Ubuntu.
Re: Executable Format:Linux makes shared library
Posted: Tue Sep 17, 2024 9:19 pm
by Quin
DarkDragon wrote: Tue Sep 17, 2024 8:26 pm
There is no Linux 18.04 or 14.04.
There is if you're not being pedantic, Ubuntu does have an 18.04 version, and PB officially supports it.
Re: Executable Format:Linux makes shared library
Posted: Tue Sep 17, 2024 11:19 pm
by kaleid
Happy days, DD! That worked. Thanks a lot|
Ubuntu has been very good for me. What do you use now? Don't say Windows!
Tom
Re: Executable Format:Linux makes shared library
Posted: Tue Sep 17, 2024 11:40 pm
by kaleid
For completeness and because DarkDragon requested it here is the output from
file executable_filename
executable_filename: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=6d2303d8b0fba7aa7fe6572b7ac8cb614033e031, stripped
Certainly seems to have been a Ubuntu, g++ clash
Re: Executable Format:Linux makes shared library
Posted: Wed Sep 18, 2024 12:23 am
by kaleid
chmod -x exec_filename is not required. The executable runs from the terminal anyway. But not from the Files application.
However I can run it from the GUI by creating a .desktop file for it. It's a workaround.
Disappointed v6.12 does not even start to run but v5.50 will probably be all I need.
Thanks again, DarkDragon, for pointing me in the right direction.
Re: Executable Format:Linux makes shared library
Posted: Wed Sep 18, 2024 5:50 am
by DarkDragon
kaleid wrote: Tue Sep 17, 2024 11:40 pmfile executable_filename
executable_filename: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=6d2303d8b0fba7aa7fe6572b7ac8cb614033e031, stripped
Certainly seems to have been a Ubuntu, g++ clash
I'm not entirely sure about this, I hoped at least file would be able to identify it as executable, but it doesn't seem to do so. Did you compile it as 32bit executable? Maybe that's a hint, too. Did you try the same as 64bit?
Re: Executable Format:Linux makes shared library
Posted: Thu Sep 19, 2024 1:03 am
by kaleid
DD, the PureBasic software is x86. I did copy the source from a 64bit m/c. But I get the same problem with source that was always in a 32bit m/c.
Wonder if I need a linker options file.
Tom
Re: Executable Format:Linux makes shared library
Posted: Sat Sep 21, 2024 2:00 am
by kaleid
Pretty sure now the problem is that position-independent executables (PIE) has been enabled for gcc in Ubuntu 18.04. Solution is to provide the -no-pie option for the gcc compiler. But I have no idea how that can be done when using PureBasic. The problem is not confined to executables created by PureBasic. The result is that some executables cannot be run by Files which sees them as shared library files. The executables can be run from the terminal or via a .desktop file.
Any easy fix? DarkDragon?
Tom
Re: Executable Format:Linux makes shared library
Posted: Sat Sep 21, 2024 9:00 am
by deeproot
I don't think this is needed for newer versions, but I have sources that were compiled with many older versions of PB and various OS releases, I simply have the following as the first line of the main source file:
From a tip posted here on the forum some years ago!
Re: Executable Format:Linux makes shared library
Posted: Sat Sep 21, 2024 7:26 pm
by kaleid
Thanks very much, deeproot! That fixed it. And such a simple fix!
Tom