Compiling on CentOS 6.5 (x86_64)

Discussion of compilation configuration and issues

Compiling on CentOS 6.5 (x86_64)

Postby haisamido » Sun Mar 09, 2014 3:49 pm

Dear GMAT developers,

I'm creating a bash script to help in the compilation of GMAT 2013a (without Matlab) on CentOS 6.5 (x86_64). The script can be found here https://docs.google.com/document/d/1FkTrbbcaXDY_J9DXsNbcnCpb8h5K47URtrg_igVlexM/edit?usp=sharing

I am successful until I execute *make* in the ./gmat-src-R2013a/ directory. How do I resolve this?

Here are the messages:

Code: Select all
cd src; make -f MakeGmat.eclipse all BUILD_64BIT=0; \
   cd ../plugins; make all BUILD_64BIT=0; \

make[1]: Entering directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/src'
cd base; make -f MakeBase.eclipse all
make[2]: Entering directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/src/base'
g++ -O3 -fno-strict-aliasing -ffriend-injection -D__USE_WX280__ -D__USE_WX280_GL__ -DwxUSE_GLCANVAS  -Wall `/home/hido/Desktop/GMAT/downloads/wxGTK-2.8.12/build-gmat/wx-config --cppflags` -I/home/hido/Desktop/GMAT/downloads/cspice//cspice/include -D__USE_SPICE__   -DUSE_64_BIT_LONGS    -fPIC -Iinclude -Ifoundation -Ihardware -Iexecutive -Ievent -Iattitude -Ispacecraft -Iasset -Iforcemodel -Iforcemodel/harmonic -Ipropagator -Isubscriber -Icommand -Isolarsys -Ifactory -Istopcond -Iinterpreter -Iutil -Iinterpolator -Iinterface -Iparameter -Iconfigs -Iburn -Isolver -Ifunction -Icoordsystem -Imath -Iplugin -I../gui/include -I../gui/include/bitmaps -I../gui/app -I../gui/view -I../gui/output -I../gui/foundation -I../gui/subscriber -I../gui/mission  -c -o asset/BodyFixedPoint.o asset/BodyFixedPoint.cpp
In file included from util/SpiceKernelReader.hpp:40,
                 from util/SpiceOrbitKernelReader.hpp:31,
                 from solarsys/CelestialBody.hpp:41,
                 from util/BodyFixedStateConverter.hpp:30,
                 from asset/BodyFixedPoint.hpp:34,
                 from asset/BodyFixedPoint.cpp:36:
util/SpiceInterface.hpp:50:48: error: SpiceUsr.h: No such file or directory
In file included from util/SpiceKernelReader.hpp:40,
                 from util/SpiceOrbitKernelReader.hpp:31,
                 from solarsys/CelestialBody.hpp:41,
                 from util/BodyFixedStateConverter.hpp:30,
                 from asset/BodyFixedPoint.hpp:34,
                 from asset/BodyFixedPoint.cpp:36:
util/SpiceInterface.hpp:83: error: ‘SpiceDouble’ has not been declared
util/SpiceInterface.hpp:84: error: ‘SpiceDouble’ does not name a type
util/SpiceInterface.hpp:94: error: ISO C++ forbids declaration of ‘ConstSpiceChar’ with no type
util/SpiceInterface.hpp:94: error: expected ‘;’ before ‘*’ token
In file included from util/SpiceOrbitKernelReader.hpp:31,
                 from solarsys/CelestialBody.hpp:41,
                 from util/BodyFixedStateConverter.hpp:30,
                 from asset/BodyFixedPoint.hpp:34,
                 from asset/BodyFixedPoint.cpp:36:
util/SpiceKernelReader.hpp:88: error: ISO C++ forbids declaration of ‘ConstSpiceChar’ with no type
util/SpiceKernelReader.hpp:88: error: expected ‘;’ before ‘*’ token
util/SpiceKernelReader.hpp:90: error: ‘SpiceInt’ does not name a type
util/SpiceKernelReader.hpp:92: error: ‘SpiceInt’ does not name a type
util/SpiceKernelReader.hpp:94: error: ‘SpiceDouble’ does not name a type
util/SpiceKernelReader.hpp:96: error: ISO C++ forbids declaration of ‘ConstSpiceChar’ with no type
util/SpiceKernelReader.hpp:96: error: expected ‘;’ before ‘*’ token
In file included from solarsys/CelestialBody.hpp:41,
                 from util/BodyFixedStateConverter.hpp:30,
                 from asset/BodyFixedPoint.hpp:34,
                 from asset/BodyFixedPoint.cpp:36:
util/SpiceOrbitKernelReader.hpp:69: error: ISO C++ forbids declaration of ‘ConstSpiceChar’ with no type
util/SpiceOrbitKernelReader.hpp:69: error: expected ‘;’ before ‘*’ token
util/SpiceOrbitKernelReader.hpp:71: error: ISO C++ forbids declaration of ‘ConstSpiceChar’ with no type
util/SpiceOrbitKernelReader.hpp:71: error: expected ‘;’ before ‘*’ token
util/GmatConstants.hpp:203: warning: ‘GmatMathConstants::QUIET_NAN’ defined but not used
util/GmatConstants.hpp:39: warning: ‘GmatRealConstants::INTEGER_MAX’ defined but not used
make[2]: *** [asset/BodyFixedPoint.o] Error 1
make[2]: Leaving directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/src/base'
make[1]: *** [base/lib/libGmatBase.so] Error 2
make[1]: Leaving directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/src'
make[1]: Entering directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/plugins'
cd CInterfacePlugin; make all BUILD_64BIT=0;
make[2]: Entering directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/plugins/CInterfacePlugin'
cd src; make all
make[3]: Entering directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/plugins/CInterfacePlugin/src'
rm -rf ../lib/libCInterface.so
mkdir -p ../lib
g++ command/PrepareMissionSequence.o factory/CCommandFactory.o plugin/CInterfacePluginFunctions.o -o ../lib/libCInterface.so -shared -Wl -L../../../application/bin -lGmatBase -ldl
/usr/bin/ld: cannot find -lGmatBase
collect2: ld returned 1 exit status
make[3]: *** [../lib/libCInterface.so] Error 1
make[3]: Leaving directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/plugins/CInterfacePlugin/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/plugins/CInterfacePlugin'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/hido/Desktop/GMAT/downloads/gmat-src-R2013a/plugins'
make: *** [all] Error 2
haisamido
 
Posts: 10
Joined: Sun Mar 09, 2014 3:37 pm
Location: Washington, DC

Re: Compiling on CentOS 6.5 (x86_64)

Postby jjkparker » Mon Mar 10, 2014 12:05 am

Looks like GCC isn't finding the SPICE headers.

Have you read through the Building on Linux guide?

http://gmatcentral.org/display/GW/Building+on+Linux

It's a little rough, but it should point you in the right direction.

Joel
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Compiling on CentOS 6.5 (x86_64)

Postby haisamido » Mon Mar 10, 2014 1:43 am

I am following http://gmatcentral.org/display/GW/Building+on+Linux and it's not really sufficient, that why I started by own Google Doc page. I disabled SPICE temporarily and I still get:

Code: Select all
g++ command/PrepareMissionSequence.o factory/CCommandFactory.o plugin/CInterfacePluginFunctions.o -o ../lib/libCInterface.so -shared -Wl -L../../../application/bin -lGmatBase -ldl
/usr/bin/ld: cannot find -lGmatBase
collect2: ld returned 1 exit status


jjkparker wrote:Looks like GCC isn't finding the SPICE headers.

Have you read through the Building on Linux guide?

http://gmatcentral.org/display/GW/Building+on+Linux

It's a little rough, but it should point you in the right direction.

Joel
haisamido
 
Posts: 10
Joined: Sun Mar 09, 2014 3:37 pm
Location: Washington, DC

Re: Compiling on CentOS 6.5 (x86_64)

Postby jjkparker » Mon Mar 10, 2014 1:33 pm

Hmm, I'm not quite sure what the answer is to that one.

I'm guessing something's wrong with the -L../../../application/bin line though, so it's not finding libGmatBase.so. Maybe this should be a different path, since you're compiling 64-bit? Either way, it sounds like an issue with the Makefile itself.

I'm not really the Linux build guy though, so maybe someone else will have a better idea.

EDIT: If you are building in 64-bit mode, maybe try 32-bit mode instead. We don't build in 64-bit as a matter of course, so there's likely issues there.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Compiling on CentOS 6.5 (x86_64)

Postby jjkparker » Tue Mar 11, 2014 5:49 pm

A small correction: our team does build regularly on 64-bit Linux, but the standard disclaimer applies that we're mainly tested and maintained as a 32-bit Windows app.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Compiling on CentOS 6.5 (x86_64)

Postby haisamido » Tue Mar 11, 2014 5:49 pm

I was able to find a problem in the path defined for lib. It's missing /src/. When I did that I get these errors:

Code: Select all
g++ driver.o ConsoleAppException.o PrintUtility.o ConsoleMessageReceiver.o -L../../application/bin -lGmatBase -O3 -fno-strict-aliasing -ffriend-injection    -o GmatConsole -L../..[b]/src/[/b]base/lib -lgfortran -ldl 
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `splint_':
msise90_sub.c:(.text+0xef7): undefined reference to `s_wsle'
msise90_sub.c:(.text+0xf16): undefined reference to `do_lio'
msise90_sub.c:(.text+0xf1b): undefined reference to `e_wsle'
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `dnet_':
msise90_sub.c:(.text+0x1a71): undefined reference to `s_wsle'
msise90_sub.c:(.text+0x1a90): undefined reference to `do_lio'
msise90_sub.c:(.text+0x1aab): undefined reference to `do_lio'
msise90_sub.c:(.text+0x1ac6): undefined reference to `do_lio'
msise90_sub.c:(.text+0x1ae1): undefined reference to `do_lio'
msise90_sub.c:(.text+0x1ae6): undefined reference to `e_wsle'
msise90_sub.c:(.text+0x1c36): undefined reference to `pow_dd'
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `densu_':
msise90_sub.c:(.text+0x224e): undefined reference to `pow_dd'
msise90_sub.c:(.text+0x239c): undefined reference to `pow_dd'
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `tselec_0_':
msise90_sub.c:(.text+0x3488): undefined reference to `r_mod'
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `globe6_':
msise90_sub.c:(.text+0x4e1b): undefined reference to `pow_dd'
msise90_sub.c:(.text+0x546d): undefined reference to `pow_dd'
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `gts6_0_':
msise90_sub.c:(.text+0x67f5): undefined reference to `r_mod'
msise90_sub.c:(.text+0x69a4): undefined reference to `s_wsfe'
msise90_sub.c:(.text+0x69bd): undefined reference to `do_fio'
msise90_sub.c:(.text+0x69c2): undefined reference to `e_wsfe'
../../src/base/lib/libGmatBase.a(msise90_sub.o): In function `ghp6_':
msise90_sub.c:(.text+0x9abc): undefined reference to `r_lg10'
msise90_sub.c:(.text+0x9b79): undefined reference to `r_lg10'
msise90_sub.c:(.text+0xa088): undefined reference to `s_wsfe'
msise90_sub.c:(.text+0xa0a1): undefined reference to `do_fio'
msise90_sub.c:(.text+0xa0b9): undefined reference to `do_fio'
msise90_sub.c:(.text+0xa0be): undefined reference to `e_wsfe'
collect2: ld returned 1 exit status



jjkparker wrote:Hmm, I'm not quite sure what the answer is to that one.

I'm guessing something's wrong with the -L../../../application/bin line though, so it's not finding libGmatBase.so. Maybe this should be a different path, since you're compiling 64-bit? Either way, it sounds like an issue with the Makefile itself.

I'm not really the Linux build guy though, so maybe someone else will have a better idea.

EDIT: If you are building in 64-bit mode, maybe try 32-bit mode instead. We don't build in 64-bit as a matter of course, so there's likely issues there.
haisamido
 
Posts: 10
Joined: Sun Mar 09, 2014 3:37 pm
Location: Washington, DC

Re: Compiling on CentOS 6.5 (x86_64)

Postby jjkparker » Wed Mar 12, 2014 2:23 pm

From one of our developers:

These are the f2c library functions. They are provided either by the SPICE library (cspice.a) or, if building without SPICE, by linking against libf2c by adding -lf2c to the linker settings (basically right after -ldl on the line below). The machine has to have f2c installed, of course.

Code: Select all
g++ driver.o ConsoleAppException.o PrintUtility.o ConsoleMessageReceiver.o -L../../application/bin -lGmatBase -O3 -fno-strict-aliasing -ffriend-injection    -o GmatConsole -L../../src/base/lib -lgfortran -ldl 
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Compiling on CentOS 6.5 (x86_64)

Postby haisamido » Wed Mar 12, 2014 3:35 pm

Please look at https://docs.google.com/document/d/1FkT ... sp=sharing to see how I installed everything, including f2c and SPICE. I already provided that link in my initial posting.

jjkparker wrote:From one of our developers:

These are the f2c library functions. They are provided either by the SPICE library (cspice.a) or, if building without SPICE, by linking against libf2c by adding -lf2c to the linker settings (basically right after -ldl on the line below). The machine has to have f2c installed, of course.

Code: Select all
g++ driver.o ConsoleAppException.o PrintUtility.o ConsoleMessageReceiver.o -L../../application/bin -lGmatBase -O3 -fno-strict-aliasing -ffriend-injection    -o GmatConsole -L../../src/base/lib -lgfortran -ldl 
haisamido
 
Posts: 10
Joined: Sun Mar 09, 2014 3:37 pm
Location: Washington, DC

Re: Compiling on CentOS 6.5 (x86_64)

Postby jjkparker » Thu Mar 13, 2014 1:04 pm

Looks like you might need to swap F2CFLAGS in BuildEnv.mk so that it adds -lf2c. That's just a guess, though. Look around line 124.

Either way, you need to have -lf2c in your compiler command.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: Compiling on CentOS 6.5 (x86_64)

Postby haisamido » Thu Mar 27, 2014 5:56 pm

I just discovered one problem. ./src/base/util/FileUtil.cpp (line 181) is using std::min which does not exist in stdlib.h on Linux. That's an MS Windows function. Subsequently libGmatBase.a is not made.

Here's the culprit:

Code: Select all
int bytes = std::min(readlink(szTmp, buffer, GmatFile::MAX_PATH_LEN),
                   GmatFile::MAX_PATH_LEN - 1);

A min capability needs to be which is independent of the operating system, perhaps this way:

Code: Select all
   
   int _a = readlink(szTmp, buffer, GmatFile::MAX_PATH_LEN);
   int _b = GmatFile::MAX_PATH_LEN - 1;   
   int bytes = ( _a < _b ? _a : _b );


jjkparker wrote:Looks like you might need to swap F2CFLAGS in BuildEnv.mk so that it adds -lf2c. That's just a guess, though. Look around line 124.

Either way, you need to have -lf2c in your compiler command.
haisamido
 
Posts: 10
Joined: Sun Mar 09, 2014 3:37 pm
Location: Washington, DC

Next

Return to Compiling GMAT

Who is online

Users browsing this forum: No registered users and 1 guest