1

I tried compiling a game I made with glut using RakNet in C++. But whenever try to compile it for browser. I get this error:

lib/RakNet/Source/FileList.cpp:24:10: fatal error: 'sys/io.h' file not found
#include <sys/io.h>
         ^~~~~~~~~~
1 error generated.
emcc: error: '/opt/emscripten-llvm/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -I/home/bonii/.emscripten_cache/sysroot/include/SDL --sysroot=/home/bonii/.emscripten_cache/sysroot -Xclang -iwithsysroot/include/compat lib/RakNet/Source/FileList.cpp -c -o /tmp/emscripten_temp_krrz_u5e/FileList_29.o' failed (returned 1)
bonii
  • 71
  • 1
  • 9
  • `sys/io.h` is a linux header and not available in enscripten – Alan Birtles Jan 05 '23 at 16:44
  • 1
    it's a linux\android platform-dependant header... shouldn't be used directly in most cases. Is there a mismatch with `uio.h`? – Swift - Friday Pie Jan 05 '23 at 16:49
  • im working with a web application, but one of the libraries uses sys/io.h – bonii Jan 05 '23 at 16:50
  • @bonii what it used for? actual header is a wrapper around some assembler calls and includes other headers – Swift - Friday Pie Jan 05 '23 at 16:50
  • it's RakNet.h, a huge library of multiplayer networking – bonii Jan 05 '23 at 16:55
  • 1
    Remove the `#include` and see what failes - you are going to have to re-write the missing functionality. – Richard Critten Jan 05 '23 at 16:59
  • 1
    it;s not supporting WebAssembly environment, inclusion of `/sys/io.h` is an artefact of library's code that `#ifdef`s can't determine your platform and assumes it's something android-like\DOS-like. It's a very low-level library which also uses stack allocation (`alloca`) that's huge problem for WebAssembly afaik. – Swift - Friday Pie Jan 05 '23 at 16:59

0 Answers0