dmlc / dmlc-core

A common bricks library for building scalable and portable distributed machine learning.
Apache License 2.0
864 stars 520 forks source link

[FIX] Build process shouldn’t modify source tree #566

Closed codingforfun closed 5 years ago

codingforfun commented 5 years ago

It’s best practice to not modify the source tree during build time. CMake strongly encourages this. This PR changes the cmake build process to create the confuigured header file build_config.h in the build tree instead of the source tree.

codingforfun commented 5 years ago

Travis fails on some utests build using Makefiles separate from the ones build by CMake. Is that really used anymore. Test build with CMake work. I’m not very keen to dive into some ancient stuff if it’s not needed any more.

hcho3 commented 5 years ago

@codingforfun See dmlc/dmlc-core#561. This is an issue unrelated to your work here, so don't worry about it.

rongou commented 5 years ago

This seems to break the xgboost build:

git clone --recurse-submodules https://github.com/dmlc/xgboost.git
cd xgboost
mkdir build
cd build
cmake ..
make

I get the following error:

In file included from /home/rou/src/xgboost/include/../../dmlc-core/include/dmlc/./logging.h:16,
                 from /home/rou/src/xgboost/include/../../dmlc-core/include/dmlc/io.h:15,
                 from /home/rou/src/xgboost/rabit/include/rabit/./internal/../serializable.h:14,
                 from /home/rou/src/xgboost/rabit/include/rabit/./internal/engine.h:10,
                 from /home/rou/src/xgboost/rabit/include/rabit/rabit.h:48,
                 from /home/rou/src/xgboost/src/common/timer.cc:4:
/home/rou/src/xgboost/include/../../dmlc-core/include/dmlc/././base.h:282:10: fatal error: dmlc/build_config.h: No such file or directory
 #include <dmlc/build_config.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
src/CMakeFiles/objxgboost.dir/build.make:153: recipe for target 'src/CMakeFiles/objxgboost.dir/common/timer.cc.o' failed
make[2]: *** [src/CMakeFiles/objxgboost.dir/common/timer.cc.o] Error 1
CMakeFiles/Makefile2:295: recipe for target 'src/CMakeFiles/objxgboost.dir/all' failed
make[1]: *** [src/CMakeFiles/objxgboost.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Any ideas on what's going on?

hcho3 commented 5 years ago

@rongou I just tried git clone --recurse-submodules https://github.com/dmlc/xgboost.git and I cannot reproduce the problem.

rongou commented 5 years ago

Hmm never mind. Somehow it's picking up a separate dmlc-core repo on my drive. Once I deleted it the problem went away.