C API make install

Hi,

I was trying to follow this tutorial on C API (https://github.com/dmlc/xgboost/blob/master/doc/tutorials/c_api_tutorial.rst#configure-cmakelist-txt-file-of-your-application-to-link-with-xgboost) but after building xgboost with
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
i type make install and get the following error : make: *** No rule to make target install’. Stop.`
Any idea what is wrong? I am on windows 10 and using Visual Studio for my projects

The tutorial was written to work on Linux environment.

Thank you! I switched to Linux and it worked indeed, but i have another issue - when running the following code:

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include
#include <xgboost/c_api.h>

int main(int argc, char** argv) {
DMatrixHandle data;
const int ROWS = 5, COLS = 3;
const float data2[ROWS][COLS] = { {1, 2, 3}, {2, 4, 6}, {3, -1, 9}, {4, 8, -1}, {2, 5, 1} };
DMatrixHandle dmatrix2;
XGDMatrixCreateFromMat(*data2, ROWS, COLS, -1, &dmatrix2);

std::cout << “Hello world” << std::endl;
return 0;
}

and trying, while debugging, go into DMatrixHandle for example putting a breakpoint there It doesn’t git it and when i put the mouse cursor on the breakpoint i see “Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.”

Any help please?

This is because XGBoost doesn’t have the debug symbols, which are needed to set breakpoints with a debugger.

Did you install XGBoost by building it from the source? When running the cmake command, enable the debug mode by adding -DCMAKE_BUILD_TYPE=Debug:

cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
1 Like

Thanks a lot it worked!

I’m interested in this topic since I have to implement XGBoost in C (on Windows). Do you have any idea of how to do it? I have tried with minGW64 but however I have problems