crossbuild icon indicating copy to clipboard operation
crossbuild copied to clipboard

pkg-config doesn't work osx/darwin

Open kohanyirobert opened this issue 9 years ago • 0 comments

I'm trying to build a CMake project which locates libs via pkg-config. Based on osxcross's pkg-config README I'm trying to instruct pkg-config where are the dependencies (I've already built those), however calling pkg-config doesn't seem to work (always returns exit code 1 or hangs).

$ docker run -it --rm -v $(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin  multiarch/crossbuild
root@d50c00521f6d:/workdir# pkg-config
root@d50c00521f6d:/workdir# echo $?
1
root@d50c00521f6d:/workdir# pkg-config --version
root@d50c00521f6d:/workdir# echo $?
1
root@d50c00521f6d:/workdir# OSXCROSS_PKG_CONFIG_PATH=/tmp OSXCROSS_PKG_CONFIG_LIBDIR=/tmp pkg-config --libs gthread
...

The last command hangs, I think it's an infinite loop, but I'm not 100% sure. (/tmp is used only for this snippet, it could be anything, doesn't make a difference, if OSXCROSS_PKG_CONFIG_LIBDIR or similar is defined the command hangs.)

I've created the issue here, because I think this problem is related to the fact there is some symlinking magic going on in the Dockerfile. I kinda understand it, but then it's a bit complicated. Sooo ... I think osxcross's "wrapper" script/binary/program calls itself over and over. That's why there's no ouput. Or maybe am wrong.

I've tried another Docker image of osxcross like this

$ docker run --rm --interactive --volume /Users/rkohanyi/git/glib-2.30.3:/glib apriorit/docker-osxcross-10.11:latest << EOF
OSXCROSS_PKG_CONFIG_PATH=/tmp OSXCROSS_PKG_CONFIG_LIBDIR=/tmp x86_64-apple-darwin15-pkg-config --libs sdl2
EOF
Package sdl2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `sdl2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sdl2' found

so osxcross seems to work at least.

Any idea?

kohanyirobert avatar Oct 05 '16 15:10 kohanyirobert