Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Hi, I developed a c++ program on a centos(Red-Hat based) computer which I'm trying to run on a Voyage-Linux(Debian-based) computer. The program compiles and runs fine on my centos. It ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    72

    Floating point exception / Compiling a c++ program

    Hi,

    I developed a c++ program on a centos(Red-Hat based) computer which I'm trying to run on a Voyage-Linux(Debian-based) computer.

    The program compiles and runs fine on my centos. It also runs fine on my iMedia embedded linux computer.

    On the Voyage-Linux when I run the program it says
    Code:
    Floating Point Exception
    I figured I needed to compile my program on my Voyage-Linux but I have no graphic tools to do so and I'm not quite sure how to do it "by hand".

    I was able to do it with a simple hello world program which is only 1 cpp file by doing
    Code:
    gcc helloworld.cpp -o helloworld
    , but my project has several cpp and h files and I havn't found a lot of information about accomplishing that kind of task.

    Am I heading in the correct direction?
    If so how should I do it?
    If not what else could be done?

    Thanks.

    Olivier.

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    How are you building it on your centos computer? The defacto standard is to use makefile's. I'm going to go out on a limb here and guess your voyage linux and centos computers are running different processor architectures, which would explain why the binary wouldn't just run (assuming all the required libs are there too)

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    I'm using KDevelop on my Centos to develop, and the "build project" menu option does it all for you. I believe it runs automake, configure and compiles the project.

    I'm not sure about the processors but the programs ran fine with my iMedia distro on the same machine I'm using for the Voyage distro.

    I'm pretty sure all the libraries are there since I installed the build-essential package.

    I know there are Makefiles involved but I don't know how to generate them or do what in what order...

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    i will simplify my question, is the voyage distro 32 or 64 bit? and what is the centos?

  5. #5
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    Both 32 bit

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I assume you simply copied the executable to the new system? If so, then it is likely that your shared libraries are not compatible, unless you built it statically (no shared libraries).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    You are right I just copied the executables.

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by olacelle View Post
    You are right I just copied the executables.
    Then you likely have an incompatibillity with the shared libraries used. In order to get an executable to run on systems other than ones very closely compatible with the one you built it on, then you need to tell the linker to do static linking so that shared libraries are not used. In such a case, as long as the kernel versions of the systems are close, then you should be ok. The resulting executable will be larger, but it will run on more target systems.

    Normally, people build the software on the target system in order to avoid this situation.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    I don't know how to do static linking but I'll see what I can figure out.

    As far as building the software on the target system which I was able to do it but that is a challenge for me too.

    Thanks for the info.

  10. #10
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    which I think brings us back to OP's other question, which was how to build the application on this machine. I'm surprised if kdevelop does all those other things for you that there isn't some way to generate a makefile for it or a configure script, etc.

Page 1 of 2 1 2 LastLast

Posting Permissions

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