Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planned incompatible API changes for Godot 4.0 #71

Closed
2shady4u opened this issue Mar 22, 2022 · 26 comments
Closed

Planned incompatible API changes for Godot 4.0 #71

2shady4u opened this issue Mar 22, 2022 · 26 comments
Assignees
Labels
question Further information is requested

Comments

@2shady4u
Copy link
Owner

2shady4u commented Mar 22, 2022

I've been working on the GDExtension port of this plugin on a separate branch which can be found here

This issue aims to serve as a compiled list of all planned changes that will (possibly) break backwards compatibility:

  • Implementation of query() should return query_result, not boolean #60 as duplicating the query_result yourself is a hassle in most cases and not clear for beginners. However, the extent to which this is to be implemented is still to be straightened out...
  • ....

Other issues that are to be fixed and will be back-ported:

How to test the latest Godot 4.0 version of this plugin?

  1. Checkout the latest "gd-extension"-branch on your device.
  2. Get the binaries and place them in the bin/-folder of the demo-project. This can be done by either:
  • Going to Github Actions (as found here) and downloading the latest binaries that corresponds to your desired platform(s).
  • Compiling the plugin yourself by following the instructions as found here.
  1. Open the demo-project using the latest Godot 4 alpha executable and start the demo-project

How to port my Godot 3.x project to Godot 4.0?

Differences between the API can be easily analyzed by comparing the demo-project's differences between versions:
Godot 3.x: https://github.com/2shady4u/godot-sqlite/blob/master/demo/database.gd
Godot 4.0: https://github.com/2shady4u/godot-sqlite/blob/gd-extension/demo/database.gd

In summary:

  • The SQLite plugin doesn't have to be preloaded any longer. As a result, following lines of code:
const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns")
var db

func ready():
    db = SQLite.new()

has to be replaced by:

var db

func ready():
    db = SQLite.new()
  • The verbose_mode-property has been removed in favor of the verbosity_level-property. As a result, following lines of code:
func ready():
    db = SQLite.new()
    db.verbose_mode = True

has to be replaced by:

func ready():
    db = SQLite.new()
    db.verbosity_level = SQLite.VERBOSE
@2shady4u 2shady4u added the question Further information is requested label Mar 22, 2022
@2shady4u 2shady4u self-assigned this Mar 22, 2022
@2shady4u 2shady4u pinned this issue Mar 22, 2022
@2shady4u 2shady4u changed the title Planned incompitable API changes for Godot 4.0 Planned incompatible API changes for Godot 4.0 Mar 23, 2022
@Barskt
Copy link

Barskt commented Mar 25, 2022

Hi there!
I am interested in trying out this version of the plugin for godot 4.0. I have tried cloning the repository and copying the contents of the demo folder to an empty godot project. But I am greeted with this error: Error loading extension: res//addons/godot-sqlite/godot-sqlite.gdextension.

I don't have much experience with building godot from source, but I have tried building the plugin using scons to no avail:
gdsqlite.h(4): fatal error C1083: Cannot open include file: 'godot_cpp/variant/utility_functions.hpp': No such file or directory.

Would appreciate any pointers in the right direction to get this to work!
Thanks in advance! :)

@2shady4u
Copy link
Owner Author

Hi @Barskt!

The binary files found on that branch are the old binary files which do not work with Godot 4.0 :(
I'll try and see if I can set up some Github Actions to auto-build the plugin for the gd-extension-branch.

Regarding compiling the plugin yourself; you won't need to compile Godot from scratch, just the correct godot-cpp-branch.

@Barskt
Copy link

Barskt commented Mar 25, 2022

Ah, I see :/
As I don't have much experience with compiling I'll wait eagerly for the auto-builds ;P
Thank you so much for your quick reply and the great work you are doing with this plugin! :)

@2shady4u
Copy link
Owner Author

Ah, I see :/ As I don't have much experience with compiling I'll wait eagerly for the auto-builds ;P Thank you so much for your quick reply and the great work you are doing with this plugin! :)

You can now download the Windows and Linux binaries here.
Just clone this repository and place them inside of the bin/-folder.

@Barskt
Copy link

Barskt commented Mar 26, 2022

Thank you so much!
Got the demo to work :)

One note to anyone else who might be interested.
You need to open the gdsqlite.gdextension file and change the name from: libgdsqlite.windows.debug.64.dll to libgdsqlite.windows.release.64.dll under the [libraries] section.

@zenasican
Copy link

First off, amazing job. I tried to install on Alpha 6 but I get:

E 0:00:00:0815 _register_extension_class: Method/function failed.
<C++ Source> core/extension/native_extension.cpp:134 @ _register_extension_class()

Where did I go wrong?

@2shady4u
Copy link
Owner Author

2shady4u commented Apr 25, 2022

First off, amazing job. I tried to install on Alpha 6 but I get:

E 0:00:00:0815 _register_extension_class: Method/function failed. <C++ Source> core/extension/native_extension.cpp:134 @ _register_extension_class()

Where did I go wrong?

Hi @zenasican !

I've pushed an update to the gdextension-branch that hopefully fixes this issue for alpha 6.
If I may ask, are you encountering this issue on Windows or on Linux?
Feel free to download the newest/latest binary here.

Cheers!

@zenasican
Copy link

Awesome! I'm running Windows 10 at the moment. I'll try the new update asap.

@zenasican
Copy link

Godot 4 Alpha 6, Win10

Downloaded gd-extension and unzipped
Copied the ..\bin folder from the master branch (?!)
Copied the .dll to that \bin folder
Changed "debug" to release (ty Barskt)
Enabled the plugin in the project settings

The EditorPlugin parser error is gone. The output console goes bonkers :D
Two errors are pushed:
E 0:00:00:0880 _ready: Condition "_instance_bindings != nullptr" is true.
<C++ Source> core/object/object.cpp:1778 @ set_instance_binding()
database.gd:46 @ example_of_basic_database_querying()
database.gd:22 @ _ready()

E 0:00:00:0989 _ready: Condition "_instance_bindings != nullptr" is true.
<C++ Source> core/object/object.cpp:1778 @ set_instance_binding()
database.gd:177 @ example_of_blob_io()
database.gd:23 @ _ready()

Aside from that, it seems to work.

@KirillSerogodsky
Copy link

KirillSerogodsky commented Apr 28, 2022

Alpha 7:

ERROR: Condition "!method" is true. Returning: 0
   at: get_builtin_method_hash (core/variant/variant_call.cpp:1172)
ERROR: Error getting method , hash mismatch.
   at: gdnative_variant_get_ptr_builtin_method (core/extension/gdnative_interface.cpp:475)

godot-cpp from master:
https://github.com/KirillSerogodsky/godot-sqlite/actions/runs/2241829670

@2shady4u
Copy link
Owner Author

2shady4u commented May 1, 2022

Alpha 7:

ERROR: Condition "!method" is true. Returning: 0
   at: get_builtin_method_hash (core/variant/variant_call.cpp:1172)
ERROR: Error getting method , hash mismatch.
   at: gdnative_variant_get_ptr_builtin_method (core/extension/gdnative_interface.cpp:475)

godot-cpp from master: https://github.com/KirillSerogodsky/godot-sqlite/actions/runs/2241829670

Hey @KirillSerogodsky !

I've synced the godot-cpp submodule to the correct commit for alpha 7!
Everything should hopefully work again 🤞

@atngames
Copy link

atngames commented May 2, 2022

Hi,
I might not have well understood how to make it work.
I am on ubuntu linux, did download the latest file.so and putted it in the bin directory
Changed the filename in "gdsqlite.gdextension" to match
got the
Failed loading resource: res://addons/godot-sqlite/gdsqlite.gdextension. Make sure resources have been imported by opening the project in the editor at least once. error
Thank you for your time with all this !
atn

@2shady4u
Copy link
Owner Author

2shady4u commented May 9, 2022

Hi, I might not have well understood how to make it work. I am on ubuntu linux, did download the latest file.so and putted it in the bin directory Changed the filename in "gdsqlite.gdextension" to match got the Failed loading resource: res://addons/godot-sqlite/gdsqlite.gdextension. Make sure resources have been imported by opening the project in the editor at least once. error Thank you for your time with all this ! atn

Hi @atngames

I've updated to gd-extension to include the correct binary entries for Linux.
Unfortunately, I haven't been able to test the Linux binaries as my virtual Ubuntu does weird things when Godot 4 is opened (= it silently crashes).

I've added some small section in the OP to better describe how to get the Godot 4 version of the plugin working.

@adamgiacomelli
Copy link

You are wonderful, hard-working people - I've managed to get it to work without any issues.
The key is to place the bin folder inside the addons/godot-sqlite folder and to download the latest artifacts from an action that ran on the gd-extentions branch. It is obvious, but not as explicit as it would have to be.

Let me know where I can donate to buy you a beer.

@git2013vb
Copy link

I'm using linux and I have copied the linux filed (got from here https://github.com/2shady4u/godot-sqlite/actions/runs/3608518073) in x11 folder (renamed it as the old file .so)
There a need to make other changes in order to use it?
In my code I use const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") and I have an error.
Sorry but I'm not familiar yet with the whole :)

Assuming I'm using the 3.4 version of your plugin in my project and I want to port it in godot 4. what are exactly the steps to do it?
Thanks :)

@2shady4u
Copy link
Owner Author

Hi @git2013vb

I've added a brand-new section to the OP.
I hope it is sufficient to port your project to Godot 4.0 😄

@git2013vb
Copy link

git2013vb commented Dec 15, 2022

I downloaded the demo (from here https://github.com/2shady4u/godot-sqlite/tree/gd-extension) and I tried to run it - I use Debian 11 and v4.0.beta8.official [45cac42c0] -
But I have this error:
image

So when I try to run the demo he cannot recognise SQLite

Ops. I noticed the demo do not have any binary :) I try using the one from 4.beta7.. I think it will work right?

Finally it work. I checked the correct path and the correct library name (debug version for now)
Do you have an ETA about when it will be in godot plugin website? I think it will be on sync with current version :)

Thanks a lot.

@vickylance
Copy link

vickylance commented Mar 26, 2023

@2shady4u Is there a way we can compile this plugin in its current state for Android? Or some fixing is pending to be done before it can be compiled?

@2shady4u
Copy link
Owner Author

@2shady4u Is there a way we can compile this plugin in its current state for Android? Or some fixing is pending to be done before it can be compiled?

Hi @vickylance ,
At the moment the plugin compiles for Android.
However, there's some additional work that needs to be done in the godot-cpp repository to make GDExtension for Android.

@skysphr
Copy link

skysphr commented Apr 11, 2023

For anyone else getting "No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension." while attempting to export on Android, the fix is opening the .gdextension file in a text editor and adding the following lines:

below [libraries]:

android.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so"
android.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so"
android.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so"
android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so"

below [dependencies]:

android.arm64 = {}
android.template_release.arm64 = {}
android.x86_64 = {}
android.template_release.x86_64 = {}

@vtgreybeard
Copy link

For anyone else getting "No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension." while attempting to export on Android, the fix is opening the .gdextension file in a text editor and adding the following lines:

below [libraries]:

android.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so"
android.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so"
android.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so"
android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so"

below [dependencies]:

android.arm64 = {}
android.template_release.arm64 = {}
android.x86_64 = {}
android.template_release.x86_64 = {}

Well, that got me 1 step closer, thanks!
Any suggestions on the next error while trying to explore to android?

 platform/android/export/export_plugin.cpp:744 - Cannot determine architecture for library "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so". One of the supported architectures must be used as a tag: arm32 arm64 x86_32 x86_64
  editor/export/editor_export_platform.h:173 - Export: Could not export project files.

@skysphr
Copy link

skysphr commented Apr 18, 2023

Can you paste the contents of your .gdextension file? Also what architectures are you exporting for? Sorry I didn't notice the comment earlier.

@vtgreybeard
Copy link

Gladly!
I'm exporting for armeabi-v7a and arm64-v8a, and my .gdextension file is as follows:

[configuration]

entry_symbol = "sqlite_library_init"

[libraries]

macos = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework"
macos.template_release = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework"
windows.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll"
windows.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll"
linux.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so"
linux.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so"

android.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so"
android.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so"
android.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so"
android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so"

[dependencies]

android.arm64 = {}
android.template_release.arm64 = {}
android.x86_64 = {}
android.template_release.x86_64 = {}

macos = {}
macos.template_release = {}
windows.x86_64 = {}
windows.template_release.x86_64 = {}
linux.x86_64 = {}
linux.template_release.x86_64 = {}

@cyberpuffin-digital
Copy link

cyberpuffin-digital commented Jul 26, 2023

@2shady4u tacking on here as it seems to relate, but I can open another issue if you'd prefer. I haven't been able to find any other reference to issues reporting a lack of Web export for the new GDExtension.

Readme.md doesn't list the Web under supported operating systems, but it does mention the web builds in the "How to Export" section.

Is this a planned feature to be implemented, a breaking compatibility change, or a bug?

* edit: Found the reference in the release notes:

Support for HTML5 isn't supported as it hasn't been implemented yet in GDExtension.

https://github.com/2shady4u/godot-sqlite/releases

@2shady4u
Copy link
Owner Author

2shady4u commented Feb 4, 2024

Support for Web builds has now been added in the latest release, but it seems like it is still quite unstable (on the side of Godot).

@2shady4u
Copy link
Owner Author

Closing this issue as the port to Godot 4.X+ has now matured enough.
There's still some issues but they are mostly on the side of godot-cpp.

@2shady4u 2shady4u unpinned this issue Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests