godotengine / godotengine/godot-docs

Godot 4+(master) GDExtension C++ example instructions on macos not working

Open
#7,246 2 comments 0 reactions 0 assignees View on GitHub
area:getting started bug platform:macos topic:gdextension
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**

```
% git rev-parse HEAD
2ff3cf9bf91dc532b0f435079aaf2ae6eee8609f
```

**Issue description:**

On MacOS gdexample.gdextension doesn't point to correct library:
```
ERROR: Can't open dynamic library: /Users/jpedrick/Development/godot-master-cpp-tutorial/cpp-tutorial/demo/bin/libgdexample.macos.framework, error: dlopen(/Users/jpedrick/Development/godot.git/bin/../Frameworks/libgdexample.macos.framework, 0x0002): tried: '/Users/jpedrick/Development/godot.git/bin/../Frameworks/libgdexample.macos.framework' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/jpedrick/Development/godot.git/bin/../Frameworks/libgdexample.macos.framework' (no such file), '/Users/jpedrick/Development/godot.git/bin/../Frameworks/libgdexample.macos.framework' (no such file).
at: open_dynamic_library (platform/macos/os_macos.mm:191)
ERROR: GDExtension dynamic library not found: /Users/jpedrick/Development/godot-master-cpp-tutorial/cpp-tutorial/demo/bin/libgdexample.macos.framework
at: open_library (core/extension/gdextension.cpp:400)
ERROR: Failed loading resource: res://bin/gdexample.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:223)
```

Two fixes are needed:

1) scons platform=macos => scons platform=macos target=editor
2) gdexample.gdextension =>

```
[configuration]

entry_symbol = "example_library_init"

[libraries]

linux.64="res://bin/libgdexample.linux.64.so"
windows.x86_64="res://bin/libgdexample.windows.x86_64.dll"
macos="res://bin/libgdexample.macos.editor.framework/libgdexample.macos.editor"
```

**URL to the documentation page:**

https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/gdextension_cpp_example.html

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.