Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:45:39+00:00 2026-05-26T22:45:39+00:00

I have got a Qt project which I am configuring and building using CMake.

  • 0

I have got a Qt project which I am configuring and building using CMake. When I just type “make” to build the app, it creates an app in my build directory and all works fine. However, when I type “make install” to install into a release directory, the resulting executable won’t run because it can’t find shared libraries. I get an error saying:

release/testapp: error while loading shared libraries: libQtGui.so.4: cannot open shared     object file: No such file or directory

What is “make install” doing to the executable? I thought it would just copy the file it must be doing something to the file. I am trying to execute both files from the same terminal so my environment is the same.

Here is the output from ldd on the executable in the release directory (generated from “make install”):

    libQtGui.so.4 => not found
    libQtCore.so.4 => not found
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00906000)
    libm.so.6 => /lib/tls/libm.so.6 (0x00695000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x008fa000)
    libc.so.6 => /lib/tls/libc.so.6 (0x00567000)
    /lib/ld-linux.so.2 (0x00548000)

Whereas if I run ldd on the executable in the build directory (created from “make”) it outputs the following:

    libQtGui.so.4 => /usr/local/Trolltech/Qt-4.7.3/lib/libQtGui.so.4 (0x00560000)
    libQtCore.so.4 => /usr/local/Trolltech/Qt-4.7.3/lib/libQtCore.so.4 (0x00111000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x003ec000)
    libm.so.6 => /lib/tls/libm.so.6 (0x004b7000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x004da000)
    libc.so.6 => /lib/tls/libc.so.6 (0x033fe000)
    libpthread.so.0 => /lib/tls/libpthread.so.0 (0x004e4000)
    libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x004f6000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x02e76000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x004fa000)
    libz.so.1 => /usr/lib/libz.so.1 (0x0051e000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x02df6000)
    libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x0052e000)
    libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x022ac000)
    libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x00537000)
    libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x02442000)
    libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x0218a000)
    libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x03937000)
    libdl.so.2 => /lib/libdl.so.2 (0x0053f000)
    librt.so.1 => /lib/tls/librt.so.1 (0x02238000)
    /lib/ld-linux.so.2 (0x00548000)
    libexpat.so.0 => /usr/lib/libexpat.so.0 (0x02377000)

Here is the CMakeLists.txt file used to create these files:

# CMakeLists.txt

cmake_minimum_required(VERSION 2.8)

project(testapp)

set(CMAKE_VERBOSE_MAKEFILE OFF)

find_package(Qt4 REQUIRED)

set (CMAKE_C_FLAGS "-m32 -g")
set (CMAKE_CXX_FLAGS "-m32 -g")
set (CMAKE_INSTALL_PREFIX release)  

set(PROGNAME testapp)

add_definitions(-Wall)

set(testapp_SRCS
  main.cpp
  testapp.cpp
)

set(testapp_MOC_HDRS
  testapp.h
)

set(QT_USE_QTGUI TRUE)

include(${QT_USE_FILE})

include_directories(
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)

qt4_wrap_cpp(testapp_MOC_SRCS ${testapp_MOC_HDRS})

add_executable(${PROGNAME}
  ${testapp_SRCS}
  ${testapp_MOC_SRCS}
)

target_link_libraries(${PROGNAME}
  ${QT_LIBRARIES}
)

install(TARGETS ${PROGNAME} DESTINATION .)

It’s probably just something silly but why does the executable from “make” work but “make install” give an error? The files are both the same size.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:45:40+00:00Added an answer on May 26, 2026 at 10:45 pm

    As you have noticed, the CMake make install command strips off non-standard build paths to ensure the executable will use the system libraries and work on any system it is deployed on.

    You need to either install Qt into the standard library folders, or add the folder into the system library paths.

    To do the latter, create a file qt4.7.conf in /etc/ld.so.conf.d with a single line of /usr/local/Trolltech/Qt-4.7.3/lib . Then run ldconfig to build the library cache. Run ldd again to check this has worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just got a task in a new project which is implemented using
I have this huge VB project which i just got from some one. i
I've been thrown a project which I have to say I've not got the
I have got involved in a project. This project uses ant which is not
I have asp.net project which has got GridViews, Buttons, Navigators etc... I have 10-15
I have been working with a project which is using grails / hibernate with
I've got a project which is built using Maven and Continuum. We've got several
I have a project which has the following directory structure. root --include ----module1 ----module2
You have a project which has got some SW requirements to run (e.g.: a
While configuring MJAndriod I have got an error as follows: Project has no default.properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.