Executable Format:Linux makes shared library

Just starting out? Need help? Post your questions and find answers here.
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Executable Format:Linux makes shared library

Post 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.
Fred
Administrator
Administrator
Posts: 18150
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Executable Format:Linux makes shared library

Post by Fred »

What about trying with PB 6.12 ?
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post 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)
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Executable Format:Linux makes shared library

Post by DarkDragon »

There is no Linux 18.04 or 14.04.

Please open a terminal, cd to the executable/shared object and write

Code: Select all

file your_executable_filename
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.
bye,
Daniel
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Executable Format:Linux makes shared library

Post 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.
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post 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
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post 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
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post 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.
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Executable Format:Linux makes shared library

Post 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?
bye,
Daniel
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post 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
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post 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
User avatar
deeproot
Enthusiast
Enthusiast
Posts: 284
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Executable Format:Linux makes shared library

Post 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:

Code: Select all

ImportC "-no-pie" : EndImport
From a tip posted here on the forum some years ago!
kaleid
New User
New User
Posts: 8
Joined: Mon Sep 16, 2024 10:38 pm

Re: Executable Format:Linux makes shared library

Post by kaleid »

Thanks very much, deeproot! That fixed it. And such a simple fix!

Tom
Post Reply