Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
How to deploy a shared library with cmake on Linux

I have shared library called "libmylib.so" which sits inside a folder "LIBS" outside my application source directory. To link the library to my main executable, I'm using the following CMake commands:

set(LIBS_FOLDER "${CMAKE_SOURCE_DIR}/../LIBS")
find_library(MYLIB NAMES mylib libmylib mylib.dll HINTS ${LIBS_FOLDER})

target_link_libraries(MyApp PUBLIC ${MYLIB})

This works well on both Linux and Windows, however on Linux when I deploy my application the executable links to mylib using its absolute path. Indeed, running ldd MyApp shows that it is linked to:

libmylib.so => /absolute_path_to_libs_dir/libmylib.so (0x00007f9dae78f000)

This is obviously a problem since I can't deploy this to any environment. How can I get around this problem? Is there way to link and deploy the shared library correctly?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda