Can't run executable built with Dub - OS thinks it is shared library

Paul Backus snarwin at gmail.com
Wed Oct 27 22:09:26 UTC 2021


On Wednesday, 27 October 2021 at 19:48:14 UTC, Stephen C wrote:
> On Wednesday, 27 October 2021 at 19:16:29 UTC, Paul Backus 
> wrote:
>> Which Linux distribution are you using, and which file 
>> browser/desktop environment are you using when you attempt to 
>> run the program by clicking on it?
>
> Linux Mint 20.2 with XFCE4 and Thunar file manager.
> I think you're right - it seems to be a problem with Thunar 
> (and possibly other file managers in Linux).

I have the same issue on Debian with PCManFM. A bit of searching 
turns up this bug report for the `shared-mime-info` database, 
which seems to be the root of the problem:

https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/11

> I assume this also happens with the "-PIC" flag. But is there 
> any way to run DMD without the -fPIC flag (set in dmd.conf)? I 
> tried to remove it, but then it won't compile at all.

[Since Debian 9][1], pretty much all Debian-based distros have 
their C toolchain set up to produce position-independent 
executables by default. So you will probably need to have DMD 
pass `-no-pie` when it invokes GCC to link the executable (or do 
a separate link step and pass it yourself).

[1]: 
https://www.debian.org/releases/stretch/i386/release-notes/ch-information.en.html#pie-is-now-default


More information about the Digitalmars-d mailing list