Statically compiled binary with C interop crashes.

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 18 16:01:19 UTC 2024


On Thursday, 18 April 2024 at 11:05:07 UTC, yabobay wrote:
> On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş 
> wrote:
>> On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote:
>>> I'm using [dray](https://code.dlang.org/packages/dray) in my 
>>> project with dub, here's the relevant parts of the dub.json:
>>>
>>> [...]
>>
>> İt seems your issue is related to the raylib itself, neither 
>> the binding you use nor the d programming language. İnstalling 
>> x11 development package may resolve the issue.
>
> I have the equivalent package installed both on the build 
> machine and the machine i tried to run the code on. Also, no i 
> shouldn't. It's supposed to be a statically linked binary

libglfw, which is embedded statically in raylib, is trying to 
dynamically open libx11.

https://github.com/raysan5/raylib/blob/c1fd98591d7996dd45a5ce9ecbb4b571607d417b/src/external/glfw/src/x11_init.c#L1269

So what it appears to be is, glfw tries to open a specified 
libx11, and fails, and then the program errors and exits.

The library selected is determined by a compiler directive (see 
above that line), you may have to rebuild raylib with the right 
directive based on what libx11 you have on the system.

Note, these are not *dynamically linked* libraries, but 
*dynamically loaded* libraries. That is, the system linker ldd is 
not pre-loading the library, raylib is finding the library and 
loading it at runtime.

-Steve


More information about the Digitalmars-d-learn mailing list