Linking a shared library in dub
maik klein via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Mar 30 05:19:34 PDT 2016
I want to finally convert my project to windows. That means that
I want to build it on windows and linux.
The problem is that I have one external c library 'glfw'. I
thought that I would just link with it explicitly but actually I
am not completely sure how.
So I just added a submodule, cloned glfw and build it as a shared
library
lflags "deps/glfw/build/src/libglfw.so"
This is the eps/glfw/build/src folder:
total 196K
drwxr-xr-x 3 maik users 4.0K Mar 30 14:07 .
drwxr-xr-x 6 maik users 4.0K Mar 30 14:07 ..
drwxr-xr-x 3 maik users 4.0K Mar 30 14:07 CMakeFiles
-rw-r--r-- 1 maik users 2.1K Mar 30 14:07 cmake_install.cmake
-rw-r--r-- 1 maik users 56 Mar 30 14:07 glfw3Config.cmake
-rw-r--r-- 1 maik users 1.6K Mar 30 14:07 glfw3ConfigVersion.cmake
-rw-r--r-- 1 maik users 348 Mar 30 14:07 glfw3.pc
-rw-r--r-- 1 maik users 3.1K Mar 30 14:07 glfw_config.h
lrwxrwxrwx 1 maik users 12 Mar 30 14:07 libglfw.so ->
libglfw.so.3
lrwxrwxrwx 1 maik users 14 Mar 30 14:07 libglfw.so.3 ->
libglfw.so.3.2
-rwxr-xr-x 1 maik users 142K Mar 30 14:07 libglfw.so.3.2
-rw-r--r-- 1 maik users 18K Mar 30 14:07 Makefile
But If I try to build it with dub, i'll get "./bin/breeze_opengl:
error while loading shared libraries: libglfw.so.3: cannot open
shared object file: No such file or directory"
But as you can see it is in there. I get the same error with
lflags "deps/glfw/build/src/libglfw.so.3"
lflags "deps/glfw/build/src/libglfw.so.3.2"
Also the path seems to be correct because if I try to add a file
that not exisit I get a different error
lflags "deps/glfw/build/src/doesnotexist.so"
/usr/bin/ld: cannot find deps/glfw/build/src/doesnotexist.so: No
such file or directory
collect2: error: ld returned 1 exit status
Am I doing something wrong?
More information about the Digitalmars-d-learn
mailing list