ANTsX / ANTsPy

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.
https://antspyx.readthedocs.io
Apache License 2.0
625 stars 161 forks source link

Linking errors on powerpc builds #470

Open cookpa opened 1 year ago

cookpa commented 1 year ago

Originally posted by @wmdatah in https://github.com/ANTsX/ANTsPy/issues/53#issuecomment-1579529734

          The following attempts were made on a POWER 9, with nvidia tesla, running Ubuntu 22.04:

straight to bare metal

docker containers

This is just a summary, I've been trying for a few days now, but today I gave up after trying with docker build and getting the exact same error as every other attempt:

ImportError: /opt/conda/lib/python3.10/site-packages/ants/lib/antsRegistration.cpython-310-powerpc64le-linux-gnu.so: undefined symbol: _Z14ANTSFileExistsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

In one of the attempts, in a container, I launched a scanelf -s _Z14ANTSFileExistsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE -R / 2>/dev/null | grep _Z14ANT... and I noticed that only other files in the same directory as antsRegistration.cpython-310-powerpc64le-linux-gnu.so have such a symbol. I haven't looked for such a symbol using other tools for other file types.

Could someone give me a hug to lessen my frustration? 😅 Or else shed some light on my ignorance? Any tip is worth. Thanks in advance.

Here is part of the docker build output:

Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-73-generic ppc64le)
...
  System information as of Tue Jun  6 04:06:40 PM -03 2023
...
git clone https://github.com/ANTsX/ANTsPy.git
cd ANTsPy
docker build -t antspy:master .
...
 => [internal] load build definition from Dockerfile
...
 => [stage-1 1/2] FROM docker.io/library/debian:bullseye-20230109-slim@sha256:98d3b4b0cee264301eb1354e0b549323af2d0633e1c43375d0b25c01826b6790
...
 => [builder 1/9] FROM docker.io/continuumio/miniconda3:22.11.1@sha256:10b38c9a8a51692838ce4517e8c74515499b68d58c8a2000d8a9df7f0f08fc5e
...
 => [internal] load build context
 => => transferring context: 105.30MB
 => [builder 2/9] RUN apt-get update && apt-get install -y --no-install-recommends apt-transport-https bash build-essential git libpng-dev
 => [builder 3/9] RUN conda install -c anaconda cmake
 => [builder 4/9] WORKDIR /usr/local/src
 => [builder 5/9] COPY environment.yml .
 => [builder 6/9] RUN conda env update -n base
 => [builder 7/9] COPY . .
 => [builder 8/9] RUN pip --no-cache-dir -v install .
 => ERROR [builder 9/9] RUN bash tests/run_tests.sh
------
 > [builder 9/9] RUN bash tests/run_tests.sh:
#0 0.415 /usr/local/src/tests /usr/local/src
#0 0.415 Running core tests
#0 1.720 Traceback (most recent call last):
#0 1.720   File "/usr/local/src/tests/test_core_ants_image.py", line 19, in <module>
#0 1.720     import ants
#0 1.720   File "/opt/conda/lib/python3.10/site-packages/ants/__init__.py", line 7, in <module>
#0 1.720     from .core import *
#0 1.720   File "/opt/conda/lib/python3.10/site-packages/ants/core/__init__.py", line 2, in <module>
#0 1.720     from .ants_image import *
#0 1.720   File "/opt/conda/lib/python3.10/site-packages/ants/core/ants_image.py", line 29, in <module>
#0 1.720     from .. import registration, segmentation, utils, viz
#0 1.720   File "/opt/conda/lib/python3.10/site-packages/ants/registration/__init__.py", line 3, in <module>
#0 1.720     from .affine_initializer import *
#0 1.720   File "/opt/conda/lib/python3.10/site-packages/ants/registration/affine_initializer.py", line 7, in <module>
#0 1.721     from .. import utils
#0 1.721   File "/opt/conda/lib/python3.10/site-packages/ants/utils/__init__.py", line 2, in <module>
#0 1.721     from .bias_correction import *
#0 1.721   File "/opt/conda/lib/python3.10/site-packages/ants/utils/bias_correction.py", line 4, in <module>
#0 1.721     from . import process_args as pargs
#0 1.721   File "/opt/conda/lib/python3.10/site-packages/ants/utils/process_args.py", line 14, in <module>
#0 1.721     from .. import lib
#0 1.721   File "/opt/conda/lib/python3.10/site-packages/ants/lib/__init__.py", line 44, in <module>
#0 1.721     from .antsRegistration import *
#0 1.721 ImportError: /opt/conda/lib/python3.10/site-packages/ants/lib/antsRegistration.cpython-310-powerpc64le-linux-gnu.so: undefined symbol: _Z14ANTSFileExistsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
------
Dockerfile:31
--------------------
  29 |     
  30 |     # run tests
  31 | >>> RUN bash tests/run_tests.sh
  32 |     
  33 |     # optimize layers
--------------------
ERROR: failed to solve: process "/bin/sh -c bash tests/run_tests.sh" did not complete successfully: exit code: 1

Originally posted by @wmdatah in https://github.com/ANTsX/ANTsPy/issues/53#issuecomment-1579529734

cookpa commented 1 year ago

Bat signal for anyone who has run ANTsPy successfully on powerpc