Reputation: 119
TLDR: Having trouble compiling a C++ program that worked in Centos Redhat in Ubuntu Debian. Is there anything I Should be aware of between these two that would make a C++ program compiled using the same compiler not work?
Hello, I'm trying to compile and run Germline (http://www1.cs.columbia.edu/~gusev/germline/). It works fine in RedHat Centos, but because Centos isn't as supported as Ubuntu is for most things I switched. And now this program does not work. It's entirely possible it's using some kind of RedHat only functionality, but I'm using the same compiler (g++) to compile it in both environments.
I've been pulling my hair out just trying to get this thing to work on Ubuntu as it is much nicer to work with, but as of now when I "make all" the project in ubuntu it will compile and the tests spin(Don't ever finish) forever. No matter what binaries I use (Compiled in Centos and copied, the failed test binaries I just mentioned etc), the program just always freezes.
Kinda long, sorry. My main question is this: Is there any other C++ compiler alternatives I can try? Is there any Red-hat C++ libraries I might be missing. Or major differences in their C++ implementations that mighjt cause this?
Upvotes: 11
Views: 2971
Reputation: 6716
Use of while(!stream.eof())
is a common mistake. If the statement stream.eof()
is true, then it does not necessary mean that the last operation with the stream is successful.
Here are a few bash script to compile the package with GNU g++4.6
:
wget http://www1.cs.columbia.edu/~gusev/germline/germline-1-5-1.tar.gz
tar -xzvf germline-1-5-1.tar.gz
cd germline-1-5-1/
perl -p -i.bak -e's/!stream\.eof\(\)/stream/g' PEDIndividualsExtractor.cpp
perl -p -i.bak -e's/!stream_sample.eof\(\)/stream_sample/g' HMIndividualsExtractor.cpp
make all
cat test/generated.out
Upvotes: 2
Reputation: 5693
make all
as its own step, then check that everything compiled OK.make tests
, then check to see which tests fail.Those are your first steps, and might get you most of the way there.
As PenguinCoder says above, you need to check that the compiler versions are the same between Ubuntu and Redhat. Every time there has been a major version upgrade in gcc
, I have had some (minor) problems.
Upvotes: 1
Reputation: 39
If you only need to use the program on Ubuntu, you can configure the program with --static
to compile a static executable, and then copy the executable to Ubuntu.
Or, you may use ldd
command the find out the .so
files the dynamic executable linked against to and copy these .so
files to the same directory of the dynamic executable, and put them on Ubuntu to run. You can also put the .so
files in another directory and use LD_LIBRARY_PATH
to help the executable find the .so
files.
Upvotes: 0
Reputation: 8866
I took a look at the software. It's input code is a bit fragile, and I'm not certain if Ubuntu or Red Hat's C++ library is buggy in this case, but the program can easily be fixed to work on both.
In the file PEDIndividualsExtractor.cpp
, in the function void PEDIndividuasExtractor::loadInput()
, change the line:
while (!stream.eof() )
to:
while (stream)
and recompile.
Upvotes: 6
Reputation: 179
You should specify what the first error is really, you've not provided enough information to say what the problem is, however I'd guess a missing dependency.
Any decent package comes with a list of dependencies, have you checked for this and checked the requirements are there?
In the absence of a requirements and dependency list, a good rule of thumb in this situation is to check what the very first error is and fix that. For example if the first error says "missing foolib.h" then you need to install "foolib" for that machine.
Upvotes: 1