Closed TENX-S closed 6 months ago
make
isn't really supported, the README has a note about it. use CMake directly.
The top level Makefile
invokes cmake
so it should work in theory anyway.
You build looks rather confused. I see -arch arm64 -arch x86_64
which looks rather odd. Do you know how/why you might be seeing conflicting architectures like that?
Can you show the full output the command you ran including the cmake invocation and its output?
You build looks rather confused. I see -arch arm64 -arch x86_64 which looks rather odd. Do you know how/why you might be seeing conflicting architectures like that?
I'm not familiar with the C build system. I just followed the instructions in the README for compiling.
Can you show the full output the command you ran including the cmake invocation and its output?
Clean build with CMake:
$ cmake ..
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-146)")
-- Looking for alloca.h
-- Looking for alloca.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for setjmp.h
-- Looking for setjmp.h - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for openssl/sha.h
-- Looking for openssl/sha.h - found
-- Using OpenSSL libcrypto for SHA-256
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of ssize_t
-- Check size of ssize_t - done
-- Check size of size_t
-- Check size of size_t - done
-- Looking for __i386__
-- Looking for __i386__ - not found
-- Looking for __SSE2_MATH__
-- Looking for __SSE2_MATH__ - not found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Python3: /opt/homebrew/Frameworks/Python.framework/Versions/3.12/bin/python3.12 (found suitable version "3.12.3", minimum required is "3.5") found components: Interpreter
-- Configuring done (4.1s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/ares/Developer/projects/wabt/build
$ cmake --build .
[ 0%] Generating gen-wasm2c-prebuilt
[ 0%] Built target gen-wasm2c-prebuilt-target
[ 1%] Building CXX object CMakeFiles/wabt.dir/src/apply-names.cc.o
[ 1%] Building CXX object CMakeFiles/wabt.dir/src/binary-reader-ir.cc.o
[ 2%] Building CXX object CMakeFiles/wabt.dir/src/binary-reader-logging.cc.o
[ 3%] Building CXX object CMakeFiles/wabt.dir/src/binary-reader.cc.o
[ 3%] Building CXX object CMakeFiles/wabt.dir/src/binary-writer-spec.cc.o
[ 4%] Building CXX object CMakeFiles/wabt.dir/src/binary-writer.cc.o
[ 4%] Building CXX object CMakeFiles/wabt.dir/src/binary.cc.o
[ 5%] Building CXX object CMakeFiles/wabt.dir/src/binding-hash.cc.o
[ 5%] Building CXX object CMakeFiles/wabt.dir/src/color.cc.o
[ 6%] Building CXX object CMakeFiles/wabt.dir/src/common.cc.o
[ 7%] Building CXX object CMakeFiles/wabt.dir/src/config.cc.o
[ 7%] Building CXX object CMakeFiles/wabt.dir/src/decompiler.cc.o
[ 8%] Building CXX object CMakeFiles/wabt.dir/src/error-formatter.cc.o
[ 8%] Building CXX object CMakeFiles/wabt.dir/src/expr-visitor.cc.o
[ 9%] Building CXX object CMakeFiles/wabt.dir/src/feature.cc.o
[ 9%] Building CXX object CMakeFiles/wabt.dir/src/filenames.cc.o
[ 10%] Building CXX object CMakeFiles/wabt.dir/src/generate-names.cc.o
[ 11%] Building CXX object CMakeFiles/wabt.dir/src/ir-util.cc.o
[ 11%] Building CXX object CMakeFiles/wabt.dir/src/ir.cc.o
[ 12%] Building CXX object CMakeFiles/wabt.dir/src/leb128.cc.o
[ 12%] Building CXX object CMakeFiles/wabt.dir/src/lexer-source-line-finder.cc.o
[ 13%] Building CXX object CMakeFiles/wabt.dir/src/lexer-source.cc.o
[ 13%] Building CXX object CMakeFiles/wabt.dir/src/literal.cc.o
[ 14%] Building C object CMakeFiles/wabt.dir/src/opcode-code-table.c.o
[ 15%] Building CXX object CMakeFiles/wabt.dir/src/opcode.cc.o
[ 15%] Building CXX object CMakeFiles/wabt.dir/src/option-parser.cc.o
[ 16%] Building CXX object CMakeFiles/wabt.dir/src/resolve-names.cc.o
[ 16%] Building CXX object CMakeFiles/wabt.dir/src/sha256.cc.o
[ 17%] Building CXX object CMakeFiles/wabt.dir/src/shared-validator.cc.o
[ 17%] Building CXX object CMakeFiles/wabt.dir/src/stream.cc.o
[ 18%] Building CXX object CMakeFiles/wabt.dir/src/token.cc.o
[ 19%] Building CXX object CMakeFiles/wabt.dir/src/tracing.cc.o
[ 19%] Building CXX object CMakeFiles/wabt.dir/src/type-checker.cc.o
[ 20%] Building CXX object CMakeFiles/wabt.dir/src/utf8.cc.o
[ 20%] Building CXX object CMakeFiles/wabt.dir/src/validator.cc.o
[ 21%] Building CXX object CMakeFiles/wabt.dir/src/wast-lexer.cc.o
[ 22%] Building CXX object CMakeFiles/wabt.dir/src/wast-parser.cc.o
[ 22%] Building CXX object CMakeFiles/wabt.dir/src/wat-writer.cc.o
[ 23%] Building CXX object CMakeFiles/wabt.dir/src/c-writer.cc.o
[ 23%] Building CXX object CMakeFiles/wabt.dir/src/prebuilt/wasm2c_header_top.cc.o
[ 24%] Building CXX object CMakeFiles/wabt.dir/src/prebuilt/wasm2c_header_bottom.cc.o
[ 24%] Building CXX object CMakeFiles/wabt.dir/src/prebuilt/wasm2c_source_includes.cc.o
[ 25%] Building CXX object CMakeFiles/wabt.dir/src/prebuilt/wasm2c_source_declarations.cc.o
[ 26%] Building CXX object CMakeFiles/wabt.dir/src/prebuilt/wasm2c_simd_source_declarations.cc.o
[ 26%] Building CXX object CMakeFiles/wabt.dir/src/prebuilt/wasm2c_atomicops_source_declarations.cc.o
[ 27%] Building CXX object CMakeFiles/wabt.dir/src/interp/binary-reader-interp.cc.o
[ 27%] Building CXX object CMakeFiles/wabt.dir/src/interp/interp.cc.o
[ 28%] Building CXX object CMakeFiles/wabt.dir/src/interp/interp-util.cc.o
[ 28%] Building CXX object CMakeFiles/wabt.dir/src/interp/istream.cc.o
[ 29%] Linking CXX static library libwabt.a
[ 29%] Built target wabt
[ 30%] Building C object CMakeFiles/wasm-rt-impl.dir/wasm2c/wasm-rt-impl.c.o
[ 31%] Building C object CMakeFiles/wasm-rt-impl.dir/wasm2c/wasm-rt-exceptions-impl.c.o
[ 31%] Building C object CMakeFiles/wasm-rt-impl.dir/wasm2c/wasm-rt-mem-impl.c.o
[ 32%] Linking C static library libwasm-rt-impl.a
[ 32%] Built target wasm-rt-impl
[ 33%] Building CXX object CMakeFiles/wasm.dir/src/apply-names.cc.o
[ 33%] Building CXX object CMakeFiles/wasm.dir/src/binary-reader-ir.cc.o
[ 34%] Building CXX object CMakeFiles/wasm.dir/src/binary-reader-logging.cc.o
[ 34%] Building CXX object CMakeFiles/wasm.dir/src/binary-reader.cc.o
[ 35%] Building CXX object CMakeFiles/wasm.dir/src/binary-writer-spec.cc.o
[ 36%] Building CXX object CMakeFiles/wasm.dir/src/binary-writer.cc.o
[ 36%] Building CXX object CMakeFiles/wasm.dir/src/binary.cc.o
[ 37%] Building CXX object CMakeFiles/wasm.dir/src/binding-hash.cc.o
[ 37%] Building CXX object CMakeFiles/wasm.dir/src/color.cc.o
[ 38%] Building CXX object CMakeFiles/wasm.dir/src/common.cc.o
[ 38%] Building CXX object CMakeFiles/wasm.dir/src/config.cc.o
[ 39%] Building CXX object CMakeFiles/wasm.dir/src/decompiler.cc.o
[ 40%] Building CXX object CMakeFiles/wasm.dir/src/error-formatter.cc.o
[ 40%] Building CXX object CMakeFiles/wasm.dir/src/expr-visitor.cc.o
[ 41%] Building CXX object CMakeFiles/wasm.dir/src/feature.cc.o
[ 41%] Building CXX object CMakeFiles/wasm.dir/src/filenames.cc.o
[ 42%] Building CXX object CMakeFiles/wasm.dir/src/generate-names.cc.o
[ 43%] Building CXX object CMakeFiles/wasm.dir/src/ir-util.cc.o
[ 43%] Building CXX object CMakeFiles/wasm.dir/src/ir.cc.o
[ 44%] Building CXX object CMakeFiles/wasm.dir/src/leb128.cc.o
[ 44%] Building CXX object CMakeFiles/wasm.dir/src/lexer-source-line-finder.cc.o
[ 45%] Building CXX object CMakeFiles/wasm.dir/src/lexer-source.cc.o
[ 45%] Building CXX object CMakeFiles/wasm.dir/src/literal.cc.o
[ 46%] Building C object CMakeFiles/wasm.dir/src/opcode-code-table.c.o
[ 47%] Building CXX object CMakeFiles/wasm.dir/src/opcode.cc.o
[ 47%] Building CXX object CMakeFiles/wasm.dir/src/option-parser.cc.o
[ 48%] Building CXX object CMakeFiles/wasm.dir/src/resolve-names.cc.o
[ 48%] Building CXX object CMakeFiles/wasm.dir/src/sha256.cc.o
[ 49%] Building CXX object CMakeFiles/wasm.dir/src/shared-validator.cc.o
[ 49%] Building CXX object CMakeFiles/wasm.dir/src/stream.cc.o
[ 50%] Building CXX object CMakeFiles/wasm.dir/src/token.cc.o
[ 51%] Building CXX object CMakeFiles/wasm.dir/src/tracing.cc.o
[ 51%] Building CXX object CMakeFiles/wasm.dir/src/type-checker.cc.o
[ 52%] Building CXX object CMakeFiles/wasm.dir/src/utf8.cc.o
[ 52%] Building CXX object CMakeFiles/wasm.dir/src/validator.cc.o
[ 53%] Building CXX object CMakeFiles/wasm.dir/src/wast-lexer.cc.o
[ 53%] Building CXX object CMakeFiles/wasm.dir/src/wast-parser.cc.o
[ 54%] Building CXX object CMakeFiles/wasm.dir/src/wat-writer.cc.o
[ 55%] Building CXX object CMakeFiles/wasm.dir/src/c-writer.cc.o
[ 55%] Building CXX object CMakeFiles/wasm.dir/src/prebuilt/wasm2c_header_top.cc.o
[ 56%] Building CXX object CMakeFiles/wasm.dir/src/prebuilt/wasm2c_header_bottom.cc.o
[ 56%] Building CXX object CMakeFiles/wasm.dir/src/prebuilt/wasm2c_source_includes.cc.o
[ 57%] Building CXX object CMakeFiles/wasm.dir/src/prebuilt/wasm2c_source_declarations.cc.o
[ 57%] Building CXX object CMakeFiles/wasm.dir/src/prebuilt/wasm2c_simd_source_declarations.cc.o
[ 58%] Building CXX object CMakeFiles/wasm.dir/src/prebuilt/wasm2c_atomicops_source_declarations.cc.o
[ 59%] Building CXX object CMakeFiles/wasm.dir/src/interp/binary-reader-interp.cc.o
[ 59%] Building CXX object CMakeFiles/wasm.dir/src/interp/interp.cc.o
[ 60%] Building CXX object CMakeFiles/wasm.dir/src/interp/interp-util.cc.o
[ 60%] Building CXX object CMakeFiles/wasm.dir/src/interp/istream.cc.o
[ 61%] Building CXX object CMakeFiles/wasm.dir/src/interp/interp-wasm-c-api.cc.o
[ 61%] Linking CXX shared library libwasm.dylib
ld: warning: ignoring file '/opt/homebrew/Cellar/openssl@3/3.3.0/lib/libcrypto.3.dylib': found architecture 'arm64', required architecture 'x86_64'
Undefined symbols for architecture x86_64:
"_SHA256", referenced from:
wabt::sha256(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) in sha256.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/wasm.dir/build.make:883: libwasm.dylib] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:318: CMakeFiles/wasm.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
$ git rev-parse HEAD
c24a216237e2731cc71885230bf7de5a9dfac5c7
$ clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ cmake --version
cmake version 3.29.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: Mac15,7
Model Number: MRW23CH/A
Chip: Apple M3 Pro
Total Number of Cores: 12 (6 performance and 6 efficiency)
Memory: 36 GB
System Firmware Version: 10151.101.3
OS Loader Version: 10151.101.3
...
It looks like cmake its trying to do an x86_64 build.. any idea why that would be?
ld: warning: ignoring file '/opt/homebrew/Cellar/openssl@3/3.3.0/lib/libcrypto.3.dylib': found architecture 'arm64', required architecture 'x86_64'
Undefined symbols for architecture x86_64:
"_SHA256", referenced from:
wabt::sha256(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) in sha256.cc.o
ld: symbol(s) not found for architecture x86_64
The linker here is saying that its trying to link for x86_64.
This doesn't really seems like a wabt bug, but something with your local build setup.
@TENX-S i have the same issue,how do you solved it