编译openwrt包时生成错误

时间:2014-11-28 09:54:08

标签: makefile openwrt

我想为openwrt构建包

我使用这个openwrt Makefile:

包括$(TOPDIR)/rules.mk

PKG_NAME:=libxmpp
PKG_VERSION:=2012-06-11
PKG_RELEASE=1

PKG_FIXUP:=autoreconf

include $(INCLUDE_DIR)/package.mk

define Package/libxmpp
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=xmpp library
  DEPENDS:=+libstdcpp
endef

define Package/libxmpp/description
 A xmpp client
endef


CONFIGURE_ARGS += \
    --disable-threads \
    --enable-static \
    --enable-shared

USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
ifneq ($(USE_LOCAL),)
define Build/Prepare
    $(CP) ./src/* $(PKG_BUILD_DIR)
endef
endif

define Package/libxmpp/install
    $(INSTALL_DIR) $(1)/usr/lib
    $(CP) $(PKG_BUILD_DIR)/libxmpp.so* $(1)/usr/lib
endef

define Build/InstallDev
    $(INSTALL_DIR) $(1)/usr/include
    $(CP) $(PKG_BUILD_DIR)/xmpp.h $(1)/usr/include
    $(INSTALL_DIR) $(1)/lib
    $(CP) $(PKG_BUILD_DIR)/libxmpp.so* $(1)/usr/lib
endef


$(eval $(call BuildPackage,libxmpp))

xmmp的Makefile如下:

CFLAGS := -fPIC -O3 -g -Wall -Werror
MAJOR := 0
MINOR := 1
NAME := xmpp
VERSION := $(MAJOR).$(MINOR)

lib: lib$(NAME).so.$(VERSION)

lib$(NAME).so.$(VERSION): $(NAME).o
    $(CXX) -shared -Wl,-soname,lib$(NAME).so.$(MAJOR) $^ -o $@

clean:
    $(RM) *.o *.so*

但是在编译包时出现了这个错误:

make[3]: Entering directory `/home/anis/cwmp/AA3/package/libxmpp'
rm -f /home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/stamp/.libxmpp_installed
make[3]: [clean-staging] Error 123 (ignored)
make[3]: Leaving directory `/home/anis/cwmp/AA3/package/libxmpp'
rm -rf /home/anis/cwmp/AA3/tmp/stage-libxmpp
mkdir -p /home/anis/cwmp/AA3/tmp/stage-libxmpp/host /home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/packages /home/anis/cwmp/AA3/staging_dir/host/packages
install -d -m0755 /home/anis/cwmp/AA3/tmp/stage-libxmpp/usr/include
cp -fpR /home/anis/cwmp/AA3/build_dir/target-i386_uClibc-0.9.33.2/libxmpp-2012-06-11/xmpp.h /home/anis/cwmp/AA3/tmp/stage-libxmpp/usr/include
install -d -m0755 /home/anis/cwmp/AA3/tmp/stage-libxmpp/lib
cp -fpR /home/anis/cwmp/AA3/build_dir/target-i386_uClibc-0.9.33.2/libxmpp-2012-06-11/libxmpp.so* /home/anis/cwmp/AA3/tmp/stage-libxmpp/usr/lib
find /home/anis/cwmp/AA3/tmp/stage-libxmpp -name '*.la' | xargs -r rm -f; 
if [ -f /home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/packages/libxmpp.list ]; then /home/anis/cwmp/AA3/scripts/clean-package.sh "/home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/packages/libxmpp.list" "/home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2"; fi
if [ -d /home/anis/cwmp/AA3/tmp/stage-libxmpp ]; then (cd /home/anis/cwmp/AA3/tmp/stage-libxmpp; find ./ > /home/anis/cwmp/AA3/tmp/stage-libxmpp.files);    SHELL= /home/anis/cwmp/AA3/staging_dir/host/bin/flock /home/anis/cwmp/AA3/tmp/.staging-dir.flock -c ' mv /home/anis/cwmp/AA3/tmp/stage-libxmpp.files /home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/packages/libxmpp.list && cp -fpR /home/anis/cwmp/AA3/tmp/stage-libxmpp/* /home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/; '; fi
cp: cannot overwrite directory `/home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/usr/lib' with non-directory
make[2]: *** [/home/anis/cwmp/AA3/staging_dir/target-i386_uClibc-0.9.33.2/stamp/.libxmpp_installed] Error 1
make[2]: Leaving directory `/home/anis/cwmp/AA3/package/libxmpp'
make[1]: *** [package/libxmpp/compile] Error 2
make[1]: Leaving directory `/home/anis/cwmp/AA3'
make: *** [package/libxmpp/compile] Error 2

1 个答案:

答案 0 :(得分:0)

我的预感就是这一行:

$(CP) $(PKG_BUILD_DIR)/libxmpp.so* $(1)/usr/lib

将其解析为

$(CP) $(PKG_BUILD_DIR)/libxmpp.so* $(1)/usr/lib/

解决问题?