godotengine / godotengine/godot-cpp-template

Linux CMake lib prefix not generated

Open
#114 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
463
Forks
128
PR merge metrics
No merged PRs in 30d

Description

### Godot version

v 4.6.1

### godot-cpp version

current - cloned today

### System information

Linux Open suse Tumbleweed

### Issue description

I recently had a problem working on an extension and didn't notice the problem for a while because I always built things first with scons. However on a recent project I had not built with scons I started getting file not found errors for the generated shared library.

After solving my user errors, I still had to edit the .gdextension file to adjust the name of the built library file because the cmake build does not add the `lib` prefix.

To confirm this I cloned the template and tried building it without any changes using cmake. The template builds and launches but there are errors:

```
ERROR: Condition "!FileAccess::exists(path)" is true. Returning: ERR_FILE_NOT_FOUND
at: open_dynamic_library (drivers/unix/os_unix.cpp:1061)
ERROR: Condition "!FileAccess::exists(path)" is true. Returning: ERR_FILE_NOT_FOUND
at: open_dynamic_library (drivers/unix/os_unix.cpp:1061)
ERROR: GDExtension dynamic library not found: 'res://bin/example.gdextension'.
at: open_library (core/extension/gdextension.cpp:740)
ERROR: Error loading extension: 'res://bin/example.gdextension'.
```

To fix I had to add the lib prefix explicitly to the libname variable in the cmake lists file or edit the gdextnsions file to omit the lib prefix in the library name.

not sure if related to #38 or #107 ?

Edit:
Here's a screenshot in case it's unclear what I mean. At the top is the library file that is generated, and at the bottom the gdextension file. Note the library generated lacks the `lib` prefix that is present in the gdextension file for each of the library file names.

Image

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.