dmlc / dmlc/xgboost

[R-package] compiler warning on clang + arm64 macOS: argument unused during compilation: '-msse2'

Open Beginner friendly
#12,490 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
28.8k
Forks
8.9k
Avg merge
1d 12h
Merged PRs (30d)
54

Description

## Description

While testing the R package after it was switched from `autoconf` to CMake (#12416), I found that `R CMD check --as-cran` now raises 1 WARNING on Apple Silicon (e.g. my M2 macbook).

```text
* checking whether package ‘xgboost’ can be installed ... [181s/183s] WARNING
Found the following significant warnings:
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
```

That warning is harmless (it just means "you used an x86-specific flag on a non-x86 system"), but the fact that `R CMD check --as-cran` emits a `WARNING` could be enough to cause delays publishing to CRAN. It should be fixed if the fix isn't too much complexity.

## Reproducible Example

```console
$ git clean -dfX
$ python -B ops/script/test_r_package.py --task build
$ TEMP_DIR=$(mktemp -d)
$ cp ./xgboost_3.5.0.0.tar.gz "${TEMP_DIR}"/
$ pushd "${TEMP_DIR}"
$ R CMD check --as-cran ./xgboost*.tar.gz
* using R version 4.6.0 (2026-04-24)
* using platform: aarch64-apple-darwin23
* R was compiled by
Apple clang version 17.0.0 (clang-1700.3.19.1)
GNU Fortran (GCC) 14.2.0
* running under: macOS Sonoma 14.4.1
* using session charset: UTF-8
* current time: 2026-08-20 03:35:09 UTC
* using option ‘--as-cran’
...
* checking whether package ‘xgboost’ can be installed ... [181s/183s] WARNING
Found the following significant warnings:
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
See ‘/private/var/folders/6d/80svzp0d0z1dr414fgnvll6h0000gn/T/tmp.Q5X4NeFmeo/xgboost.Rcheck/00install.out’ for details.
```

Looks like that is coming from `dmlc-core`.

```text
[ 3%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/config.cc.o
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
[ 4%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/data.cc.o
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
... etc., etc.
```

## Notes

### Why not just suppress it with a `-Wno` flag?

Suppressing warnings with `-Wno-unused-command-line-argument` is not allowed by the CRAN policies. From https://cran.r-project.org/web/packages/policies.html

> _Packages should not attempt to disable compiler diagnostics, nor to remove other diagnostic information such as symbols in shared objects._

### XGBoost has been on CRAN and using `dmlc-core` for a long time, why would this only be a problem now?

I think the switch to CMake means `dmlc-core`'s compiler flags are coming through from its CMake. I don't see this warning in the most recent CRAN checks for XGBoost on CRAN *(based on XGBoost 3.2.1.1):

* all checks: https://cran.r-project.org/web/checks/check_results_xgboost.html
* macOS arm64 build: https://www.r-project.org/nosvn/R.check/r-oldrel-macos-arm64/xgboost-00install.html

## Approach

* [x] fix in `dmlc-core` (https://github.com/dmlc/dmlc-core/pull/722)
* [ ] update `dmlc-core` submodule here

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the dmlc-core submodule and the linked dmlc-core pull request #722, which contains the compiler-flag fix. Run ops/script/test_r_package.py --task build, then check the resulting package with R CMD check --as-cran on Apple Silicon; done means the submodule update is included and the unused '-msse2' warning no longer appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, r
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.