-
-
Notifications
You must be signed in to change notification settings - Fork 756
foreign import shared system library does not work #2857
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
Comments
Confirmed. I can pin the bug down to the fact that shared object detection is done by checking the filename suffix. // src/linker.cpp:385
if (string_ends_with(lib, str_lit(".a")) || string_ends_with(lib, str_lit(".o"))) {
lib_str = gb_string_append_fmt(lib_str, " -l:\"%.*s\" ", LIT(lib));
} else if (string_ends_with(lib, str_lit(".so"))) {
lib_str = gb_string_append_fmt(lib_str, " -l:\"%s/%.*s\" ", cwd, LIT(lib));
} else {
lib_str = gb_string_append_fmt(lib_str, " -l%.*s ", LIT(lib));
} I've inserted some printfs into this code, recompiled the Odin compiler and built the following file: package main
import "core:fmt"
@require foreign import lib "system:raylib.so"
main :: proc() {
fmt.printf("Hellope!\n")
} The result's execution depends on the presence of raylib in the current directory despite the system import being used. In both cases the import is detected as Also, I'll put it here, because it's somewhat related: it doesn't search the CWD for the library at runtime, because CWD isn't specified in |
UPD: Seems like |
This issue entirely stops me from using the language. I want to use a system library on linux and there is apparently no way to do so. I quite literally cannot write the program I intended to write in odin. |
Linux Mint 21
odin version dev-2023-10:cffa035c
It will search in path where it runs instead of system path.
However importing static library works.
The text was updated successfully, but these errors were encountered: