satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
56 stars 13 forks source link

Build failing on Linux when building LLVM from source #205

Open PJ-Finlay opened 1 year ago

PJ-Finlay commented 1 year ago

I'm attempting to build this on Ubuntu 22.04 having issues with a custom built LLVM and emscripten version.

Installed emscripten and LLVM from source from this repo: https://github.com/satoshinm/emscripten/commits/netcraft

My build fails with this output:

[ 96%] Building C object CMakeFiles/craft.dir/deps/tinycthread/tinycthread.c.o
[100%] Linking C executable craft.html
INFO:root:generating system library: libc.bc... (this will be cached in "/home/argosopentech/.emscripten_cache/wasm/libc.bc" for subsequent builds)
/home/argosopentech/emscripten/system/lib/libc/musl/src/internal/floatscan.c:298:7: warning: absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value [-Wabsolute-value]
                if (fabs(y) >= CONCAT(0x1p, LDBL_MANT_DIG)) {
                    ^
/home/argosopentech/emscripten/system/lib/libc/musl/src/internal/floatscan.c:298:7: note: use function 'fabsl' instead
                if (fabs(y) >= CONCAT(0x1p, LDBL_MANT_DIG)) {
                    ^~~~
                    fabsl
1 warning generated.
/home/argosopentech/emscripten/system/lib/libc/musl/src/math/nearbyintf.c:7:15: error: '#pragma FENV_ACCESS' is not supported on this target - ignored [-Werror,-Wignored-pragmas]
        #pragma STDC FENV_ACCESS ON
                     ^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
Traceback (most recent call last):
  File "/home/argosopentech/emscripten/emcc.py", line 2391, in <module>
    run()
  File "/home/argosopentech/emscripten/emcc.py", line 1541, in run
    extra_files_to_link += system_libs.calculate([f for _, f in sorted(temp_files)] + extra_files_to_link, in_temp, stdout_=None, stderr_=None, forced=forced_stdlibs)
  File "/home/argosopentech/emscripten/tools/system_libs.py", line 405, in calculate
error: unable to open output file '/tmp/tmpnNxLL7/jnf.c.o': 'No such file or directory'
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
    libfile = shared.Cache.get(name, do_create, extension=suffix)
  File "/home/argosopentech/emscripten/tools/cache.py", line 96, in get
    temp = creator()
  File "/home/argosopentech/emscripten/tools/system_libs.py", line 403, in do_create
    ret = create(name)
  File "/home/argosopentech/emscripten/tools/system_libs.py", line 123, in create_libc
    return build_libc(libname, libc_files, args)
  File "/home/argosopentech/emscripten/tools/system_libs.py", line 69, in build_libc
    run_commands(commands)
  File "/home/argosopentech/emscripten/tools/system_libs.py", line 28, in run_commands
    pool.map_async(call_process, commands, chunksize=1).get(maxint)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
Exception: Command '/usr/bin/python2 /home/argosopentech/emscripten/emcc /home/argosopentech/emscripten/system/lib/libc/musl/src/math/nearbyintf.c -o /tmp/tmpnNxLL7/nearbyintf.c.o -I /home/argosopentech/emscripten/system/lib/libc/musl/src/internal -I /home/argosopentech/emscripten/system/lib/libc/musl/arch/js -Werror -Wno-return-type -Wno-parentheses -Wno-ignored-attributes -Wno-shift-count-overflow -Wno-shift-negative-value -Wno-dangling-else -Wno-unknown-pragmas -Wno-shift-op-parentheses -Wno-string-plus-int -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-visibility -Wno-pointer-sign -Wno-error=absolute-value -Os' returned non-zero exit status 1
error: unable to open output file '/tmp/tmpnNxLL7/nextafter.c.o': 'No such file or directory'
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
error: unable to open output file '/tmp/tmpnNxLL7/ldexpf.c.o': 'No such file or directory'
1 error generated.
error: unable to open output file '/tmp/tmpnNxLL7/cbrt.c.o': 'No such file or directory'
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
make[2]: *** [CMakeFiles/craft.dir/build.make:491: craft.html] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/craft.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

emsdk also no longer supports 1.37.12 and only has versions after 1.38.33.

TamaMcGlinn commented 1 year ago

Had the same problem with compiling from source. But did you try ./emsdk install emscripten-1.37.12 to get 1.37.12 ? It seems to download fine. Where does the problem arise going that route?

PJ-Finlay commented 1 year ago

When I installed emsdk it didn't support versions earlier than 1.38.33, maybe I need an earlier version of emsdk.