Discussion:
[CMake] CMake fixup_bundle for ubuntu 16.04
Waldo Valenzuela via CMake
2017-12-11 19:07:55 UTC
Permalink
Dear All,

I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and Mac no problem to created the standalone app, but in Ubuntu 16.04 I have several problems.

I am using CodeBlocks to compile and run the app, and from CodeBlocks when I run the app there is no problem, it work normally like in windows and mac, but after run the installation, and If I want to run the app from the installation folder (./app ) I have several problems.


the CMakeList.txt is

FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})

SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})

MESSAGE("Project libraries: ${QTPLUGINS}")


INSTALL(CODE "
INCLUDE(BundleUtilities)
FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
"
COMPONENT ${PROJECT_NAME})

First I have this:

-- fixup_bundle: fixing...
-- 132/260: fix-up not required on this platform '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
-- 133/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Core.so.5'
-- 134/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Gui.so.5’

-- 167/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
-- 168/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
-- 169/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1

then when I run: ldd ./app I have:

libQt5Concurrent.so.5 => not found
libvtkRenderingImage-9.0.so.1 => not found
libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found

then if I fix manually the path of the libraries like this:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/waldo/app/bin/plugins/platforms"

I can run the application from through the command line from the installation folder, but I have this message and I can not see nothing

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
composeAndFlush: makeCurrent() failed


I think that the FIXUP_BUNDLE is doing nothing.

Any help is welcome.

Best regards,

Waldo.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/
Miklos Espak
2017-12-13 02:58:30 UTC
Permalink
Hi,

you need to add the directory where the Qt libs have been installed (along
with your application binaries) to the LD_LIBRARY_PATH. In your case it is
'/home/waldo/Developer/install/Release/bratumia/bin/', as I see.

Also, you do *not* need to add the Qt plugin directories to the library
path. The plugins are loaded at run-time. So that they can be found, you
need to install a qt.conf file in the bin directory with the following
contents:

[Paths]
Prefix=.

You also do *not* need to add "/usr/lib" and "/usr/lib/x86-..." to the
library path. These libraries are searched for by default. If you did it
because your Qt installation is there, that's wrong. The fixup_bundle
function should have copied the necessary Qt libs in the install bin
folder, so you just need to add that folder to the path.

Also, make sure that the DIRS variable contains all the directories where
there are libraries to install, including dependencies.

I hope that helps.

Best regards,
Miklos



On 11 December 2017 at 19:07, Waldo Valenzuela via CMake <***@cmake.org>
wrote:

> Dear All,
>
> I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and
> Mac no problem to created the standalone app, but in Ubuntu 16.04 I have
> several problems.
>
> I am using CodeBlocks to compile and run the app, and from CodeBlocks when
> I run the app there is no problem, it work normally like in windows and
> mac, but after run the installation, and If I want to run the app from the
> installation folder (./app ) I have several problems.
>
>
> the CMakeList.txt is
>
> FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/
> imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
> FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/
> platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>
> SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})
>
> MESSAGE("Project libraries: ${QTPLUGINS}")
>
>
> INSTALL(CODE "
> INCLUDE(BundleUtilities)
> FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
> "
> COMPONENT ${PROJECT_NAME})
>
> First I have this:
>
> -- fixup_bundle: fixing...
> -- 132/260: fix-up not required on this platform
> '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
> -- 133/260: fix-up not required on this platform '/home/waldo/Developer/
> install/Release/bratumia/bin/libQt5Core.so.5'
> -- 134/260: fix-up not required on this platform '/home/waldo/Developer/
> install/Release/bratumia/bin/libQt5Gui.so.5’
>
> -- 167/260: fix-up not required on this platform '/home/waldo/Developer/
> install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
> -- 168/260: fix-up not required on this platform '/home/waldo/Developer/
> install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
> -- 169/260: fix-up not required on this platform '/home/waldo/Developer/
> install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1
>
> then when I run: ldd ./app I have:
>
> libQt5Concurrent.so.5 => not found
> libvtkRenderingImage-9.0.so.1 => not found
> libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found
>
> then if I fix manually the path of the libraries like this:
>
> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-
> linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/
> waldo/app/bin/plugins/platforms"
>
> I can run the application from through the command line from the
> installation folder, but I have this message and I can not see nothing
>
> QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor
> EGL are enabled
> QOpenGLWidget: Failed to create context
> composeAndFlush: makeCurrent() failed
>
>
> I think that the FIXUP_BUNDLE is doing nothing.
>
> Any help is welcome.
>
> Best regards,
>
> Waldo.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
Waldo Valenzuela via CMake
2017-12-13 19:15:43 UTC
Permalink
Dear Miklos,

thanks for the email, and your suggestions, but the problem with fixup_bundle in ubuntu is that is not fixing the libraries locations from the executables meaning:

if I execute the idd command like this “ idd ./app” where “app” is the executable, the locations of the library is still is “no found", that should be in the location that was copy after running the INSTALL.

when you set LD_LIBRARY_PATH is for a temporally solution, or permanent if I modified the environment configuration of O.S.. The idea is that I want to create a standalone application.

Under this scenario, if I have an executable called “app” and a shared library call “lib.so”, fixup_bundle should fix the location of the “lib.so” in the same folder where is “app”.

Then if I run the command "idd ./app” the output should be:

lib.so => “xxxx”, where xxxx is folder where is located “app"

Cheers,

Waldo.


> On 13 Dec 2017, at 03:58, Miklos Espak <***@gmail.com> wrote:
>
> Hi,
>
> you need to add the directory where the Qt libs have been installed (along with your application binaries) to the LD_LIBRARY_PATH. In your case it is '/home/waldo/Developer/install/Release/bratumia/bin/', as I see.
>
> Also, you do *not* need to add the Qt plugin directories to the library path. The plugins are loaded at run-time. So that they can be found, you need to install a qt.conf file in the bin directory with the following contents:
>
> [Paths]
> Prefix=.
>
> You also do *not* need to add "/usr/lib" and "/usr/lib/x86-..." to the library path. These libraries are searched for by default. If you did it because your Qt installation is there, that's wrong. The fixup_bundle function should have copied the necessary Qt libs in the install bin folder, so you just need to add that folder to the path.
>
> Also, make sure that the DIRS variable contains all the directories where there are libraries to install, including dependencies.
>
> I hope that helps.
>
> Best regards,
> Miklos
>
>
>
> On 11 December 2017 at 19:07, Waldo Valenzuela via CMake <***@cmake.org <mailto:***@cmake.org>> wrote:
> Dear All,
>
> I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and Mac no problem to created the standalone app, but in Ubuntu 16.04 I have several problems.
>
> I am using CodeBlocks to compile and run the app, and from CodeBlocks when I run the app there is no problem, it work normally like in windows and mac, but after run the installation, and If I want to run the app from the installation folder (./app ) I have several problems.
>
>
> the CMakeList.txt is
>
> FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
> FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>
> SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})
>
> MESSAGE("Project libraries: ${QTPLUGINS}")
>
>
> INSTALL(CODE "
> INCLUDE(BundleUtilities)
> FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
> "
> COMPONENT ${PROJECT_NAME})
>
> First I have this:
>
> -- fixup_bundle: fixing...
> -- 132/260: fix-up not required on this platform '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
> -- 133/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Core.so.5'
> -- 134/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Gui.so.5’
>
> -- 167/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
> -- 168/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
> -- 169/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1
>
> then when I run: ldd ./app I have:
>
> libQt5Concurrent.so.5 => not found
> libvtkRenderingImage-9.0.so.1 => not found
> libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found
>
> then if I fix manually the path of the libraries like this:
>
> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/waldo/app/bin/plugins/platforms"
>
> I can run the application from through the command line from the installation folder, but I have this message and I can not see nothing
>
> QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
> QOpenGLWidget: Failed to create context
> composeAndFlush: makeCurrent() failed
>
>
> I think that the FIXUP_BUNDLE is doing nothing.
>
> Any help is welcome.
>
> Best regards,
>
> Waldo.
> --
>
> Powered by www.kitware.com <http://www.kitware.com/>
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <http://www.cmake.org/Wiki/CMake_FAQ>
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html <http://cmake.org/cmake/help/support.html>
> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake <http://public.kitware.com/mailman/listinfo/cmake>
Konstantin Tokarev
2017-12-13 19:19:05 UTC
Permalink
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Waldo Valenzuela via CMake
2017-12-13 19:31:09 UTC
Permalink
Dear Konstantin,


Thanks for the email, yes you are right, I was looking this tool time ago, but the fixup_bundle is just a part of the bigger problem, meaning if I want to create a DEB package with CMake/CPack, how I could tell CPACK to use linuxdeployqt, in runtime.


CMake/CPack in windows and mac osx are doing their job, but in linux no, in linux we need to many additional tools to create a package.

Cheers,

Waldo.

> On 13 Dec 2017, at 20:19, Konstantin Tokarev <***@yandex.ru> wrote:
>
>
>
> 13.12.2017, 22:16, "Waldo Valenzuela via CMake" <***@cmake.org <mailto:***@cmake.org>>:
>> Dear Miklos,
>>
>> thanks for the email, and your suggestions, but the problem with fixup_bundle in ubuntu is that is not fixing the libraries locations from the executables meaning:
>>
>> if I execute the idd command like this “ idd ./app” where “app” is the executable, the locations of the library is still is “no found", that should be in the location that was copy after running the INSTALL.
>>
>> when you set LD_LIBRARY_PATH is for a temporally solution, or permanent if I modified the environment configuration of O.S.. The idea is that I want to create a standalone application.
>>
>> Under this scenario, if I have an executable called “app” and a shared library call “lib.so”, fixup_bundle should fix the location of the “lib.so” in the same folder where is “app”.
>>
>> Then if I run the command "idd ./app” the output should be:
>>
>> lib.so => “xxxx”, where xxxx is folder where is located “app"
>
> Use linuxdeployqt (https://github.com/probonopd/linuxdeployqt <https://github.com/probonopd/linuxdeployqt>)
>
>>
>> Cheers,
>>
>> Waldo.
>>
>>
>>>
>>> On 13 Dec 2017, at 03:58, Miklos Espak <***@gmail.com <mailto:***@gmail.com>> wrote:
>>>
>>> Hi,
>>>
>>> you need to add the directory where the Qt libs have been installed (along with your application binaries) to the LD_LIBRARY_PATH. In your case it is '/home/waldo/Developer/install/Release/bratumia/bin/', as I see.
>>>
>>> Also, you do *not* need to add the Qt plugin directories to the library path. The plugins are loaded at run-time. So that they can be found, you need to install a qt.conf file in the bin directory with the following contents:
>>>
>>> [Paths]
>>> Prefix=.
>>>
>>> You also do *not* need to add "/usr/lib" and "/usr/lib/x86-..." to the library path. These libraries are searched for by default. If you did it because your Qt installation is there, that's wrong. The fixup_bundle function should have copied the necessary Qt libs in the install bin folder, so you just need to add that folder to the path.
>>>
>>> Also, make sure that the DIRS variable contains all the directories where there are libraries to install, including dependencies.
>>>
>>> I hope that helps.
>>>
>>> Best regards,
>>> Miklos
>>>
>>>
>>>
>>> On 11 December 2017 at 19:07, Waldo Valenzuela via CMake <***@cmake.org <mailto:***@cmake.org>> wrote:
>>> Dear All,
>>>
>>> I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and Mac no problem to created the standalone app, but in Ubuntu 16.04 I have several problems.
>>>
>>> I am using CodeBlocks to compile and run the app, and from CodeBlocks when I run the app there is no problem, it work normally like in windows and mac, but after run the installation, and If I want to run the app from the installation folder (./app ) I have several problems.
>>>
>>>
>>> the CMakeList.txt is
>>>
>>> FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>>> FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>>>
>>> SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})
>>>
>>> MESSAGE("Project libraries: ${QTPLUGINS}")
>>>
>>>
>>> INSTALL(CODE "
>>> INCLUDE(BundleUtilities)
>>> FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
>>> "
>>> COMPONENT ${PROJECT_NAME})
>>>
>>> First I have this:
>>>
>>> -- fixup_bundle: fixing...
>>> -- 132/260: fix-up not required on this platform '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
>>> -- 133/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Core.so.5'
>>> -- 134/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Gui.so.5’
>>>
>>> -- 167/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
>>> -- 168/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
>>> -- 169/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1
>>>
>>> then when I run: ldd ./app I have:
>>>
>>> libQt5Concurrent.so.5 => not found
>>> libvtkRenderingImage-9.0.so.1 => not found
>>> libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found
>>>
>>> then if I fix manually the path of the libraries like this:
>>>
>>> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/waldo/app/bin/plugins/platforms"
>>>
>>> I can run the application from through the command line from the installation folder, but I have this message and I can not see nothing
>>>
>>> QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
>>> QOpenGLWidget: Failed to create context
>>> composeAndFlush: makeCurrent() failed
>>>
>>>
>>> I think that the FIXUP_BUNDLE is doing nothing.
>>>
>>> Any help is welcome.
>>>
>>> Best regards,
>>>
>>> Waldo.
>>> --
>>>
>>> Powered by www.kitware.com <http://www.kitware.com/>
>>>
>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <http://www.cmake.org/Wiki/CMake_FAQ>
>>>
>>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html <http://cmake.org/cmake/help/support.html>
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/cmake <http://public.kitware.com/mailman/listinfo/cmake>,--
>>
>> Powered by www.kitware.com <http://www.kitware.com/>
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <http://www.cmake.org/Wiki/CMake_FAQ>
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html <http://cmake.org/cmake/help/support.html>
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
>> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake <http://public.kitware.com/mailman/listinfo/cmake>
>
> --
> Regards,
> Konstantin
Daniel Schepler
2017-12-13 19:32:35 UTC
Permalink
You would need to set the INSTALL_RPATH property of the targets to something like "$ORIGIN/../lib" .

You might also need to add "-Wl,--disable-new-dtags" to the CMAKE_*_LINK_FLAGS variables - otherwise, the RPATH settings will only take effect for direct dependencies of the executables (and any plugins or shared libraries) you build but not for dependencies of these dependencies.

(We also tend not to include copies of glibc or OpenGL libraries - for the former, that tends to have issues if there are any mismatches between the exact build of glibc included in the installer and the NSS modules from the system. For the latter, the OpenGL libraries vary too much between Mesa and the NVidia and AMD proprietary driver versions for any one of them to work on all systems.)
--
Daniel Schepler
________________________________
From: CMake [cmake-***@cmake.org] on behalf of Waldo Valenzuela via CMake [***@cmake.org]
Sent: Wednesday, December 13, 2017 11:15 AM
To: Miklos Espak
Cc: ***@cmake.org
Subject: Re: [CMake] CMake fixup_bundle for ubuntu 16.04

Dear Miklos,

thanks for the email, and your suggestions, but the problem with fixup_bundle in ubuntu is that is not fixing the libraries locations from the executables meaning:

if I execute the idd command like this “ idd ./app” where “app” is the executable, the locations of the library is still is “no found", that should be in the location that was copy after running the INSTALL.

when you set LD_LIBRARY_PATH is for a temporally solution, or permanent if I modified the environment configuration of O.S.. The idea is that I want to create a standalone application.

Under this scenario, if I have an executable called “app” and a shared library call “lib.so”, fixup_bundle should fix the location of the “lib.so” in the same folder where is “app”.

Then if I run the command "idd ./app” the output should be:

lib.so => “xxxx”, where xxxx is folder where is located “app"

Cheers,

Waldo.


On 13 Dec 2017, at 03:58, Miklos Espak <***@gmail.com<mailto:***@gmail.com>> wrote:

Hi,

you need to add the directory where the Qt libs have been installed (along with your application binaries) to the LD_LIBRARY_PATH. In your case it is '/home/waldo/Developer/install/Release/bratumia/bin/', as I see.

Also, you do *not* need to add the Qt plugin directories to the library path. The plugins are loaded at run-time. So that they can be found, you need to install a qt.conf file in the bin directory with the following contents:

[Paths]
Prefix=.

You also do *not* need to add "/usr/lib" and "/usr/lib/x86-..." to the library path. These libraries are searched for by default. If you did it because your Qt installation is there, that's wrong. The fixup_bundle function should have copied the necessary Qt libs in the install bin folder, so you just need to add that folder to the path.

Also, make sure that the DIRS variable contains all the directories where there are libraries to install, including dependencies.

I hope that helps.

Best regards,
Miklos



On 11 December 2017 at 19:07, Waldo Valenzuela via CMake <***@cmake.org<mailto:***@cmake.org>> wrote:
Dear All,

I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and Mac no problem to created the standalone app, but in Ubuntu 16.04 I have several problems.

I am using CodeBlocks to compile and run the app, and from CodeBlocks when I run the app there is no problem, it work normally like in windows and mac, but after run the installation, and If I want to run the app from the installation folder (./app ) I have several problems.


the CMakeList.txt is

FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})

SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})

MESSAGE("Project libraries: ${QTPLUGINS}")


INSTALL(CODE "
INCLUDE(BundleUtilities)
FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
"
COMPONENT ${PROJECT_NAME})

First I have this:

-- fixup_bundle: fixing...
-- 132/260: fix-up not required on this platform '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
-- 133/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Core.so.5'
-- 134/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Gui.so.5’

-- 167/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
-- 168/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
-- 169/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1

then when I run: ldd ./app I have:

libQt5Concurrent.so.5 => not found
libvtkRenderingImage-9.0.so.1 => not found
libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found

then if I fix manually the path of the libraries like this:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/waldo/app/bin/plugins/platforms"

I can run the application from through the command line from the installation folder, but I have this message and I can not see nothing

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QOpenGLWidget: Failed to create context
composeAndFlush: makeCurrent() failed


I think that the FIXUP_BUNDLE is doing nothing.

Any help is welcome.

Best regards,

Waldo.
--

Powered by www.kitware.com<http://www.kitware.com/>

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Waldo Valenzuela via CMake
2017-12-13 20:31:17 UTC
Permalink
Dear Daniel,

Thanks for the email, I was trying different combinations of CMAKE_INSTALL_RPATH, with full and relative paths and were not working, I did not about the link flags, thanks for the advice I will test it.

Also, the relative onces is not clear for me, if I set "$ORIGIN/../lib”, this is reconstructed from the installation directory of the executable of from cpack tmp directory where is copy during the packaged process.

In this topic are missing examples in the CMake documentation (https://cmake.org/Wiki/CMake_RPATH_handling), here they do not mention nothing about the flags also.

Also, I am completely agree with you regarding the OpenGL, vary too much between the different venders.

Best regards,

Waldo

> On 13 Dec 2017, at 20:32, Daniel Schepler <***@scalable-networks.com> wrote:
>
> You would need to set the INSTALL_RPATH property of the targets to something like "$ORIGIN/../lib" .
>
> You might also need to add "-Wl,--disable-new-dtags" to the CMAKE_*_LINK_FLAGS variables - otherwise, the RPATH settings will only take effect for direct dependencies of the executables (and any plugins or shared libraries) you build but not for dependencies of these dependencies.
>
> (We also tend not to include copies of glibc or OpenGL libraries - for the former, that tends to have issues if there are any mismatches between the exact build of glibc included in the installer and the NSS modules from the system. For the latter, the OpenGL libraries vary too much between Mesa and the NVidia and AMD proprietary driver versions for any one of them to work on all systems.)
> --
> Daniel Schepler
> From: CMake [cmake-***@cmake.org] on behalf of Waldo Valenzuela via CMake [***@cmake.org]
> Sent: Wednesday, December 13, 2017 11:15 AM
> To: Miklos Espak
> Cc: ***@cmake.org
> Subject: Re: [CMake] CMake fixup_bundle for ubuntu 16.04
>
> Dear Miklos,
>
> thanks for the email, and your suggestions, but the problem with fixup_bundle in ubuntu is that is not fixing the libraries locations from the executables meaning:
>
> if I execute the idd command like this “ idd ./app” where “app” is the executable, the locations of the library is still is “no found", that should be in the location that was copy after running the INSTALL.
>
> when you set LD_LIBRARY_PATH is for a temporally solution, or permanent if I modified the environment configuration of O.S.. The idea is that I want to create a standalone application.
>
> Under this scenario, if I have an executable called “app” and a shared library call “lib.so”, fixup_bundle should fix the location of the “lib.so” in the same folder where is “app”.
>
> Then if I run the command "idd ./app” the output should be:
>
> lib.so => “xxxx”, where xxxx is folder where is located “app"
>
> Cheers,
>
> Waldo.
>
>
>> On 13 Dec 2017, at 03:58, Miklos Espak <***@gmail.com <mailto:***@gmail.com>> wrote:
>>
>> Hi,
>>
>> you need to add the directory where the Qt libs have been installed (along with your application binaries) to the LD_LIBRARY_PATH. In your case it is '/home/waldo/Developer/install/Release/bratumia/bin/', as I see.
>>
>> Also, you do *not* need to add the Qt plugin directories to the library path. The plugins are loaded at run-time. So that they can be found, you need to install a qt.conf file in the bin directory with the following contents:
>>
>> [Paths]
>> Prefix=.
>>
>> You also do *not* need to add "/usr/lib" and "/usr/lib/x86-..." to the library path. These libraries are searched for by default. If you did it because your Qt installation is there, that's wrong. The fixup_bundle function should have copied the necessary Qt libs in the install bin folder, so you just need to add that folder to the path.
>>
>> Also, make sure that the DIRS variable contains all the directories where there are libraries to install, including dependencies.
>>
>> I hope that helps.
>>
>> Best regards,
>> Miklos
>>
>>
>>
>> On 11 December 2017 at 19:07, Waldo Valenzuela via CMake <***@cmake.org <mailto:***@cmake.org>> wrote:
>> Dear All,
>>
>> I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and Mac no problem to created the standalone app, but in Ubuntu 16.04 I have several problems.
>>
>> I am using CodeBlocks to compile and run the app, and from CodeBlocks when I run the app there is no problem, it work normally like in windows and mac, but after run the installation, and If I want to run the app from the installation folder (./app ) I have several problems.
>>
>>
>> the CMakeList.txt is
>>
>> FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>> FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>>
>> SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})
>>
>> MESSAGE("Project libraries: ${QTPLUGINS}")
>>
>>
>> INSTALL(CODE "
>> INCLUDE(BundleUtilities)
>> FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
>> "
>> COMPONENT ${PROJECT_NAME})
>>
>> First I have this:
>>
>> -- fixup_bundle: fixing...
>> -- 132/260: fix-up not required on this platform '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
>> -- 133/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Core.so.5'
>> -- 134/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Gui.so.5’
>>
>> -- 167/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
>> -- 168/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
>> -- 169/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1
>>
>> then when I run: ldd ./app I have:
>>
>> libQt5Concurrent.so.5 => not found
>> libvtkRenderingImage-9.0.so.1 => not found
>> libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found
>>
>> then if I fix manually the path of the libraries like this:
>>
>> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/waldo/app/bin/plugins/platforms"
>>
>> I can run the application from through the command line from the installation folder, but I have this message and I can not see nothing
>>
>> QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
>> QOpenGLWidget: Failed to create context
>> composeAndFlush: makeCurrent() failed
>>
>>
>> I think that the FIXUP_BUNDLE is doing nothing.
>>
>> Any help is welcome.
>>
>> Best regards,
>>
>> Waldo.
>> --
>>
>> Powered by www.kitware.com <http://www.kitware.com/>
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <http://www.cmake.org/Wiki/CMake_FAQ>
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html <http://cmake.org/cmake/help/support.html>
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
>> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake <http://public.kitware.com/mailman/listinfo/cmake>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
Konstantin Tokarev
2017-12-14 10:17:15 UTC
Permalink
13.12.2017, 23:08, "Daniel Schepler" <***@scalable-networks.com>:
> You would need to set the INSTALL_RPATH property of the targets to something like "$ORIGIN/../lib" .
>
> You might also need to add "-Wl,--disable-new-dtags" to the CMAKE_*_LINK_FLAGS variables - otherwise, the RPATH settings will only take effect for direct dependencies of the executables (and any plugins or shared libraries) you build but not for dependencies of these dependencies.
>
> (We also tend not to include copies of glibc or OpenGL libraries - for the former, that tends to have issues if there are any mismatches between the exact build of glibc included in the installer and the NSS modules from the system.  For the latter, the OpenGL libraries vary too much between Mesa and the NVidia and AMD proprietary driver versions for any one of them to work on all systems.)

Note that if your application loads at least one library from the host system, you must use system libc.

(Also, bundling libc requires rewriting of loader (INTERP ELF header), it can be done with patchelf --set-interpreter)

> --
> Daniel Schepler
> ----------------------------------------
> From: CMake [cmake-***@cmake.org] on behalf of Waldo Valenzuela via CMake [***@cmake.org]
> Sent: Wednesday, December 13, 2017 11:15 AM
> To: Miklos Espak
> Cc: ***@cmake.org
> Subject: Re: [CMake] CMake fixup_bundle for ubuntu 16.04
>
> Dear Miklos,
>
> thanks for the email, and your suggestions, but the problem with fixup_bundle in ubuntu is that is not fixing the libraries locations from the executables meaning:
>
> if I execute the idd command like this “ idd ./app” where “app” is the executable, the locations of the library is still is “no found", that should be in the location that was copy after running the INSTALL.
>
> when you set LD_LIBRARY_PATH is for a temporally solution, or permanent if I modified the environment configuration of O.S.. The idea is that I want to create a standalone application.
>
> Under this scenario, if I have an executable called “app” and a shared library call “lib.so”, fixup_bundle should fix the location of the “lib.so” in the same folder where is “app”.
>
> Then if I run the command "idd ./app” the output should be:
>
> lib.so => “xxxx”, where xxxx is folder where is located “app"
>
> Cheers,
>
> Waldo.
>
>> On 13 Dec 2017, at 03:58, Miklos Espak <***@gmail.com> wrote:
>>
>> Hi,
>>
>> you need to add the directory where the Qt libs have been installed (along with your application binaries) to the LD_LIBRARY_PATH. In your case it is '/home/waldo/Developer/install/Release/bratumia/bin/', as I see.
>>
>> Also, you do *not* need to add the Qt plugin directories to the library path. The plugins are loaded at run-time. So that they can be found, you need to install a qt.conf file in the bin directory with the following contents:
>>
>> [Paths]
>> Prefix=.
>>
>> You also do *not* need to add "/usr/lib" and "/usr/lib/x86-..." to the library path. These libraries are searched for by default. If you did it because your Qt installation is there, that's wrong. The fixup_bundle function should have copied the necessary Qt libs in the install bin folder, so you just need to add that folder to the path.
>>
>> Also, make sure that the DIRS variable contains all the directories where there are libraries to install, including dependencies.
>>
>> I hope that helps.
>>
>> Best regards,
>> Miklos
>>
>> On 11 December 2017 at 19:07, Waldo Valenzuela via CMake <***@cmake.org> wrote:
>>> Dear All,
>>>
>>> I am working on a multi-platform desktop app with Qt5-VTK8, on Windows and Mac no problem to created the standalone app, but in Ubuntu 16.04  I have several problems.
>>>
>>> I am using CodeBlocks to compile and run the app, and from CodeBlocks when I run the app there is no problem, it work normally like in windows and mac, but after run the installation, and If I want to run the app from the installation folder (./app ) I have several problems.
>>>
>>> the CMakeList.txt is
>>>
>>> FILE(GLOB_RECURSE QTPLUGINS_IMAGEFORMATS ${QT_BASE_DIRECTORY}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>>> FILE(GLOB_RECURSE QTPLUGINS_PLATFORMS ${QT_BASE_DIRECTORY}/plugins/platforms/*${CMAKE_SHARED_LIBRARY_SUFFIX})
>>>
>>> SET(QTPLUGINS ${QTPLUGINS_IMAGEFORMATS} ${QTPLUGINS_PLATFORMS})
>>>
>>> MESSAGE("Project libraries: ${QTPLUGINS}")
>>>
>>> INSTALL(CODE "
>>>         INCLUDE(BundleUtilities)
>>>         FIXUP_BUNDLE(\"${APPS}\" \"${QTPLUGINS}\" \"${DIRS}\")
>>>              "
>>>         COMPONENT ${PROJECT_NAME})
>>>
>>> First I have this:
>>>
>>> -- fixup_bundle: fixing...
>>> -- 132/260: fix-up not required on this platform '/home/waldo/Developer/Qt/5.6.3/gcc_64/plugins/imageformats/libqicns.so'
>>> -- 133/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Core.so.5'
>>> -- 134/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libQt5Gui.so.5’
>>>
>>> -- 167/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKEXPAT-4.13.so.1'
>>> -- 168/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBMP-4.13.so.1'
>>> -- 169/260: fix-up not required on this platform '/home/waldo/Developer/install/Release/bratumia/bin/libITKIOBioRad-4.13.so.1
>>>
>>> then when I run: ldd ./app I have:
>>>
>>>         libQt5Concurrent.so.5 => not found
>>>         libvtkRenderingImage-9.0.so.1 => not found
>>>         libvtkRenderingVolumeOpenGL2-9.0.so.1 => not found
>>>
>>> then if I fix manually the path of the libraries like this:
>>>
>>> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib:/usr/lib/x86_64-linux-gnu:/home/waldo/app/bin/plugins/imageformats:/home/waldo/app/bin/plugins/platforms"
>>>
>>> I can run the application from through the command line from the installation folder, but I have this message and I can not see nothing
>>>
>>> QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
>>> QOpenGLWidget: Failed to create context
>>> composeAndFlush: makeCurrent() failed
>>>
>>> I think that the FIXUP_BUNDLE is doing nothing.
>>>
>>> Any help is welcome.
>>>
>>> Best regards,
>>>
>>> Waldo.
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/cmake
> ,--
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


-- 
Regards,
Konstantin
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://pub
Loading...