COMMUNITY

Compile with no-pie for linux executables

Hello,
Currently I’m fighting with haxeflixel demos to be compiled as executables but not as files which are marked as shared library on Linux (mainly to be able to run via double click rather than terminal) I found info that it may be related to the PIE flag somwhere in hxcpp toolchain. Could someone point me how to change that? I’m totally green, thanks in advance for reading :wink:

The PIE (position independent executable) flag changes the way executable can be loaded by the OS, but that doesn’t make them executable.

What happens when you try to run the demos?

Can you share the result of doing file /path/to/the/demo/exe in a terminal.

Well I got this:
"[van@r4z0rt33th bin]$ pwd
/home/van/flixel-demos/Arcade/Breakout/export/linux/bin
[van@r4z0rt33th bin]$ ls -la
razem 35892 - means total in polish
drwxr-xr-x 2 van van 4096 11-10 17:15 .
drwxr-xr-x 5 van van 4096 11-10 17:22 …
-rwxr-xr-x 1 van van 25224432 11-10 17:15 Breakout
-rw-r–r-- 1 van van 11515644 11-10 17:04 lime.ndll
"
I also made chmod +x and check box “allow as execute” and yet still is asking me what to do with shared library files. So I pointed it to terminal.

But I want it to run without terminal in the background. And also I know I could make desktop entry but want to run it like on windows without proper preparations

What does file /home/van/flixel-demos/Arcade/Breakout/export/linux/bin/Breakout prints?

Nothing, just run demo of breakout

You forgot the start of the command file , but it seems to run fine then so it must be an executable,
from which file explorer are you launching the exe?

Thunar. I’m on manjaro xfce 18.1.2 64bit

command file prints out: van@r4z0rt33th bin]$ file /home/van/flixel-demos/Arcade/Breakout/export/linux/bin/Breakout
/home/van/flixel-demos/Arcade/Breakout/export/linux/bin/Breakout: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a1f740b876a7750a46c52ec08bc763cfd1711e6f, for GNU/Linux 3.2.0, not stripped

To confirm you are double clicking on the Breakout file and not lime.ndll?

yes, when first time I clicked os asked me to choose with what app to open it so i chose Terminal
Now it autostarts with terminal in the backgorund

You shouldn’t have had to choose an app for an executable, try removing the export folder and compiling again.

But otherwise there doesn’t seem to be anything wrong with the executable generated,
if it still doesn’t work you’ll need to clear the file association in thunar, somehow.

oki, I’m back. I just installed nautilus. coz it have option to reset association apps with certain files.Now I got message:

What does

file /home/van/flixel-demos/Arcade/Breakout/export/linux/bin/Breakout

gives you?

And please run the full command, starting with file .

got:

/home/van/flixel-demos/Arcade/Breakout/export/linux/bin/Breakout: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a5aada1077aebcdf0db8e93b7f1241e2a4dc9441, for GNU/Linux 3.2.0, not stripped

The executable is perfectly normal, there is nothing wrong with the way it is generated.

So either you launch it from the command line directly or through lime run/test, or you’ll have to get help from your file explorer’s support to know why they incorrectly detect it.

Yes, I asked on manjaro forum and everybody told me, that this weird behavior is in fact newly added feature. To secure and prevent from breaking up accidentaly linux. It all started with gnome (since dev team decided to get rid of desktop shortcuts, and after that they deleted nautilus’s ability to run files with double click in favor of appimage, flatpak and snap like style of running apps).

Even renaiming exported file to *.desktop breaks the app. I did that way in July this year and it worked, but after update it seems to be obsolete too.

For sake of not confusing new linux users (espacially when they come from M$) for having two files with same name I put final build into separate folder. Then I created desktop entry which holds execution command to that folder and build.