0 votes

Hello,

I'm currently trying to compile a C++ module using libsodium.
The folder structure looks like this:

godot/modules/sodium   //Module path
godot/modules/sodium/libsodium-stable   //Sodium repository

At first I tried compiling the project, then building Godot with the following SCsub :

Import('env')
env_sodium = env.Clone()

#Headers
env_sodium.Append(CPPPATH=['libsodium-stable/src/libsodium/include'])
#.a files
env_sodium.Append(LIBPATH=['libsodium-stable/src/libsodium/.libs'])
#lib name
env_sodium.Append(LIBS=['sodium'])
#Module files
env_sodium.add_source_files(env.modules_sources,"*.cpp")

I double, triple and quadruple checked, the libsodium.a file and headers are in the specified directories
The previous snippet reaches [100%], then blasts a bunch of undefined reference to <whatever sodium method> errors

With a different library, this also happened, but I could fix this by just directly including the source files; I can't quite do this with sodium, since headers and source files are in separate directories, and whenever I try building w/ the following SCsub :

Import('env')
env_sodium = env.Clone()

#Sodium
#Header directory
env_sodium.Append(CPPPATH=['libsodium-stable/src/libsodium/include'])
#Source
env_sodium.add_source_files(env.modules_sources,"libsodium-stable/src/libsodium/crypto_kdf/crypto_kdf.c")
env_sodium.add_source_files(env.modules_sources,"libsodium-stable/src/libsodium/crypto_kdf/blake2b/kdf_blake2b.c")
env_sodium.add_source_files(env.modules_sources,"libsodium-stable/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c")
#and many more

I always get <some header>.h : No such file or directory for the source files.
Can anyone give me a hand?

I'm running Manjaro, I haven't tried any other distros or OS.

Thank you in advance!

asked Mar 29 in Engine by CamoPan (19 points)

1 Answer

0 votes
Best answer

Fixed this by appending the include directories to env. Some headers still couldn't be found so I used Prepend, which for whatever reason worked

answered Apr 6 by CamoPan (19 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.