commontk / dcmjs

dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
http://dcmjs.org
Other
109 stars 20 forks source link

Build fails on M1 Mac #34

Open ngladbach opened 2 years ago

ngladbach commented 2 years ago

Hello, I tried building dcmjs with a M1 Mac, but it did not succeed. I did the following:

docker run --rm --platform=linux/amd64 dockcross/web-wasm > ./dockcross-web-wasm
chmod +x dockcross-web-wasm
./dockcross-web-wasm -a "--platform=linux/amd64" cmake -Bdcmjs-build -H. -GNinja -Ddcmjs_USE_GIT_PROTOCOL=OFF
./dockcross-web-wasm -a "--platform=linux/amd64" ninja -Cdcmjs-build

The last command has the following output (slightly shortened):

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ninja: Entering directory `dcmjs-build'
[1/41] Performing download step (git clone) for 'ZLIB'
Cloning into 'ZLIB'...
HEAD is now at 66a7530 Add option ZLIB_MANGLE_PREFIX
[3/41] Performing download step (download, verify and extract) for 'LibXml2'
-- verifying file...
       file='/work/dcmjs-build/../dcmjs-download-cache/libxml2-2.9.8.tar.gz'
-- File already exists and hash match (skip download):
  file='/work/dcmjs-build/../dcmjs-download-cache/libxml2-2.9.8.tar.gz'
  MD5='b786e353e2aa1b872d70d5d1ca0c740d'
-- extracting...
     src='/work/dcmjs-download-cache/libxml2-2.9.8.tar.gz'
     dst='/work/dcmjs-build/LibXml2'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[4/41] Performing update step for 'ZLIB'
[5/41] No update step for 'LibXml2'
[7/41] Performing configure step for 'ZLIB'
loading initial cache file /work/dcmjs-build/ZLIB-prefix/tmp/ZLIB-cache-Release.cmake
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at CMakeLists.txt:51 (ADD_LIBRARY):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /work/dcmjs-build/ZLIB-build
[9/41] Performing configure step for 'LibXml2'
loading initial cache file /work/dcmjs-build/LibXml2-prefix/tmp/LibXml2-cache-Release.cmake
CMake Warning (dev) at CMakeLists.txt:82 (add_library):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /work/dcmjs-build/LibXml2-build
[10/41] Performing build step for 'ZLIB'
[1/12] Building C object CMakeFiles/zlib.dir/compress.c.o
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
[2/12] Building C object CMakeFiles/zlib.dir/zutil.c.o
...
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
[12/12] Linking C static library libzlib.a
[11/41] Performing build step for 'LibXml2'
[1/45] Building C object CMakeFiles/xml2.dir/DOCBparser.c.o
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
...
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
/work/dcmjs-build/LibXml2/xmlmodule.c:32:14: warning: function 'xmlModulePlatformOpen' has internal linkage but is not defined [-Wundefined-internal]
static void *xmlModulePlatformOpen(const char *name);
             ^
/work/dcmjs-build/LibXml2/xmlmodule.c:90:22: note: used here
    module->handle = xmlModulePlatformOpen(name);
                     ^
/work/dcmjs-build/LibXml2/xmlmodule.c:34:12: warning: function 'xmlModulePlatformSymbol' has internal linkage but is not defined [-Wundefined-internal]
static int xmlModulePlatformSymbol(void *handle, const char *name, void **result);
           ^
/work/dcmjs-build/LibXml2/xmlmodule.c:130:10: note: used here
    rc = xmlModulePlatformSymbol(module->handle, name, symbol);
         ^
/work/dcmjs-build/LibXml2/xmlmodule.c:33:12: warning: function 'xmlModulePlatformClose' has internal linkage but is not defined [-Wundefined-internal]
static int xmlModulePlatformClose(void *handle);
           ^
/work/dcmjs-build/LibXml2/xmlmodule.c:166:10: note: used here
    rc = xmlModulePlatformClose(module->handle);
         ^
3 warnings generated.
[25/45] Building C object CMakeFiles/xml2.dir/uri.c.o
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
...
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]
emcc: warning: linker flag ignored during compilation: '--memory-init-file' [-Wunused-command-line-argument]
[45/45] Linking C static library libxml2.a
[12/41] Performing install step for 'ZLIB'
[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /work/dcmjs-build/ZLIB-install/lib/libzlib.a
-- Installing: /work/dcmjs-build/ZLIB-install/include/zlib.h
-- Installing: /work/dcmjs-build/ZLIB-install/include/zconf.h
-- Installing: /work/dcmjs-build/ZLIB-install/include/zlib_mangle.h
-- Installing: /work/dcmjs-build/ZLIB-install/include/zlibDllConfig.h
-- Installing: /work/dcmjs-build/ZLIB-install/doc/zlib-1.2.3/Copyright.txt
[13/41] No install step for 'LibXml2'
[17/41] Performing download step (download, verify and extract) for 'PNG'
-- Downloading...
   dst='/work/dcmjs-build/../dcmjs-download-cache/libpng-1.6.36.tar.xz'
   timeout='none'
   inactivity timeout='none'
-- Using src='http://download.sourceforge.net/libpng/libpng-1.6.36.tar.xz'
-- verifying file...
       file='/work/dcmjs-build/../dcmjs-download-cache/libpng-1.6.36.tar.xz'
-- Downloading... done
-- extracting...
     src='/work/dcmjs-download-cache/libpng-1.6.36.tar.xz'
     dst='/work/dcmjs-build/PNG'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[18/41] No update step for 'PNG'
[20/41] Performing configure step for 'PNG'
loading initial cache file /work/dcmjs-build/PNG-prefix/tmp/PNG-cache-Release.cmake
-- The ASM compiler identification is unknown
-- Found assembler: /emsdk/upstream/emscripten/emcc
-- Warning: Did not find file Compiler/-ASM
CMake Warning (dev) at CMakeLists.txt:42 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  CMake variable ZLIB_ROOT is set to:

    /work/dcmjs-build/ZLIB-install

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found ZLIB: /work/dcmjs-build/ZLIB-install/lib/libzlib.so (found version "1.2.3") 
-- Performing Test HAVE_LD_VERSION_SCRIPT
-- Performing Test HAVE_LD_VERSION_SCRIPT - Success
-- Symbol prefix: 
CMake Warning (dev) at CMakeLists.txt:530 (add_library):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.  Building a STATIC library instead.  This may lead
  to problems.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /work/dcmjs-build/PNG-build
[21/41] Performing build step for 'PNG'
ninja: error: '/work/dcmjs-build/ZLIB-install/lib/libzlib.so', needed by 'pngfix.js', missing and no known rule to make it
FAILED: PNG-prefix/src/PNG-stamp/PNG-build /work/dcmjs-build/PNG-prefix/src/PNG-stamp/PNG-build 
cd /work/dcmjs-build/PNG-build && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /work/dcmjs-build/PNG-prefix/src/PNG-stamp/PNG-build
ninja: build stopped: subcommand failed.

How can I fix this? Best regards Niclas