Page 1 of 1

undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Tue Jun 25, 2024 4:31 pm
by kedoxey
I am attempting to compile the mod files with the command nrnivmodl . for a single cell model and keep encountering the error that there is an undefined reference to ‘memcpy@GLIBC_2.14':

Code: Select all

-> Compiling vecevent.c
 => LINKING shared library ./libnrnmech.so
 => LINKING executable ./special LDFLAGS are:    -pthread
/home/kedoxey/.conda/envs/python3_9-NEW/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/kedoxey/.conda/envs/python3_9-NEW/lib/python3.9/site-packages/neuron/.data/lib/libnrniv.so: undefined reference to `memcpy@GLIBC_2.14'
collect2: error: ld returned 1 exit status
make: *** [/home/kedoxey/.conda/envs/python3_9-NEW/lib/python3.9/site-packages/neuron/.data/bin/nrnmech_makefile:125: special] Error 1
Traceback (most recent call last):
  File "/home/kedoxey/.conda/envs/python3_9-NEW/bin/nrnivmodl", line 114, in <module>
    subprocess.check_call([exe, *sys.argv[1:]])
  File "/home/kedoxey/.conda/envs/python3_9-NEW/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/kedoxey/.conda/envs/python3_9-NEW/lib/python3.9/site-packages/neuron/.data/bin/nrnivmodl', '.']' returned non-zero exit status 2.
I am running NEURON 8.2.4 in a python 3.9 conda environment on a linux server (Ubuntu 22.04.3). ldd --version returns ldd (Ubuntu GLIBC 2.35-0ubuntu3.8) 2.35. The command hostnamectl returns the following:

Code: Select all

Static hostname: spike
Icon name: computer-server
Chassis: server
Operating System: Ubuntu 22.04.3 LTS              
Kernel: Linux 6.2.0-36-generic
Architecture: x86-64
I ran into this error a few months ago and was able to quickly fix it by creating a new conda environment. However, this no longer works as the error returns in every conda environment.

I’d appreciate any guidance on how to remedy this issue. Thanks!

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Wed Jun 26, 2024 11:47 am
by hines
That is a puzzle since I have always been under the impression that later glibc (your 2.35) would resolve earlier versions (2.1). Did you install with
pip install neuron?

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Wed Jun 26, 2024 7:50 pm
by kedoxey
Yes I did. I also tried uninstalling and reinstalling NEURON with pip and the error persisted.

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Thu Jun 27, 2024 2:36 am
by hines
This is a bit of flailing around on my part, but I'm curious if the problem goes away if you install the latest neuron-nightly version. Probably best done in a python virtual environment so that subsequent removal of the whole thing becomes straightforward. ie. in the folder where your mod files are located, something like

Code: Select all

pip3 uninstall neuron
python3 -m venv env
source env/bin/activate
pip3 install neuron-nightly
nrnivmodl
deactivate
rm -r -f env


I searched for "Undefined reference to memcpy@GLIBC_2.14" but the pages I looked at generally involved building from sources with additional asm statements and I hope such strong measures are not needed.

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Thu Jun 27, 2024 2:46 am
by hines
Just want to verify that

Code: Select all

neurondemo
works.

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Thu Jun 27, 2024 6:49 pm
by kedoxey
I tried using the latest neuron-nightly version with your instructions and get the following error:

Code: Select all

=> LINKING shared library "/home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/x86_64/./libnrnmech.so"
 => LINKING executable "/home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/x86_64/./special" LDFLAGS are:     
/home/kedoxey/.conda/envs/python3_9-NEW/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/env/lib/python3.9/site-packages/neuron/.data/lib/libnrniv.so: undefined reference to `memcpy@GLIBC_2.14'
/home/kedoxey/.conda/envs/python3_9-NEW/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/env/lib/python3.9/site-packages/neuron/.data/lib/libnrniv.so: undefined reference to `aligned_alloc@GLIBC_2.16'
collect2: error: ld returned 1 exit status
make: *** [/home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/env/lib/python3.9/site-packages/neuron/.data/bin/nrnmech_makefile:126: special] Error 1
Traceback (most recent call last):
  File "/home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/env/bin/nrnivmodl", line 115, in <module>
    subprocess.check_call([exe, *sys.argv[1:]])
  File "/home/kedoxey/.conda/envs/python3_9-NEW/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/NMLCL000073-NEURON/env/lib/python3.9/site-packages/neuron/.data/bin/nrnivmodl', '.']' returned non-zero exit status 2.
I am able to run neurondemo in the virtual environment with the following output:

Code: Select all

INFO : Using neuron-nightly Package (Developer Version)
Warning: no DISPLAY environment variable.
--No graphics will be displayed.
NEURON -- VERSION 9.0a-279-g8ffa1fa3a HEAD (8ffa1fa3a) 2024-06-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2022
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from /home/kedoxey/CRCNS/PyramidalCellSimulations/models/NEURON/env/lib/python3.9/site-packages/neuron/.data/share/nrn/demo/release/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
 "cabpump.mod" "cachan1.mod" "camchan.mod" "capump.mod" "invlfire.mod" "khhchan.mod" "nacaex.mod" "nachan.mod" "release.mod"
oc>

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Fri Jun 28, 2024 2:02 am
by hines
So the issue seems generic with respect to our wheel build environment.
I think the fact that you can launch neurondemo with its libnrniv and the libnrnmech built when the installer was created is an important clue. The issue seems focused on the nrnivmodl make process. I imagine some detail is missing in the compile or link arguments. I've created a GitHub issue to discuss with colleagues about this.
https://github.com/neuronsimulator/nrn/issues/2949
Perhaps someone has a suggestion for further diagnosis/fixing. If the problem is specific to nrnivmodl and helpers then it should be more convenient for you to modify or replace the nrnmech_makefile without having to build a new wheel for each diagnostic experiment.
Note. When I create a python3.12 virtual environment in env and pip install neuron, nrnmech_makefile is located in
env/lib/python3.12/site-packages/neuron/.data/bin

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Fri Jun 28, 2024 2:25 am
by hines
A colleague mentions:
Ubuntu 22.04 is recent and I don’t think issue is about the system glibc+compiler compatibility. Seeing below, I see the compiler toolchain is coming from conda env and I suspect issue is coming from there:
/home/kedoxey/.conda/envs/python3_9-NEW/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld
That makes me wonder if the issue is specific to conda or generic to your environment for all python installations. Would it be possible to
temporarily install a version of python from python.org to further divide and conquer this issue. (on Linux machines, I've had good luck with
pyenv in managing many versions of python)

https://github.com/pyenv/pyenv

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Fri Jun 28, 2024 3:39 am
by hines
I see that comments are starting to arrive
https://github.com/neuronsimulator/nrn/ ... 2196286531
I'd say that we should move this discussion to that GitHub issue, but I'm not certain if you have permission to comment there. If so and it merely requires a GitHub account, then great.

Re: undefined reference to ‘memcpy@GLIBC_2.1’ compiling error

Posted: Fri Jun 28, 2024 2:52 pm
by kedoxey
Thanks for your help on here! I'll move over to the GitHub issue.