I am a web front-end engineer. A project running in browser need KFR. So I have been trying some days to compile a "module.c" using KFR as a WASM module. But there a too many troubles.
I'am working on win10 / MinGW64 / CMake / EMSCRIPTEN. What I want to know most at the moment is, can this be successful?
Some problems look about CPU-ARCH and SIMD,
PS D:\workspace\xxx\kfr.js\lib\build> emcmake cmake -DARCH_TESTS=OFF ..
configure: cmake -DARCH_TESTS=OFF .. -DCMAKE_TOOLCHAIN_FILE=D:\workspace\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR="D:/workspace/emsdk/node/14.15.5_64bit/bin/node.exe" -G "MinGW Makefiles"
-- Install prefix = C:/Program Files (x86)/KFR.JS
-- C++ compiler: Clang 13.0.0 D:/workspace/emsdk/upstream/emscripten/em++.bat
-- CMAKE_SYSTEM_PROCESSOR=x86
-- X86
-- Detecting native cpu...
-- COMPILE_RESULT=FALSE
-- RUN_RESULT=
-- COMPILE_OUT=Change Dir: D:/workspace/xxx/kfr.js/lib/build/kfr/tmpdir/CMakeFiles/CMakeTmp
Run Build Command(s):C:/mingw64/bin/mingw32-make.exe -f Makefile cmTC_f28ee/fast && C:/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_f28ee.dir\build.make CMakeFiles/cmTC_f28ee.dir/build
mingw32-make.exe[1]: Entering directory 'D:/workspace/xxx/kfr.js/lib/build/kfr/tmpdir/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_f28ee.dir/detect_cpu.cpp.o
D:\workspace\emsdk\upstream\emscripten\em++.bat @CMakeFiles/cmTC_f28ee.dir/includes_CXX.rsp -std=gnu++17 -MD -MT CMakeFiles/cmTC_f28ee.dir/detect_cpu.cpp.o -MF CMakeFiles\cmTC_f28ee.dir\detect_cpu.cpp.o.d -o CMakeFiles\cmTC_f28ee.dir\detect_cpu.cpp.o -c D:\workspace\xxx\kfr.js\lib\kfr\cmake\detect_cpu.cpp
In file included from D:\workspace\tjxxxu\kfr.js\lib\kfr\cmake\detect_cpu.cpp:1:
In file included from D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/cpuid.hpp:32:
In file included from D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:28:
In file included from D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/types.hpp:28:
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/../kfr.h:66:39: error: expected '' after top level declarator
constexpr const char version_full[] = KFR_VERSION_FULL
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/../kfr.h:51:42: note: expanded from macro 'KFR_VERSION_FULL'
" " CMT_STRINGIFY(CMT_ARCH_NAME) " " CMT_ARCH_BITNESS_NAME " (" CMT_COMPILER_FULL_NAME "/" CMT_OS_NAME \
^
In file included from D:\workspace\xxx\kfr.js\lib\kfr\cmake\detect_cpu.cpp:1:
In file included from D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/cpuid.hpp:32:
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:84:47: error: no member named 'neon' in 'kfr::cpu_t'
constexpr auto cpu_list = cvals<cpu_t, cpu_t::neon>
~~~~~~~^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:106:23: error: no member named 'lowest' in 'kfr::cpu_t'
if (set >= cpu_t::lowest && set <= cpu_t::highest)
~~~~~~~^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:106:47: error: no member named 'highest' in 'kfr::cpu_t'
if (set >= cpu_t::lowest && set <= cpu_t::highest)
~~~~~~~^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:107:16: error: use of undeclared identifier 'names'
return names[static_cast<size_t>(set)]
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:258:57: error: implicit instantiation of undefined template 'kfr::platform<kfr::cpu_t::generic>'
(const_max(size_t(1), typeclass<T> == datatype::f ? platform<>::native_float_vector_size / sizeof(T)
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:136:8: note: template is declared here
struct platform
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:259:57: error: implicit instantiation of undefined template 'kfr::platform<kfr::cpu_t::generic>'
: platform<>::native_int_vector_size / sizeof(T)))
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:136:8: note: template is declared here
struct platform
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:268:57: error: implicit instantiation of undefined template 'kfr::platform<kfr::cpu_t::generic>'
(const_max(size_t(1), typeclass<T> == datatype::f ? platform<>::minimum_float_vector_size / sizeof(T)
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:136:8: note: template is declared here
struct platform
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:269:57: error: implicit instantiation of undefined template 'kfr::platform<kfr::cpu_t::generic>'
: platform<>::minimum_int_vector_size / sizeof(T)))
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:136:8: note: template is declared here
struct platform
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:272:43: error: implicit instantiation of undefined template 'kfr::platform<kfr::cpu_t::generic>'
constexpr static size_t vector_capacity = platform<>::simd_register_count* vector_width<T>
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:136:8: note: template is declared here
struct platform
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:280:51: error: implicit instantiation of undefined template 'kfr::platform<kfr::cpu_t::generic>'
static_cast<size_t>(32), const_max(size_t(1), platform<>::simd_register_count / 4) * vector_width<T>)
^
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/../simd/platform.hpp:136:8: note: template is declared here
struct platform
^
D:\workspace\xxx\kfr.js\lib\kfr\cmake\detect_cpu.cpp:7:17: error: no member named 'detect_cpu' in namespace 'kfr::internal_generic' did you mean simply 'detect_cpu'?
cpu_t cpu = kfr::internal_generic::detect_cpu()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
detect_cpu
D:/workspace/xxx/kfr.js/lib/kfr/include\kfr/runtime/cpuid.hpp:308:7: note: 'detect_cpu' declared here
cpu_t detect_cpu()
^
12 errors generated.
em++: error: 'D:/workspace/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=17 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=D:\workspace\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat -ID:/workspace/xxx/kfr.js/lib/kfr/include -std=gnu++17 -MD -MT CMakeFiles/cmTC_f28ee.dir/detect_cpu.cpp.o -MF CMakeFiles\cmTC_f28ee.dir\detect_cpu.cpp.o.d -c D:\workspace\xxx\kfr.js\lib\kfr\cmake\detect_cpu.cpp -o CMakeFiles\cmTC_f28ee.dir\detect_cpu.cpp.o' failed (1)
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_f28ee.dir\build.make:79: CMakeFiles/cmTC_f28ee.dir/detect_cpu.cpp.o] Error 1
mingw32-make.exe[1]: Leaving directory 'D:/workspace/xxx/kfr.js/lib/build/kfr/tmpdir/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:126: cmTC_f28ee/fast] Error 2
-- RUN_OUT=
-- CPU_ARCH=detect
-- kfr_defines=KFR_DFT_NPo2
-- Configuring done
CMake Warning (dev) at kfr/CMakeLists.txt:231 (add_library):
Policy CMP0063 is not set: Honor visibility properties for all target
types. Run "cmake --help-policy CMP0063" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "kfr_dft" of type "STATIC_LIBRARY" has the following visibility
properties set for CXX:
CXX_VISIBILITY_PRESET
For compatibility CMake is not honoring them for this target.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at kfr/CMakeLists.txt:188 (add_executable):
Policy CMP0063 is not set: Honor visibility properties for all target
types. Run "cmake --help-policy CMP0063" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "detect_cpu" of type "EXECUTABLE" has the following visibility
properties set for CXX:
CXX_VISIBILITY_PRESET
For compatibility CMake is not honoring them for this target.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at kfr/CMakeLists.txt:253 (add_library):
Policy CMP0063 is not set: Honor visibility properties for all target
types. Run "cmake --help-policy CMP0063" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "kfr_io" of type "STATIC_LIBRARY" has the following visibility
properties set for CXX:
CXX_VISIBILITY_PRESET
For compatibility CMake is not honoring them for this target.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: D:/workspace/xxx/kfr.js/lib/build
PS D:\workspace\xxx\kfr.js\lib\build> emcmake cmake -DARCH_TESTS=OFF ..
configure: cmake -DARCH_TESTS=OFF .. -DCMAKE_TOOLCHAIN_FILE=D:\workspace\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR="D:/workspace/emsdk/node/14.15.5_64bit/bin/node.exe" -G "MinGW Makefiles"
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
ARCH_TESTS
-- Build files have been written to: D:/workspace/xxx/kfr.js/lib/build
I am a web front-end engineer. A project running in browser need KFR. So I have been trying some days to compile a "module.c" using KFR as a WASM module. But there a too many troubles.
The detail of wasm:
I'am working on win10 / MinGW64 / CMake / EMSCRIPTEN. What I want to know most at the moment is, can this be successful?
Some problems look about
CPU-ARCH
andSIMD
,