Orthanc-1.5.8 'make' failed

Hi,

I am attempting to compile from source version 1.5.8 by building branch ‘Orthanc-1.5.8’. The cmake command completes successfully, but the ‘make’ command fails with the following

libCoreLibrary.a(pngrutil.c.o): In functionpng_read_filter_row’:
pngrutil.c:(.text+0x6f0c): undefined reference to `png_init_filter_functions_neon’
collect2: error: ld returned 1 exit status
CMakeFiles/UnitTests.dir/build.make:642: recipe for target ‘UnitTests’ failed
make[2]: *** [UnitTests] Error 1
CMakeFiles/Makefile2:248: recipe for target ‘CMakeFiles/UnitTests.dir/all’ failed
make[1]: *** [CMakeFiles/UnitTests.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2

`

Any ideas what might be going wrong here?

Thanks, Tim

Hello,

Looks like this error message has been reported for various software, e.g.:
https://sourceforge.net/p/libpng/bugs/230/

https://github.com/opencv/opencv/issues/7600

Please provide the exact build environment (name and version of the GNU/Linux distribution, “cat /etc/issue” or “cat /etc/lsb-release”, and computer architecture, “uname -a”), together with the full command-line you used to invoke CMake. Without this information, we can’t provide further help.

Note that you can probably fix this issue by statically linking against libpng, which can be done by adding the flag “-DUSE_SYSTEM_LIBPNG=OFF” while running CMake.

HTH,
Sébastien-

Hi Sébastien,

$ cmake -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release ~/Orthanc

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION=“Ubuntu 18.04.3 LTS”

$ uname -a
Linux ip-10-0-0-217 4.15.0-1056-aws #58-Ubuntu SMP Tue Nov 26 15:13:04 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

I’ll try statically linking libpng.

Thanks, Tim

I ran it again with the extra cmake option but got the same error in the make stage. I expect it’s because I’m trying to get it running on an ARM architecture. I’m going to try again with an x86 system which hopefully will go better.

Yes, this is clearly related to the ARM aarch64 architecture.

The links I provided above tend to indicate a missing object file in the shared library of the official Ubuntu package, and the fact that you can’t statically link against libpng might be solved by adding “libpng-1.6.36/arm/filter_neon.S” to “LIBPNG_SOURCES” in the following file:
https://bitbucket.org/sjodogne/orthanc/src/default/Resources/CMake/LibPngConfiguration.cmake

I can’t provide any help by myself, as I don’t have access to such a computer. If someone can grant me an access, I could have a look.

For future reference, here is how to properly add the possibly missing files if the target architecture is aarch64 in CMake (but, again, I don’t have a way of testing this by myself, and some files might make the compilation fail):

if(CMAKE_SYSTEM_PROCESSOR MATCHES “^(aarch64.|AARCH64.)”)

list(APPEND LIBPNG_SOURCES
${LIBPNG_SOURCES_DIR}/arm/arm_init.c
${LIBPNG_SOURCES_DIR}/arm/filter_neon_intrinsics.c
${LIBPNG_SOURCES_DIR}/arm/filter_neon.S
${LIBPNG_SOURCES_DIR}/arm/palette_neon_intrinsics.c
)
endif()

Source: https://github.com/opencv/opencv/blob/master/cmake/OpenCVDetectCXXCompiler.cmake

Once I have a working PACS that my customers can use I’ll do a bit of tinkering with my ARM system and hopefully be able to contribute something to the project.

Appreciate the help.