Static NEURON build

Anything that doesn't fit elsewhere.
Post Reply
stephanmg
Posts: 68
Joined: Tue Jul 03, 2012 4:40 am

Static NEURON build

Post by stephanmg » Thu Jun 26, 2014 3:57 am

Dear NEURON users,

if i compile my NEURON from source, i arrive at many shared libraries (.dylib or .so).

In principle I need to have a static build, let's say, "libNEURON.a", since otherwise on different machines the dynamically linked libraries won't get found.

Is there a way to accomplish a pure static build of NEURON?

If i specify --enable-static i still arrive at .dylib and .so files (Mac respectively Unix) - what's the matter?

Find attached my configure.log from the configure process: http://nopaste.info/0fe449ffac.html

Best,
Stephan

stephanmg
Posts: 68
Joined: Tue Jul 03, 2012 4:40 am

Re: Static NEURON build

Post by stephanmg » Thu Jun 26, 2014 5:36 am

Okay, i managed to compile it by following the thread of:
http://www.neuron.yale.edu/phpbb/viewto ... f=8&t=2638

But still I get linking errors afterwards:

Undefined symbols for architecture x86_64:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<SelfEventPPTable_Entry, std::__1::allocator<SelfEventPPTable_Entry> >::__append(unsigned long) in libnrniv.a(netcvode.o)
std::__1::vector<MultiSplitTable_Entry, std::__1::allocator<MultiSplitTable_Entry> >::__append(unsigned long) in libnrniv.a(multisplit.o)
std::__1::vector<Int2IntTable_Entry, std::__1::allocator<Int2IntTable_Entry> >::__append(unsigned long) in libnrniv.a(multisplit.o)
std::__1::vector<MapNode2PDbl_Entry, std::__1::allocator<MapNode2PDbl_Entry> >::__append(unsigned long) in libnrniv.a(partrans.o)
std::__1::vector<MapInt2Int_Entry, std::__1::allocator<MapInt2Int_Entry> >::__append(unsigned long) in libnrniv.a(partrans.o)
void std::__1::vector<int, std::__1::allocator<int> >::__push_back_slow_path<int const>(int const&) in libivoc.a(ocmatrix.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
MechanismStandard::save(char const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
MechanismStandard::save(char const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libivos.a(regexp.o)
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libnrniv.a(nrnmenu.o)
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libneuron_gnu.a(Complex.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libivos.a(regexp.o)
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libnrniv.a(nrnmenu.o)
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libneuron_gnu.a(Complex.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::get()", referenced from:
operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, Complex&) in libneuron_gnu.a(Complex.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_istream<char, std::__1::char_traits<char> >&, bool)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, char&) in libneuron_gnu.a(Complex.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::putback(char)", referenced from:
operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, Complex&) in libneuron_gnu.a(Complex.o)
"std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(double&)", referenced from:
operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, Complex&) in libneuron_gnu.a(Complex.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
MechanismStandard::save(char const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in libnrniv.a(nrnmenu.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
MechanismStandard::save(char const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in libnrniv.a(nrnmenu.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(double)", referenced from:
operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Complex const&) in libneuron_gnu.a(Complex.o)
"std::__1::cerr", referenced from:
regcomp(char const*) in libivos.a(regexp.o)
regexec(regexp*, char*) in libivos.a(regexp.o)
regmatch(char*) in libivos.a(regexp.o)
reg(int, int*) in libivos.a(regexp.o)
regbranch(int*) in libivos.a(regexp.o)
regatom(int*) in libivos.a(regexp.o)
default_Complex_error_handler(char const*) in libneuron_gnu.a(Complex.o)
...
"std::__1::ctype<char>::id", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
MechanismStandard::save(char const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
MechanismStandard::save(char const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, char&) in libneuron_gnu.a(Complex.o)
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libivos.a(regexp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libnrniv.a(nrnmenu.o)
operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, Complex&) in libneuron_gnu.a(Complex.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libneuron_gnu.a(Complex.o)
std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::operator>><char, std::__1::char_traits<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, char&) in libneuron_gnu.a(Complex.o)
"_tgetent", referenced from:
_tcapopen in libmemacs.a(tcap.o)
"_tgetnum", referenced from:
_tcapopen in libmemacs.a(tcap.o)
"_tgetstr", referenced from:
_tcapopen in libmemacs.a(tcap.o)
"_tgoto", referenced from:
_tcapmove in libmemacs.a(tcap.o)
"_tputs", referenced from:
_tcapmove in libmemacs.a(tcap.o)
_tcapeeol in libmemacs.a(tcap.o)
_tcapeeop in libmemacs.a(tcap.o)
_tcaprev in libmemacs.a(tcap.o)
ld: symbol(s) not found for architecture x86_64

stephanmg
Posts: 68
Joined: Tue Jul 03, 2012 4:40 am

Re: Static NEURON build

Post by stephanmg » Thu Jun 26, 2014 7:02 am

I managed to resolve the previous problems, still i arrive at:
Undefined symbols for architecture x86_64:
"_tgetent", referenced from:
_tcapopen in libmemacs.a(tcap.o)
"_tgetnum", referenced from:
_tcapopen in libmemacs.a(tcap.o)
"_tgetstr", referenced from:
_tcapopen in libmemacs.a(tcap.o)
"_tgoto", referenced from:
_tcapmove in libmemacs.a(tcap.o)
"_tputs", referenced from:
_tcapmove in libmemacs.a(tcap.o)
_tcapeeol in libmemacs.a(tcap.o)
_tcapeeop in libmemacs.a(tcap.o)
_tcaprev in libmemacs.a(tcap.o)
ld: symbol(s) not found for architecture x86_64

Anyone aware of those errors?
P.S.: I fixed this issues by exluding memacs by --without-memacs -> i think this has something to do with ncurses library, since in the dynamically linked version i dont encounter this errors.

My full line for compiling the static version i utilize:
CC=/opt/local/bin/gcc-mp-4.8 CXX=/opt/local/bin/g++-mp-4.8 ./configure --prefix=`pwd` --without-x --disable-shared --enable-static linux_nrnmech=no --without-memacs

My full line for compiling the dynamical version i utilize:
CC=/opt/local/bin/gcc-mp-4.8 CXX=/opt/local/bin/g++-mp-4.8 ./configure --prefix=`pwd` --without-x

The linux_nrnmech=no seems not to be necessary imho (neither on Linux nor on Mac OSX Mavericks)

Best,
Stephan
P. S: I still arrive with ivocmain.o and nvkludge.o - is this a pure static build?

hines
Site Admin
Posts: 1576
Joined: Wed May 18, 2005 3:32 pm

Re: Static NEURON build

Post by hines » Fri Jun 27, 2014 7:31 pm

I was successful on mavericks with
../nrn/configure --prefix=`pwd` --disable-shared --without-x
and
nrniv
starts NEURON with no mention of unresolved names.
Since I have InterViews installed, I believe it would also work without the --without-x arg. But my compiler is from the Xcode command line tools and is
$ cc -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0

I have certainly had to overcome my share of linking problems in building on various machines. Just as happened in your experience, I've usually worked around
the problems without knowing exactly the cause of the problem. Often, though, they can be traced to a library order where a function A in a later loaded library
calls a function B in an earlier loaded library, andat the time of the earlier loading, B was not needed by anyone and thus discarded. The reason for the
various "kliudge.o" files is to work around this problem. Anyway, if you need a single library file at the end, an analogy to what was done with the cygwin
and mingw versions might supply some ideas. For that I build statically (but with the -fPIC option) and then after all the individual files were compiled,
created a single nrniv.dll using a list of all the .o filed that were supposed to go into the library (in the same way you could use the ar command to create a
static version of the library. The recipe is in nrn/src/mswin/nrncygso.sh

Post Reply