Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to build in Alpine OS? #897

Closed
athxx opened this issue Sep 22, 2021 · 2 comments
Closed

how to build in Alpine OS? #897

athxx opened this issue Sep 22, 2021 · 2 comments

Comments

@athxx
Copy link

athxx commented Sep 22, 2021

I trying to build wasm files in alpine linux os, but when I was trying to build, it shows these errors

make: cmake /www/slm/srv -DEMCC_BUILD_TYPE=Release
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /www/slm/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake:129 (message):
  Failed to fetch compiler version information with command
  "'/www/slm/emsdk/upstream/emscripten/emcc' -v"! Process returned with error
  code 1.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!

I am sure already install make cmake g++ gcc xz linux-headers xz tar bzip2 libgcc musl-dev, and it already initial nodejs and binary but it always cannot find make

and when I check emcc -v, it shows errors

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.30 (f782b50a7f8dded7cd0e2c7ee4fed41ab743f5c0)
emcc: error: '/www/slm/emsdk/upstream/bin/clang -v -target wasm32-unknown-emscripten' failed: [Errno 2] No such file or directory: '/www/slm/emsdk/upstream/bin/clang'

but in /www/slm/emsdk/upstream/bin this directory, all files are exists

clang                     lld                       llvm-dwarfdump            llvm-objdump              llvm-strings              wasm-ctor-eval            wasm-metadce              wasm-split                wasm32-wasi-clang
clang++                   llvm-addr2line            llvm-dwp                  llvm-ranlib               llvm-symbolizer           wasm-dis                  wasm-opt                  wasm2js                   wasm32-wasi-clang++
clang-14                  llvm-ar                   llvm-nm                   llvm-readobj              opt                       wasm-emscripten-finalize  wasm-reduce               wasm32-clang
llc                       llvm-cxxfilt              llvm-objcopy              llvm-size                 wasm-as                   wasm-ld                   wasm-shell                wasm32-clang++

and I tried to run ./clang-14, it shows errors, but files are there, and all files are 777 perms

-ash: ./clang-14: not found

OS INFO

Linux x 5.10.67-0-lts #1-Alpine SMP Mon, 20 Sep 2021 09:03:55 +0000 x86_64 Linux

alpine-standard-3.14.2-x86_64

How should I do to successfully build these .wasm files????????

@sbc100
Copy link
Collaborator

sbc100 commented Sep 22, 2021

Normally those files are installed as O755, but O777 should be fine too.

Finally can run ldd /www/slm/emsdk/upstream/bin/clang-14 to see if you have the correct dynamic loader and shared libraries? I think alpine linux is missing the support for glibc-based executables by default so there are likely a missing dynamic loader. It looks like it might be possible to get this working: https://wiki.alpinelinux.org/wiki/Running_glibc_programs

@athxx
Copy link
Author

athxx commented Sep 23, 2021

I tried to install
apk add --no-cache libc6-compat gcompat linux-headers musl-dev musl libstdc++ curl ca-certificates
but it still did not work, but finally, I got this by install GNC glibc

https://github.com/sgerrand/alpine-pkg-glibc

cd /tmp/
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
apk add glibc-2.34-r0.apk

then build success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants