BastiaanOlij / gdnative_cpp_example

GDNative C++ example for tutorial
MIT License
65 stars 31 forks source link

scons on linux: cannot find -lgodot-cpp/bin/godot-cpp.linux.64 #1

Open CosineP opened 6 years ago

CosineP commented 6 years ago

OS: Debian Buster

Steps to reproduce

$ cd godot-cpp
$ scons platform=linux headers=../godot_headers generate_bindings=yes
$ cd ..
$ scons platform=linux

Expected results

Builds without errors

Actual results

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o demo/bin/x11/libgdexample.so -shared src/gdexample.os src/gdlibrary.os -lgodot-cpp/bin/godot-cpp.linux.64
/usr/bin/ld: cannot find -lgodot-cpp/bin/godot-cpp.linux.64
collect2: error: ld returned 1 exit status
scons: *** [demo/bin/x11/libgdexample.so] Error 1
scons: building terminated because of errors.

Solution

Downloading the file referenced in the tutorial and replacing the one here allows the project to build without error. Perhaps this repo should be updated?

BastiaanOlij commented 6 years ago

Hey @CosineP ,

Thanks! I don't use Linux myself so I had just copied the settings from another project. Another Godoter must have updated the tutorials with a fix. I'll find some time later in the week to compare the example project with the latest updates in the docs, there may be other changes :)

adrian-maggio commented 6 years ago

I had this same issue on OSX High Sierra. Using this file: http://docs.godotengine.org/en/3.0/_downloads/SConstruct instead of the one in your repo fixed the issue.

BastiaanOlij commented 6 years ago

Does it work with the changes i committed last night?

On Fri, 3 Aug 2018 at 3:06 am, Cyborg Interactive, LLC < notifications@github.com> wrote:

I had this same issue on OSX High Sierra. Using this file: http://docs.godotengine.org/en/3.0/_downloads/SConstruct http://url instead of the one in your repo fixed the issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BastiaanOlij/gdnative_cpp_example/issues/1#issuecomment-409999138, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2vaVabhzb1F3cStnseytBMrN0cP_iKks5uMzGKgaJpZM4VG3Tl .

-- Kindest regards,

Bastiaan Olij

https://www.facebook.com/bastiaan.olij https://twitter.com/mux213 https://www.youtube.com/channel/UCrbLJYzJjDf2p-vJC011lYw https://github.com/BastiaanOlij

BastiaanOlij commented 6 years ago

Ah hang on, sorry i’m on email so didn’t realise this is a different repo, i fixed gdtest last night, i’ll update this one with the same fix soon!

On Fri, 3 Aug 2018 at 11:10 am, Bastiaan Olij mux213@gmail.com wrote:

Does it work with the changes i committed last night?

On Fri, 3 Aug 2018 at 3:06 am, Cyborg Interactive, LLC < notifications@github.com> wrote:

I had this same issue on OSX High Sierra. Using this file: http://docs.godotengine.org/en/3.0/_downloads/SConstruct http://url instead of the one in your repo fixed the issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BastiaanOlij/gdnative_cpp_example/issues/1#issuecomment-409999138, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2vaVabhzb1F3cStnseytBMrN0cP_iKks5uMzGKgaJpZM4VG3Tl .

-- Kindest regards,

Bastiaan Olij

https://www.facebook.com/bastiaan.olij https://twitter.com/mux213 https://www.youtube.com/channel/UCrbLJYzJjDf2p-vJC011lYw https://github.com/BastiaanOlij

-- Kindest regards,

Bastiaan Olij

https://www.facebook.com/bastiaan.olij https://twitter.com/mux213 https://www.youtube.com/channel/UCrbLJYzJjDf2p-vJC011lYw https://github.com/BastiaanOlij

BastiaanOlij commented 6 years ago

Finally had time to do this, could you guys test if this now works on the other two platforms please?

CosineP commented 6 years ago

Works for me on Linux! Thanks!

frankiezafe commented 5 years ago

After several attempts, i managed to write a procedure that works every time: https://gitlab.com/frankiezafe/gdnative_template/blob/master/README.md - i don't get why i have to clone godot_headers 2 times (once in godot-cpp and once in the root folder), but it works fine...

when i'm trying to use the godot_header in the root to compile godot-cpp, i get an error:

scons platform=linux headers_dir=../godot_headers generate_bindings=yes

outputs:

scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ -o src/core/Array.o -c -fPIC -g -std=c++14 -Wwrite-strings -Og -m64 -I. -Igodot_headers -Iinclude -Iinclude/core src/core/Array.cpp In file included from src/core/Array.cpp:1:0: include/core/Array.hpp:4:28: fatal error: gdnative/array.h: No such file or directory compilation terminated. scons: *** [src/core/Array.o] Error 1 scons: building terminated because of errors.

I have a successfull compilation without duplicating godot_header if i set modify godot_headers/ to godot-cpp/godot_headers/ in the root SConstruct:

env.Append(CPPPATH=['.', 'src/', "godot-cpp/godot_headers/", 'godot-cpp/include/', 'godot-cpp/include/core/'])

BastiaanOlij commented 5 years ago

Hi @frankiezafe,

This is the downside of working with something that is still so actively evolving. The Godot headers have moved into the godot-cpp folder so it is no longer needed to place them in the root of the project. Keep in mind that you clone with the recursive option and make sure you check out the correct branch. The above error sounds like your mixing up the master and 3.0 branches of the components.

Make sure you follow the instructing in the latest docs: http://docs.godotengine.org/en/latest/tutorials/plugins/gdnative/gdnative-cpp-example.html