Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I have just built a small linux c++ console app. I would like to run on a linux server. After installing a few libraries I managed to compile it ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2013
    Posts
    1

    Running c++ console app in linux


    Hi,

    I have just built a small linux c++ console app. I would like to run on a linux server.

    After installing a few libraries I managed to compile it in release mode and work propertly. But I have read (I am not sure because I am a Linux newbie) that perhaps that app does not work in any linux versions. When looking at the dynamic libraries linked to the executable, these ones appears:

    Code:
    linux-gate.so.1 =>  (0x00ccd000)
       libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x00691000)
       libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00cf9000)
       librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x008e6000)
       libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x0069b000)
       libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x007a5000)
       libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x00bbb000)
       libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00110000)
       /lib/ld-linux.so.2 (0x005ad000)
    I am using Ubuntu 12.04. It seems that all of those libraries are system libraries, but I'm not sure. My questions are,

    Will my app run in any version of Linux?
    If not, is there any way to convert those libraries into static mode or should I try anything else?

    I will be very grateful If any one could give me a hint.

    Thanx to all,

    Oscar

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    913
    Generally speaking, if you develop on a major distro such as Ubuntu, the program should work on similar distros that include those libraries. The best way to ensure the end user has to required libraries is to make your code into a package. In Ubuntu, it would be a .deb.

    Most of the libraries on a system are installed from a package. You can figure out what package provides each of those libraries, and then include those packages as a dependency for your package. It's a little more involved than just writing code, and often times if your code is good enough, you can just put it on github and someone else might decide to make a package out of it.

    You can include standard libraries with your code, but generally that is not done, as those libraries might have other dependencies themselves.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •