Kagami / go-face

:mag: Face recognition with Go
Creative Commons Zero v1.0 Universal
1.11k stars 169 forks source link

Installation in Freebsd (Jail) #71

Open tmerten opened 3 years ago

tmerten commented 3 years ago

Hi there,

I am trying to go get go-face on freebsd 1202000 (well, it is used as a dependency in photoview but I guess that does not matter).

However, in both cases I am getting the following:

go get github.com/Kagami/go-face
# github.com/Kagami/go-face
classify.cc:2:10: fatal error: 'dlib/graph_utils.h' file not found

Maybe somebody has an idea. Unfortunately my go experience is in the range zero + search engine. (This pointed me to #19 but I could not solve anything from there...)

jacquesh commented 3 years ago

I ran into this same issue while building something else which depends on go-face. I don't know if cgo is meant to use pkg-config (or similar) somehow automatically but really all that was missing was the specification of where the includes and libs are.

Manually adding -I/usr/local/include to the CXXFLAGS comment and adding -L/usr/local/lib to the LDFLAGS comment in face.go got it compiling for me, although I expect that is not the intended workflow.

tmerten commented 3 years ago

@jacquesh : thanks, that worked for me, too.

siavashs commented 2 years ago

For anyone hitting the same issue, using the following env works without needing to modify any source files. Here I was building photoview which uses go-face as a dependency:

env CGO_CFLAGS="-I/usr/local/include/" CGO_CXXFLAGS="-I/usr/local/include" CGO_LDFLAGS="-L/usr/local/lib" go build -v -o photoview .

Since FreeBSD installs all extra libraries in /usr/local it would make sense to add the above flags to CGO in go package on FreeBSD by default for better user experience. I'll check if it's possible and open a PR for the go package.

hukl commented 1 year ago

Thanks for the env line - that just saved me a lot of time!