Should src/metric/auc.{h,cc,cu} be forced to be linked statically?

While I was running a few tests for the R binding, e.g., (R-package/tests/testthat/test_ranking.R), it fails because metric function ‘auc’ cannot be found. Later I’ve found out that it’s because src/metric/auc.{h,cc,cu} isn’t linked statically (my build system compile the C/C++ components into a .so), and thus its registration logic wasn’t run.

There are logic within src/metric/metric.cc that force static linking of other metric functions (e.g., elementwise_metric ), but ‘auc’ isn’t one of them.

I’m not familiar enough with the codebase to tell if this is a bug or intended behavior (why single out ‘auc’?).

I think it’s an oversight. Can you submit a pull request to fix it?

Thanks for getting back to me! I have created the PR https://github.com/dmlc/xgboost/pull/8039.