go-face icon indicating copy to clipboard operation
go-face copied to clipboard

Installation in Freebsd (Jail)

Open tmerten opened this issue 3 years ago • 4 comments

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).

  • First I tried to install dlib via a pkg install dlib-cpp which installs version 19.21_1 in /usr/local.
  • Second I built it myself from master, which also installed fine to /usr/local.

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...)

tmerten avatar May 03 '21 16:05 tmerten

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.

jacquesh avatar Jun 24 '21 20:06 jacquesh

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

tmerten avatar Jun 27 '21 15:06 tmerten

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.

siavashs avatar Aug 03 '22 10:08 siavashs

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

hukl avatar Apr 23 '23 20:04 hukl