LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

Touble in calling lib_lightgbm.so

Open MenglaiWang opened this issue 9 years ago • 11 comments

Please search your question on previous issues, stackoverflow or other search engines before you open a new one.

For bugs and unexpected issues, please provide following information, so that we could reproduce on our system.

Environment info

Operating System:CentOS release 6.3 (Final) CPU:Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz C++/Python/R version:C++ GCC:4.8.2

Error Message:

OSError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./lib_lightgbm.so)

Reproducible examples

Steps to reproduce

1. 2. 3.

Hi, guolinke, Thanks for sharing your code, I came into some trouble using lib_lightgbm.so in python calling c_api. In the Installation guide, it needs glibc >=2.14。But my server cannot using it cause it cannot connect to the internet. How can I rebuild the lib_lightgbm.so by staticly linking libstdc++ instead of installing glibc2.14?

MenglaiWang avatar Jul 17 '17 13:07 MenglaiWang

@MenglaiWang How do you install LightGBM ? by pip install lightgbm ?

I think you need to compile the cpp code in your machine, by using pip install --no-binary :all: lightgbm

guolinke avatar Jul 17 '17 13:07 guolinke

I compile the C++ code , and in the root dir, there is a lib_lightgbm.so.

MenglaiWang avatar Jul 17 '17 13:07 MenglaiWang

I try to use the .so , and then got the error

MenglaiWang avatar Jul 17 '17 13:07 MenglaiWang

The .so file is compiled by the machine you are running with ?

guolinke avatar Jul 17 '17 13:07 guolinke

Yes, so I don't know why I cant use the .so file

MenglaiWang avatar Jul 17 '17 13:07 MenglaiWang

@MenglaiWang

It is a very strange thing that you can compile it but cannot run it.

You can try to add following after this line: https://github.com/Microsoft/LightGBM/blob/master/CMakeLists.txt#L57

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")

However, -stdlib=libc++ seems is enabled by default. And it seems the libc++ rely on the glibc, not sure can it works or not.

guolinke avatar Jul 17 '17 13:07 guolinke

OK,I will try It😁

MenglaiWang avatar Jul 17 '17 13:07 MenglaiWang

it's a glib issue, please upgrade your GCC.

you can refer to :https://github.com/Microsoft/CNTK/issues/729

chivee avatar Jul 18 '17 05:07 chivee

I recompile my python by gcc 4.8.2, and I can use it now.

MenglaiWang avatar Jul 20 '17 13:07 MenglaiWang

Sorry, but I'm confused. How to recompile python code. I met exactly the same problem as yours.

xiaoye-hua avatar Jul 25 '18 05:07 xiaoye-hua

@HuaGuo1992 Try this

chivee avatar Jul 25 '18 06:07 chivee