godotengine / godotengine/godot

GDExtension library files won't load in a folder separate from the Godot executable

Open
#87,761 4 comments 1 reaction 0 assignees View on GitHub
discussion documentation topic:gdextension
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.2.1

### System information

Linux

### Issue description

My game's Godot executable and .pck file are in separate folders. By using --main-pack the .pck will be loaded just fine but not the GDExtension library present in the same folder as the .pck file. If there's an override.cfg in this separate folder, the override.cfg will load, though.

I've tried to set LD_LIBRARY_PATH and LD_PRELOAD to the folder where the .pck is. The GDExtension library file can't be loaded this way but the library file provided by the Steamworks SDK can.

### Steps to reproduce

```
export LD_LIBRARY_PATH=/home/user/Desktop/pckandgde/

/home/user/Desktop/gameexec/game.x86_64 --main-pack /home/user/Desktop/pckandgde/pack.pck

ERROR: Can't open dynamic library: addons/godotsteam/linux64/libgodotsteam.x86_64.so. Error: /home/user/Desktop/gameexec/../lib/libgodotsteam.x86_64.so: cannot open shared object file: No such file or directory.
at: open_dynamic_library (drivers/unix/os_unix.cpp:660)
ERROR: GDExtension dynamic library not found: addons/godotsteam/linux64/libgodotsteam.x86_64.so
at: open_library (core/extension/gdextension.cpp:719)
ERROR: Failed loading resource: res://addons/godotsteam/godotsteam.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:274)
ERROR: Error loading extension: res://addons/godotsteam/godotsteam.gdextension
at: load_extensions (core/extension/gdextension_manager.cpp:234)
```

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Research direction

Reproduce with --main-pack using the command and paths in the issue, then trace open_dynamic_library in drivers/unix/os_unix.cpp and the GDExtension loading path in core/extension/gdextension.cpp. Compare the executable and .pck locations shown in the error. Done means the GDExtension library loads when it is in the folder containing the separate .pck.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.