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

Trouble building xgboost; underlying folders needed for building #37

Open
erikvona opened this issue Jul 5, 2024 · 0 comments
Open
Labels
feature a feature request or enhancement

Comments

@erikvona
Copy link

erikvona commented Jul 5, 2024

I'm trying to build xgboost using rwasm.

I've gotten this far

# Download xgboost
git clone --recursive https://github.com/dmlc/xgboost
# Remove a check which errors on cross compiling, ideally I'd have a better solution here
cp  xgboost/R-package/configure  xgboost/R-package/configure_old
sed '2799s/yes/sabotaged/' xgboost/R-package/configure_old > xgboost/R-package/configure 
R
> rwasm::build("./xgboost/R-package")

The problem, however, is that the xgboost C++ code makes reference to files in the xgboost folder, but wasm_build is copying the sources to a temporary folder. Thus, the build fails:

...
Makevars:19: -DDMLC_LOG_CUSTOMIZE=1
em++ -std=gnu++17 -DNDEBUG -I../..//include -I../..//dmlc-core/include -I../../ -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.4.1/build/include -I/opt/webr/R/build/R-4.4.1/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -DDMLC_CMAKE_LITTLE_ENDIAN=0 -pthread -fvisibility=hidden -fpic  -std=gnu++17 -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__  -c xgboost_R.cc -o xgboost_R.o
xgboost_R.cc:4:10: fatal error: 'dmlc/common.h' file not found
    4 | #include <dmlc/common.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
em++: error: '/opt/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/opt/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -std=gnu++17 -DNDEBUG -I../..//include -I../..//dmlc-core/include -I../../ -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.4.1/build/include -I/opt/webr/R/build/R-4.4.1/src/include -DDMLC_CMAKE_LITTLE_ENDIAN=0 -pthread -fvisibility=hidden -fpic -std=gnu++17 -Oz -fPIC -fwasm-exceptions -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c -matomics -mbulk-memory xgboost_R.cc -o xgboost_R.o' failed (returned 1)
make: *** [/opt/R/4.4.1/lib/R/etc/Makeconf:202: xgboost_R.o] Error 1
ERROR: compilation failed for package 'xgboost'
* removing '/tmp/RtmpIa1YGR/filef4c19d57d04/xgboost'
Error in wasm_build(pkg, tarball_path, out_dir) :
  Building wasm binary for package 'xgboost' failed.

This is even though the call to em++ is valid, as can be seen:

cd xgboost/R-package/src
em++ -std=gnu++17 -DNDEBUG -I../..//include -I../..//dmlc-core/include -I../../ -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1  -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.4.1/build/include -I/opt/webr/R/build/R-4.4.1/src/include -s USE_BZIP2=1 -s USE_ZLIB=1 -DDMLC_CMAKE_LITTLE_ENDIAN=0 -pthread -fvisibility=hidden -fpic  -std=gnu++17 -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__  -c xgboost_R.cc -o xgboost_R.o

This returns without error and creates xgboost_R.o

I'm not sure how to proceed. Perhaps a function could be created that allows copying of underlying directories?

@georgestagg georgestagg added feature a feature request or enhancement and removed enhancement labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants