OpenWrt Forum Archive

Topic: libcap compile error in mac osx

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
While compiling the openwrt in mac os x, I get error in compiling libcap.

/Volumes/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/libcap-2.24/libcap/include/sys/capability.h:24:10: fatal error: 'linux/types.h' file not found
#include <linux/types.h>
         ^
1 error generated.
make[5]: *** [_makenames] Error 1
make[4]: *** [all] Error 2
make[3]: *** [/Volumes/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/libcap-2.24/.built] Error 2
make[3]: Leaving directory `/Volumes/openwrt/feeds/packages/libs/libcap'

I understand that this error is due to compiling in mac os x (isn't it)? Is there any way to compile this library in mac osx?

I am also facing this in mac, using barrrier_breaker. Was this resolved? Is there a work around?

I ran into this too, basically the problem is that during the build for libcap, it makes a binary on the host as an intermediate step for building the library. This binary needs to be built with a host compatible toolchain instead of the cross compile toolchain, so the current Makefile settings just grab whatever default compiler is hanging around (usually clang from xcode) and then tries to build.

However the intermediate binary also needs access to the linux-api-headers that are normally provided by the cross compile toolchain. On linux i figure those headers are part of the default compiler environment anyway, but on mac no such luck. Anyway, if you goto feeds/packages/libs/libcap/Makefile:34 and add -I$(BUILD_DIR_TOOLCHAIN)/linux-dev/include to BUILD_CFLAGS it will build.

Ive also made a issue on github that hopefully will see it fixed: https://github.com/openwrt/packages/issues/1758

The discussion might have continued from here.