Skip to content

Conversation

@newamber
Copy link
Contributor

@newamber newamber commented Apr 15, 2025

Fixed the missing getentropy function declaration when compiling with Swift static MUSL SDK on Linux.

Add #include <unistd.h> because in musl:

➜ grep -rn "getentropy" ./include/
./include/unistd.h:182:int getentropy(void *, size_t);
./include/c++/v1/__config:274://      Use getentropy().

before:

➜ swift build --swift-sdk x86_64-swift-linux-musl
[1/1] Planning build
Building for debugging...
/home/newamber/project/mine/mtvmm/.build/checkouts/Citadel/Sources/CCitadelBcrypt/bcrypt-kdf.c:162:5: error: call to undeclared function 'getentropy'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  162 |     getentropy(key, keylen);
      |     ^
1 error generated.
[1/27] Write swift-version-5D5E3C4E9BE48293.txt

After:

➜ swift build --swift-sdk x86_64-swift-linux-musl
Building for debugging...
clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
[7/7] Linking mtvmm
Build complete! (1.48s)

@newamber
Copy link
Contributor Author

Hi @Joannis, I have submitted this PR and hope you can review it when you have time. Thank you!

@newamber
Copy link
Contributor Author

Hi @Joannis , feel free to let me know if there’s any issue with this PR.

@Joannis
Copy link
Member

Joannis commented Jun 11, 2025

Apologies, I hadn't seen the PR yet! I'll have a look

@Joannis Joannis merged commit a4059d8 into orlandos-nl:main Jun 11, 2025
@Joannis
Copy link
Member

Joannis commented Jun 11, 2025

Thanks for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants