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

Windows linker ERROR: Unable to load dependent library #45262

Closed
sp-inutech opened this issue May 10, 2022 · 1 comment · Fixed by #57472
Closed

Windows linker ERROR: Unable to load dependent library #45262

sp-inutech opened this issue May 10, 2022 · 1 comment · Fixed by #57472
Labels
system:windows Affects only Windows

Comments

@sp-inutech
Copy link

Linking libjulia.dll in Windows is using wrong separator on loading library:

ERROR: Unable to load dependent library $(WORKING_DIR)\bin\../bin/libgcc_s_seh-1.dll

Furthermore setting local environment inside the executable is not working, since load_library is called by DllMainCRTStartup in internal loader_lib.c.

The reason for the error seams to be the bindir used in Make.inc during Julia build.

Extending PATH environment is not working for deployment reasons.

Solution should support Julia specific environment (JULIA_BINDIR) and not checking dlls in DllMainCRTStartup .

@ViralBShah ViralBShah added the system:windows Affects only Windows label May 10, 2022
@stahta01
Copy link
Contributor

stahta01 commented Feb 1, 2023

Here is some code that the old MSys2 Mingw 1.4.1 Julia package used; I have no idea if it is a solution or a problem
I am currently working on upgrading the package to 1.8.3 and trying to decide if this patch is okay to continue to use.

Tim S.

+++ build-x86_64-w64-mingw32/src/dlload.c	2019-08-06 12:20:36.256669200 +0800
@@ -181,6 +181,17 @@
         }
     }
 
+#ifdef __MINGW32__
+    for(i=0; i < n_extensions; i++) {
+        const char *ext = extensions[i];
+        path[0] = '\0';
+        snprintf(path, PATHBUF, "%s/julia-%s/%s%s", jl_options.julia_bindir, JULIA_VERSION_STRING, modname, ext);
+        handle = jl_dlopen(path, flags);
+        if (handle)
+            goto done;
+    }
+#endif
+
     // now fall back and look in default library paths, for all extensions
     for(i=0; i < n_extensions; i++) {
         const char *ext = extensions[i];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants