Page 1 of 1

nrnivmodl failing with duplicate definition of setstate

Posted: Thu Aug 01, 2013 9:11 pm
by huguenard
Hi,

This is on Centos 5.9 x86_64 with nrn-7.3 and iv-1.8. When we run nrnivmodl we get the following error in which setstate, which is created in the Ih.c file created from Ih.mod, is a duplicate function name declared in stdlib.h. Any help?

ampa.mod Ih.mod ITGHK.mod
ampa.mod Ih.mod ITGHK.mod
"/usr/local/nrn/share/nrn/libtool" --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I"/usr/local/nrn/include/nrn" -I"/usr/local/nrn/x86_64/lib" -g -O2 -c -o Ih.lo `test -f 'Ih.c' || echo '/'`Ih.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/nrn/include/nrn -I/usr/local/nrn/x86_64/lib -g -O2 -c Ih.c -fPIC -DPIC -o .libs/Ih.o
Ih.c:264: error: conflicting types for 'setstate'
/usr/include/stdlib.h:459: error: previous declaration of 'setstate' was here
make: *** [Ih.lo] Error 1
John H.

Re: nrnivmodl failing with duplicate definition of setstate

Posted: Thu Aug 01, 2013 9:46 pm
by ted
If "setstate" is a name defined in the NMODL file, the easy fix is to change it to something else. If not, send me the mod file so I can reproduce the problem and give you more specific advice.
ted dot carnevale at yale dot edu

PS--I coudn't find an Ih.mod in ModelDB that contains a "setstate" so I downloaded an Ih.mod selected at random, verified that nrnivmodl compiled it nicely, then changed the name of the block called by the SOLVE statement to setstate
i.e. made these substitutions

Code: Select all

:       SOLVE ihkin METHOD sparse
        SOLVE setstate METHOD sparse
and

Code: Select all

: KINETIC ihkin {
KINETIC setstate {
and sure enough, nrnivmodl complained

Code: Select all

error: conflicting types for ‘setstate’
/usr/include/stdlib.h:341: note: previous declaration of ‘setstate’ was here
make: *** [Ihx.lo] Error 1
So it is reasonable to expect that changing "setstate" in your mod file to some other name is a likely workaround. This particular mod file probably used the name ihkin because it's a KINETIC block. By analogy if it were a DERIVATIVE block one might have called it ihde or even ihderiv, either of which seems likely to be acceptable to compilation via nrnivmodl.

Re: nrnivmodl failing with duplicate definition of setstate

Posted: Fri Aug 02, 2013 12:55 am
by huguenard
Thanks Ted!

That fixed it. I renamed the function setstate2 within the mod file and bobs your uncle

john

Re: nrnivmodl failing with duplicate definition of setstate

Posted: Fri Aug 02, 2013 10:08 am
by ted
Thanks for using NEURON in your research!