IV Build Fails at OS/math.cpp on Fedora 9

Post Reply
Kevin_Hobbs

IV Build Fails at OS/math.cpp on Fedora 9

Post by Kevin_Hobbs »

Building iv on this computer fails in the lib directory ~/neuron/iv/src/lib. When I run make in that directory I get :

[kevin@murron lib]$ make
g++ -DHAVE_CONFIG_H -I. -I. -I../include -g -O2 -c OS/math.cpp -fPIC -DPIC -o OS/.libs/math.o
OS/math.cpp: In static member function 'static int osMath::abs(int)':
OS/math.cpp:42: error: '::abs' has not been declared
make: *** [OS/math.lo] Error 1

I got rid of the :: and the build is able to continue.

My knowledge of C++ is limited, and does not include what name space is meant by
a scope resolution operator with no name space. If that is the correct jargon.

Is this just GCC-4.3.0 being even more picky than previous versions?
Kevin_Hobbs

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by Kevin_Hobbs »

Throwing in an #include <stdlib.h> to src/lib/OS/math.cpp also lets iv build.

I heard on the ParaView mailing list that many things suddenly require stdlib.h with gcc-4.3.
Kevin_Hobbs

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by Kevin_Hobbs »

I also get the error below when trying to build nrn

mpic++ -Dmotif_kit -Dsgi_motif_kit -Dopenlook_kit -Dbw_kit -Ddefault_kit=SMFKit
-DUSEGNU=1 -DUSEMATRIX -I. -I. -I../.. -I../.. -I../.. -I../../src/oc -I../../s
rc/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/
ivos -I../../src/sundials -I../../src/nrnpython -I../../src/gnu -I../../src/mesc
h -I../../src/oc -I../../src/oc -I/opt/iv-17/include -g -O2 -MT ivocrand.lo -MD
-MP -MF .deps/ivocrand.Tpo -c ivocrand.cpp -fPIC -DPIC -o .libs/ivocrand.o
In file included from ivocrand.cpp:12:
../../src/oc/nrnisaac.h:12: error: 'u_int32_t' does not name a type
ivocrand.cpp: In member function 'virtual _G_uint32_t Isaac64::asLong()':
ivocrand.cpp:104: error: 'nrnisaac_uint32_pick' was not declared in this scope
hines
Site Admin
Posts: 1603
Joined: Wed May 18, 2005 3:32 pm

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by hines »

Does the latter also disappear when you explicitly add a
#include <stdlib.h>
to the ivocrand.cpp file above the include of nrnisaac.h?
Kevin_Hobbs

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by Kevin_Hobbs »

Oooo, that works too. I got it to build by explicitly declaring the type.

All in all the changes required to build on Fedora 9 were to add an include of stdlib.h to :

./iv/src/lib/OS/math.cpp
./nrn/src/ivoc/ivocrand.cpp
./nrn/src/ivoc/strfun.cpp
./nrn/src/nrniv/netpar.cpp
schmuker
Posts: 11
Joined: Wed Aug 22, 2007 8:18 am
Location: Brighton, UK
Contact:

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by schmuker »

FYI: Same problem on openSUSE 11.0, same solution :)

Cheers,

Michael
csh
Posts: 52
Joined: Mon Feb 06, 2006 12:45 pm
Location: University College London
Contact:

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by csh »

I had to include stdlib.h in src/nrncvode/netcvode.cpp in addition to the files mentioned above on my system (gcc 4.3.2). Here is the patch against hg changeset 210:

Code: Select all

diff -r 482ea9727cc4 src/ivoc/ivocrand.cpp
--- a/src/ivoc/ivocrand.cpp	Mon Oct 20 14:36:51 2008 -0400
+++ b/src/ivoc/ivocrand.cpp	Wed Oct 22 12:03:52 2008 +0200
@@ -3,6 +3,7 @@
 // definition of random number generation from the g++ library
 
 #include <stdio.h>
+#include <stdlib.h>
 #include "random1.h"
 
 #include <InterViews/resource.h>
diff -r 482ea9727cc4 src/ivoc/strfun.cpp
--- a/src/ivoc/strfun.cpp	Mon Oct 20 14:36:51 2008 -0400
+++ b/src/ivoc/strfun.cpp	Wed Oct 22 12:03:52 2008 +0200
@@ -2,6 +2,7 @@
 #include <OS/string.h>
 #include <InterViews/regexp.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include "classreg.h"
 #include "oc2iv.h"
 #include <string.h>
diff -r 482ea9727cc4 src/nrncvode/netcvode.cpp
--- a/src/nrncvode/netcvode.cpp	Mon Oct 20 14:36:51 2008 -0400
+++ b/src/nrncvode/netcvode.cpp	Wed Oct 22 12:03:52 2008 +0200
@@ -5,6 +5,7 @@
 
 #include <nrnmpi.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <time.h>
 #include <InterViews/resource.h>
 #include <OS/list.h>
diff -r 482ea9727cc4 src/nrniv/netpar.cpp
--- a/src/nrniv/netpar.cpp	Mon Oct 20 14:36:51 2008 -0400
+++ b/src/nrniv/netpar.cpp	Wed Oct 22 12:03:52 2008 +0200
@@ -1,6 +1,7 @@
 #include <../../nrnconf.h>
 #include <nrnmpi.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <math.h>
 #include <InterViews/resource.h>
 #include <nrnoc2iv.h>
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by mattions »

Confirm the BUG also on Ubuntu 8.10

it seems that if 4.3 is involved the package stop to build :)
hines
Site Admin
Posts: 1603
Joined: Wed May 18, 2005 3:32 pm

Re: IV Build Fails at OS/math.cpp on Fedora 9

Post by hines »

Thanks everyone. I installed gcc-4.3.2, saw all the problems and that stdlib.h fixed them and committed to the
hg repository.
Post Reply