Skip to content
Advertisement

How do I compile and deliver my application without requiring installation of shared libraries on other machines

On my Ubuntu machine I installed libGLEW. However, I did not install it on my other Ubuntu machine. It works on my compiling machine, but now I received the following error after copying my executable to my other machine.

I want to find a solution where I don’t have to require my other machine to install the library. Maybe I can simply share the file along with the executable, like I would do in Windows with DLL files? Would that be possible? And if so, how do I do that?

error while loading shared libraries: libGLEW.so.2.1: cannot open shared object file: No such file or directory

In CMake, I used the following relevant pieces of code:

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -g" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -g" )

include_directories(
    ...
    "/usr/include/GL" # Also includes glew.h
)

add_executable( ${PROJECT_NAME}
    ${PROJECT_SRC}
)

target_link_libraries( ${PROJECT_NAME}
    ...
    "GLEW"
)

Advertisement

Answer

To solve the issue for my situation, I added glew.c to my source files which solves the issue.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement