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

[doc] Cleanup document for building from source. #11145

Merged
merged 7 commits into from
Jan 7, 2025

Conversation

trivialfis
Copy link
Member

@trivialfis trivialfis commented Jan 7, 2025

  • Use ninja uniformly and refer to CMake doc for other options. The latest CMake is cross platform, no need to add special instructions for each OS.
  • Drop support for MSVC with the R package.
  • Stop documenting methods we don't test, like mingw with the Python package.
  • Fix broken links.

Close #11143 .

- Use `ninja` uniformly and refer to CMake doc for other options. The latest CMake is
cross platform, no need to add special instructions for each OS.
- Drop support for MSVC with the R package.
- Stop documenting methods that we don't test, like mingw with the Python package.
@trivialfis
Copy link
Member Author

cc @david-cortes @hcho3

@trivialfis trivialfis requested a review from hcho3 January 7, 2025 07:37
@trivialfis
Copy link
Member Author

In the future, we might merge the Python script for building jvm packages into CMake scripts and eliminate the Python dependency.

@trivialfis trivialfis changed the title [doc] Cleanup document for building from source. [skip ci] [doc] Cleanup document for building from source. Jan 7, 2025
doc/build.rst Outdated

mvn -Duse.cuda=ON install
- OpenMP on MacOS: See :ref:`running_cmake_and_build` for installing ``openmp``. The flag
-``mvn Duse.openmp=OFF`` can be used to disable OpenMP support.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-``mvn Duse.openmp=OFF`` can be used to disable OpenMP support.
-``mvn -Duse.openmp=OFF`` can be used to disable OpenMP support.

@trivialfis trivialfis merged commit a13147b into dmlc:master Jan 7, 2025
56 of 58 checks passed
@trivialfis trivialfis deleted the doc-build branch January 7, 2025 14:52
from the same subfolder ``R-package`` in the repository's root, and by extension, can
be installed through RStudio's build panel if one adds that folder ``R-package`` as an
R package project in the RStudio IDE.
Use the environment variable ``MAKEFLAGS=-j$(nproc)`` if you want to speedup the build. As
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for R packages. MAKEFLAGS needs to be in the user file ~/.R/Makevars.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running this command at the moment with Ubuntu 22.04, and R 4.4.2, it's effective.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAKEFLAGS=-j$(nproc) R CMD INSTALL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's curious (doesn't work for me with install.packages). But would that work if you use devtools to install?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it works.

devtools::load_all(path = "/home/jiamingy/workspace/xgboost_dev/xgboost/R-package")
MAKEFLAGS=-j$(nproc) Rscript ./basic.R

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have verified that there's no ~/.R in my system.


- ``C:\Rtools\bin``
- ``C:\Rtools\mingw_64\bin``
cmake -B build -S . -DR_LIB=ON -GNinja
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this make it use the MSVC compiler by default?

Copy link
Member Author

@trivialfis trivialfis Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a warning at the end of this section, MSVC with R is not supported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if you install windows build tools (e.g. cmake and clang) from microsoft's packages, the default compiler will be msvc if you don't change it in cmake.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it could be helpful to provide instructions for a clang install with a tool like conda to build the package with GPU support.

Copy link
Member Author

@trivialfis trivialfis Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me add a note that cmake on windows with R is not supported either. I tried to make it work with Windows and the latest rtools, it's quite a hack. I don't expect users to do something similar.

The mingw is hidden deep in the rtools43 package.

@david-cortes
Copy link
Contributor

@trivialfis Doesn't the CMake build for R require setting up other variables like the R version and similar?

@trivialfis
Copy link
Member Author

Doesn't the CMake build for R require setting up other variables like the R version and similar?

On Linux, it's quite simple, only the -DR_LIB=ON is required. On Windows, I don't know.

@david-cortes
Copy link
Contributor

Doesn't the CMake build for R require setting up other variables like the R version and similar?

On Linux, it's quite simple, only the -DR_LIB=ON is required. On Windows, I don't know.

First error that I run into on windows:

CMake Error at cmake/modules/FindLibR.cmake:44 (message):
  LIBR_LIB_DIR was not set!

Let me add a note that cmake on windows with R is not supported either.

But then how is xgboost_r_gpu_linux_2.1.3.tar.gz generated?

I don't expect users to do something similar.

Perhaps suggesting installs of cmake, clang, and so on from conda could result in easier instructions?

@trivialfis
Copy link
Member Author

trivialfis commented Jan 7, 2025

But then how is xgboost_r_gpu_linux_2.1.3.tar.gz generated?

That's gpu_linux... not windows. As for Windows, it was a pain #11148 (comment) .

@trivialfis
Copy link
Member Author

Perhaps suggesting installs of cmake, clang, and so on from conda could result in easier instructions?

I use conda on Linux for installing gcc indeed, but have no experience with conda on Windows. Even on Linux, it takes some experience with the underlying runtime like locking:

- sysroot_linux-64==2.28
- gcc_linux-64=13.*

I don't expect Windows to be easier. In addition, I actually use mamba-forge instead of conda, last time I tried it on Windows, the cmd shell was quite broken, and I couldn't get powershell to work.

trivialfis added a commit to trivialfis/xgboost that referenced this pull request Jan 10, 2025
- Use `ninja` uniformly and refer to CMake doc for other options. The latest CMake is cross platform, no need to add special instructions for each OS.
- Drop support for MSVC with the R package.
- Stop documenting methods we don't test, like mingw with the Python package.
- Fix broken links.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMake instructions for R are outdated
3 participants