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

Linker error on build #18

Open
Lythium4848 opened this issue Feb 13, 2025 · 10 comments
Open

Linker error on build #18

Lythium4848 opened this issue Feb 13, 2025 · 10 comments

Comments

@Lythium4848
Copy link

Currently trying to add sqlx4k into my project, however I am running into aa linker error on build.
I am using Windows 11, Kotlin 2.1.10, and sqlx4k 0.43.0

e: C:\Users\Max\.konan\dependencies\llvm-16.0.0-x86_64-windows-essentials-56/bin/clang++ invocation reported errors

The C:\Users\Max\.konan\dependencies\llvm-16.0.0-x86_64-windows-essentials-56/bin/clang++ command returned non-zero exit code: 1.
output:
lld-link: warning: ignoring unknown argument: -exclude-symbols:___chkstk_ms
lld-link: error: -exclude-symbols:___chkstk_ms is not allowed in .drectve
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried both sqlx4k-postgres and mysql, both getting the same error.

@smyrgeorge
Copy link
Owner

Hello,
I ll try to see what is happening during the day. Although can you please tell me for which target you are trying to build? I guess win target right? In that case can you please try a different (like linuxArm64 or linuxAmd64). Can you please also try older versions? Such as 0.40.0, 0.41.0 or 0.42.0

@Lythium4848
Copy link
Author

Currently only tried mingwX64, however i have tried 0.40.00, 0.41.0 and 0.42.0, all getting the same error.
Just tried on linuxX64 and everything looks to be building correctly

@smyrgeorge
Copy link
Owner

smyrgeorge commented Feb 14, 2025

I guess is a problem of the toolchain for windows then. Never tested it throughly on windows. On Linux and Mac works perfectly. I ll try to take a look at it a bit later

@smyrgeorge
Copy link
Owner

I just published version 0.44.0. I couldn't reproduce exactly your problem (I don't have an windows machine available right now), but I found that some linker options were missing for windows targets.
Please take a try and let me know if the problem remains.
If everything is OK, please close this issue.

@Lythium4848
Copy link
Author

Still getting the same error on 0.44.0

@smyrgeorge
Copy link
Owner

smyrgeorge commented Feb 16, 2025

Can you please provide me your build.gradle file?

@Lythium4848
Copy link
Author

Can you please provide me your build,gradle file?

https://gist.github.com/Lythium4848/6be4ee17a76b64892f33c43c93c2af1a

@smyrgeorge
Copy link
Owner

smyrgeorge commented Feb 16, 2025

I created a similar sample project and everything works as expected for me. You can also verify it by looking at the examples.

I think the issue is related to the kotlin's native toolchain for windows (I'm building from macOS, so I cannot reproduce the error).

Also, I found this:
https://discuss.kotlinlang.org/t/custom-clang-version-with-kotlin-native/28150

I'll let the issue open for now.
Please if you find a solution please let me know.

@smyrgeorge
Copy link
Owner

smyrgeorge commented Feb 17, 2025

Also take a look here:
https://kotlinlang.slack.com/archives/C3SGXARS6/p1738695410930209

According to this you have to change your linker and use the linker provided by the toolchain (if I understand correctly)

Probably this issue will be fixed within a new version of Kotlin.

@smyrgeorge
Copy link
Owner

@Lythium4848 any news on this?

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

No branches or pull requests

2 participants