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

Unable to install go module in MAC OS #24

Closed
iamprashant opened this issue Sep 21, 2022 · 10 comments
Closed

Unable to install go module in MAC OS #24

iamprashant opened this issue Sep 21, 2022 · 10 comments

Comments

@iamprashant
Copy link

Thanks for taking the effort on starting go wrapper for treelite.

Have already built and installed treelite fom source.

❯ ls -l /usr/local/lib/libtreelite_runtime.dylib
.rwxr-xr-x 184k root 21 Sep 15:55 /usr/local/lib/libtreelite_runtime.dylib

Platform and version.
M1. 16 GB
go version go1.17.7 darwin/amd64

`
go get github.com/getumen/go-treelite  42% 

github.com/getumen/go-treelite

ld: warning: ignoring file /usr/local/lib/libtreelite_runtime.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /usr/local/lib/libtreelite.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"_TreeliteAnnotateBranch", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteAnnotateBranch in _x002.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteAnnotateBranch)
"_TreeliteAnnotationFree", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteAnnotationFree in _x002.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteAnnotationFree)
"_TreeliteAnnotationSave", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteAnnotationSave in _x002.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteAnnotationSave)
"_TreeliteCompilerCreateV2", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteCompilerCreateV2 in _x003.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteCompilerCreateV2)
"_TreeliteCompilerFree", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteCompilerFree in _x003.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteCompilerFree)
"_TreeliteCompilerGenerateCodeV2", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteCompilerGenerateCodeV2 in _x003.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteCompilerGenerateCodeV2)
"_TreeliteDMatrixCreateFromCSR", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixCreateFromCSR in _x004.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixCreateFromCSR)
"_TreeliteDMatrixCreateFromMat", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixCreateFromMat in _x004.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixCreateFromMat)
"_TreeliteDMatrixFree", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixFree in _x004.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixFree)
"_TreeliteDMatrixGetDimension", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixGetDimension in _x004.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteDMatrixGetDimension)
"_TreeliteFreeModel", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteFreeModel in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteFreeModel)
"_TreeliteLoadLightGBMModel", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteLoadLightGBMModel in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteLoadLightGBMModel, __cgo_57a9b4bf9154_Cfunc_TreeliteLoadLightGBMModelFromString )
"_TreeliteLoadLightGBMModelFromString", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteLoadLightGBMModelFromString in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteLoadLightGBMModelFromString)
"_TreeliteLoadXGBoostJSON", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostJSON in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostJSON, __cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostJSONString )
"_TreeliteLoadXGBoostJSONString", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostJSONString in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostJSONString)
"_TreeliteLoadXGBoostModel", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostModel in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostModel, __cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostModelFromMemoryBuffer )
"_TreeliteLoadXGBoostModelFromMemoryBuffer", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostModelFromMemoryBuffer in _x005.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreeliteLoadXGBoostModelFromMemoryBuffer)
"_TreelitePredictorFree", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreelitePredictorFree in _x006.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreelitePredictorFree)
"_TreelitePredictorLoad", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreelitePredictorLoad in _x006.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreelitePredictorLoad)
"_TreelitePredictorPredictBatch", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreelitePredictorPredictBatch in _x006.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreelitePredictorPredictBatch)
"_TreelitePredictorQueryLeafOutputType", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreelitePredictorQueryLeafOutputType in _x006.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreelitePredictorQueryLeafOutputType)
"_TreelitePredictorQueryNumClass", referenced from:
__cgo_57a9b4bf9154_Cfunc_TreelitePredictorQueryNumClass in _x006.o
(maybe you meant: __cgo_57a9b4bf9154_Cfunc_TreelitePredictorQueryNumClass)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`

Looking forward to contributing in future. Thanks

@getumen
Copy link
Owner

getumen commented Sep 30, 2022

@iamprashant Thank you for your issue.
This error occurred because your dynamic library was build for intel or amd chipset (x86_64).
Your chipset looks M1 (arm).

Can you build and install treelite again?

git clone [email protected]:dmlc/treelite.git
cd treelite
mkdir build
cd build

# cmake is required.
cmake ..

# password is required.
sudo make install

@github-actions
Copy link

This issue is stale because it has been open for 60 days with no activity.

@saihow1999
Copy link

saihow1999 commented Jun 7, 2023

Hey @getumen, First of thanks for creating this repo.
I am also facing the same issue. Also tried this above method you mentioned above. But the problem is that when I execute this step
git clone [email protected]:dmlc/treelite.git
Inside the treelite folder I am not getting c_api_common.h and c_api_runtime.hfile . Causing the issue in runtime.

@getumen
Copy link
Owner

getumen commented Jun 7, 2023

@saihow1999
Please use treelite v3.
Treelite default branch is v4 now.
There are many breaking changes in Treelite v4.
c_api_common.h and c_api_runtime.h is removed in Treelite v4.
dmlc/treelite#465

@saihow1999
Copy link

saihow1999 commented Jun 13, 2023

I cloned the release_3.0 branch of treelite and followed all the steps you mentioned but I am still getting this error
image

@getumen
Copy link
Owner

getumen commented Jun 13, 2023

@saihow1999 oh, sorry.
please use 3.4.0 branch

git clone https://github.com/dmlc/treelite.git -b 3.4.0

@saihow1999
Copy link

@getumen, Yes it was the initial branch I cloned with. But the same issue persists there too. I am using Apple M1 Pro, 16GB RAM and my OS is 13.4 (22F66). Like mentioned above, it is not able to find any .h files. Can you please help to debug this issue ?

@getumen
Copy link
Owner

getumen commented Jun 16, 2023

@saihow1999 At first, I want to know Treelite is installed correctly.
This is an example in my environment.

$ ls /usr/local/include/treelite
annotator.h       c_api_runtime.h   filesystem.h      math.h            thread_local.h
base.h            compiler.h        frontend.h        omp.h             tree.h
c_api.h           compiler_param.h  frontend_impl.h   omp_exception.h   tree_impl.h
c_api_common.h    data.h            gtil.h            optional.h        typeinfo.h
c_api_error.h     error.h           logging.h         predictor.h       version.h

I found that /usr/local/include is not default include path in some osx version.
Can you try to add /usr/local/include to include path explicitly?

export CPATH=$CPATH:/usr/local/include

https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html

@saihow1999
Copy link

saihow1999 commented Jun 16, 2023

Hi @getumen,
Using export CPATH=$CPATH:/usr/local/include didn't solve the issue, but after manually copying all the files into the
/usr/local/include solved the issue. But at the same time it introduce a new error whose screenshot I am attaching below:
image
I think it is now not able to find the treelite library in your library: go-treelite

@getumen
Copy link
Owner

getumen commented Jun 18, 2023

@saihow1999 That implies installing treelite was failed.
Please try to install treelite again.
https://github.com/getumen/go-treelite#install-treelite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants