GDNative cannot find -llibgodot-cpp...

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 1234ab

I’m following the tutorial on GitHub - godotengine/godot-cpp: C++ bindings for the Godot script API but when I get to the part to compile the code (init.cpp, which I copy-pasted) the first clang++ runs fine.
But when I run clang++ -o bin/libtest.so -shared src/init.o -Lgodot-cpp/bin -llibgodot-cpp.linux.debug.64.a I get the following error:

/usr/bin/ld: cannot find -llibgodot-cpp.linux.debug.64.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and when I run it with -v:

...
"/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -shared -o build/libtest.so /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -Lsource/godot-cpp/bin -L/usr/bin/../lib/gcc/x86_64-linux-gnu/9 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../.. -L/usr/lib/llvm-10/bin/../lib -L/lib -L/usr/lib build/init.o -llibgodot-cpp.linux.debug.64.a -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -llibgodot-cpp.linux.debug.64.a

But I compiled the godot-c++ thing with scons, and I have the library in godot-cpp/bin with the name libgodot-cpp.linux.debug.64.a . I hope I didn’t miss something obvious but I have no idea what’s causing this. I tried specifying with absolute path, I replaced my custom paths with the one from the tutorial, but it still doesn’t find it. I also tried putting spaces.

OS: ubuntu 20.04
clang version 10.0.0-4ubuntu1

:bust_in_silhouette: Reply From: 1234ab

Oh I think I got it working after deleting random parts of the filename XD and with the help of Android compiling error. · Issue #364 · godotengine/godot-cpp · GitHub it turns out that I don’t need lib in front and .a in the back and now it finds it. So the command should look like: clang++ -o bin/libtest.so -shared src/init.o -Lgodot-cpp/bin -lgodot-cpp.linux.debug.64
I think I tried both removing .a and removing lib some time before but I didn’t try both :D.