Page 1 of 1

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

Posted: Wed Jul 23, 2008 2:11 pm
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?

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

Posted: Thu Jul 24, 2008 10:04 am
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.

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

Posted: Thu Jul 24, 2008 10:18 am
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

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

Posted: Fri Jul 25, 2008 9:18 am
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?

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

Posted: Fri Jul 25, 2008 10:56 am
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

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

Posted: Wed Aug 27, 2008 8:55 am
by schmuker
FYI: Same problem on openSUSE 11.0, same solution :)

Cheers,

Michael

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

Posted: Wed Oct 22, 2008 6:06 am
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>

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

Posted: Fri Nov 07, 2008 12:46 pm
by mattions
Confirm the BUG also on Ubuntu 8.10

it seems that if 4.3 is involved the package stop to build :)

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

Posted: Sat Nov 08, 2008 3:27 pm
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.