【问题标题】:buildroot is appending a wrong PREFIX to custom package buildbuildroot 将错误的 PREFIX 附加到自定义包构建
【发布时间】:2015-08-21 13:48:24
【问题描述】:

我正在尝试将 WSO2 WSF/C 自定义包包含到 buildroot 交叉编译 ARM 项目中。到目前为止,这是 wsfc.mk 文件:

################################################################################
#
# WSO2 WSF/C 
#
################################################################################

    WSFC_VERSION = 2.0.0
    WSFC_SOURCE_BASENAME = wso2-wsf-c-src-$(WSFC_VERSION)
    WSFC_SOURCE = $(WSFC_SOURCE_BASENAME).zip
    WSFC_SITE = $(BR2_EXTERNAL)/package/wsfc/
    WSFC_SITE_METHOD = file
    WSFC_PREFIX = /usr/local/wso/wsf_c/
    WSFC_CONF_OPTS = --prefix=$(WSFC_PREFIX) --exec-prefix=$(WSFC_PREFIX) \
                     --enable-rampart=no --enable-sandesha=no --enable-savan=no

    define WSFC_EXTRACT_CMDS
        unzip $(DL_DIR)/$(WSFC_SOURCE) -d $(@D)
        mv $(@D)/$(WSFC_SOURCE_BASENAME)/* $(@D)
        rmdir $(@D)/$(WSFC_SOURCE_BASENAME)
    endef

    $(eval $(autotools-package))

问题,

WSFC_PREFIX = /usr/local/wso/wsf_c/ 时尝试在主机中安装示例,因此权限被拒绝

[... lot of buildroot log output then:]
/usr/bin/make  install-data-hook
make[5]: Entering directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
mkdir -p /usr/local/wso/wsf_c/samples/src/axis2c
mkdir: cannot create directory ‘/usr/local/wso’: Permission denied
make[5]: *** [install-data-hook] Error 1
make[5]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[4]: *** [install-data-am] Error 2
make[4]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[3]: *** [install-am] Error 2
make[3]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0'
make: *** [/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/.stamp_target_installed] Error 2

WSFC_PREFIX = $(TARGET_DIR)/usr/local/wso/wsf_c/的时候没有报错,但是重复了前缀,把几个文件安装在了错误的地方(..home../target/home/...)

[... lot of buildroot log output then:]
test -z "/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c" || /bin/mkdir -p "/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c"
test -z "/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/docs" || /bin/mkdir -p "/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/docs"
 /usr/bin/install -c -m 644 'config/axis2.xml' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/axis2.xml'
 /usr/bin/install -c -m 644 'README' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/README'
 /usr/bin/install -c -m 644 'INSTALL' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/INSTALL'
 /usr/bin/install -c -m 644 'COPYING' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/COPYING'
 /usr/bin/install -c -m 644 'NEWS' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/NEWS'
 /usr/bin/install -c -m 644 'CREDITS' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/CREDITS'
 /usr/bin/install -c -m 644 'NOTICE' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/NOTICE'
[... lot of buildroot log output ]

我认为它需要修复补丁,但我不熟悉自动工具,我不知道我应该在哪里修补以及 buildroot 如何在 make 期间附加前缀以避免此类行为。

【问题讨论】:

    标签: makefile autotools prefix buildroot


    【解决方案1】:

    WSF/C 源没有正确使用自动工具。有一些手动编写的安装钩子,但它们没有在目标位置包含 $(DESTDIR)/ 前缀。所以这些东西都安装在宿主系统中,而不是在输出/目标目录中。

    最简单的解决方案是不安装示例。

    这里是修复源代码并将其集成到 buildroot 的文件和补丁。

    wsfc.mk

    ################################################################################
    #
    # WSO2 WSF/C 
    #
    ################################################################################
    
    WSFC_VERSION = 2.0.0
    WSFC_SOURCE_BASENAME = wso2-wsf-c-src-$(WSFC_VERSION)
    WSFC_SOURCE = $(WSFC_SOURCE_BASENAME).zip
    WSFC_SITE = $(BR2_EXTERNAL)/package/wsfc/
    WSFC_SITE_METHOD = file
    WSFC_PREFIX = /usr/local/wso/wsf_c/
    WSFC_CONF_OPTS = --prefix=$(WSFC_PREFIX) --exec-prefix=$(WSFC_PREFIX) --enable-rampart=no --enable-sandesha=no --enable-savan=no
    
    define WSFC_EXTRACT_CMDS
        unzip $(DL_DIR)/$(WSFC_SOURCE) -d $(@D)
        mv $(@D)/$(WSFC_SOURCE_BASENAME)/* $(@D)
        rmdir $(@D)/$(WSFC_SOURCE_BASENAME)
    endef
    
    $(eval $(autotools-package))
    

    0001-samples-destdir-fix.patch

    diff -ENwbur wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.am wso2-wsf-c-src-2.0.0/axis2c/Makefile.am
    --- wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.am    2015-08-21 16:33:24.807351795 -0300
    +++ wso2-wsf-c-src-2.0.0/axis2c/Makefile.am 2015-08-21 16:37:58.994193027 -0300
    @@ -30,6 +30,8 @@
        rm -rf axis2c-bin-${PACKAGE_VERSION}-linux
    
     install-data-hook:
    -   mkdir -p $(samplesdir)/src/axis2c
    -   cp -rf samples/* $(samplesdir)/src/axis2c
    +   @:
    +
    +   #mkdir -p $(samplesdir)/src/axis2c
    +   #cp -rf samples/* $(samplesdir)/src/axis2c
    
    diff -ENwbur wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.in wso2-wsf-c-src-2.0.0/axis2c/Makefile.in
    --- wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.in    2015-08-21 16:33:25.191159781 -0300
    +++ wso2-wsf-c-src-2.0.0/axis2c/Makefile.in 2015-08-21 16:38:25.178193336 -0300
    @@ -823,8 +823,10 @@
        rm -rf axis2c-bin-${PACKAGE_VERSION}-linux
    
     install-data-hook:
    -   mkdir -p $(samplesdir)/src/axis2c
    -   cp -rf samples/* $(samplesdir)/src/axis2c
    +   @:
    +
    +   #mkdir -p $(samplesdir)/src/axis2c
    +   #cp -rf samples/* $(samplesdir)/src/axis2c
     # Tell versions [3.59,3.63) of GNU make to not export all variables.
     # Otherwise a system limit (for SysV at least) may be exceeded.
     .NOEXPORT:
    diff -ENwbur wso2-wsf-c-src-2.0.0.orig/Makefile.am wso2-wsf-c-src-2.0.0/Makefile.am
    --- wso2-wsf-c-src-2.0.0.orig/Makefile.am   2015-08-21 16:33:24.775367794 -0300
    +++ wso2-wsf-c-src-2.0.0/Makefile.am    2015-08-21 16:40:42.506194955 -0300
    @@ -10,24 +10,28 @@
        sh dist_hook.sh
    
     samples:
    -   sh build_samples.sh $(prefix)
    -   mkdir -p  $(samplesdir)/src/wsf_c
    -   cp -rf examples/* $(samplesdir)/src/wsf_c
    -   cd $(samplesdir)
    -   rm -rf `find $(samplesdir)/ -type d -name *.svn`
    -   rm -rf `find $(samplesdir)/ -type d -name *.libs`
    -   rm -rf `find $(samplesdir)/ -type d -name *.deps`
    -   rm -rf `find $(samplesdir)/ -type f -name Makefile`
    -   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    -   cp config/axis2.xml $(prefix)
    +   @:
    +   
    +   #sh build_samples.sh $(prefix)
    +   #mkdir -p  $(samplesdir)/src/wsf_c
    +   #cp -rf examples/* $(samplesdir)/src/wsf_c
    +   #cd $(samplesdir)
    +   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
    +   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
    +   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    +   #cp config/axis2.xml $(prefix)
    
     install-data-hook:
    -   cp -rf docs/* $(docsdir)
    -   rm -rf `find $(samplesdir)/ -type d -name *.svn`
    -   rm -rf `find $(samplesdir)/ -type d -name *.libs`
    -   rm -rf `find $(samplesdir)/ -type d -name *.deps`
    -   rm -rf `find $(samplesdir)/ -type f -name Makefile`
    -   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    +   @:
    +   
    +   #cp -rf docs/* $(docsdir)
    +   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
    +   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
    +   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    
     EXTRA_DIST=build_samples.sh config build.bat clean.bat docs CREDITS NOTICE examples LICENSE configure.in link_samples.sh link.sh build/build_optional.bat build/optional.mk build/init.bat build/versions.in test build/codegen
    
    diff -ENwbur wso2-wsf-c-src-2.0.0.orig/Makefile.in wso2-wsf-c-src-2.0.0/Makefile.in
    --- wso2-wsf-c-src-2.0.0.orig/Makefile.in   2015-08-21 16:33:26.042733811 -0300
    +++ wso2-wsf-c-src-2.0.0/Makefile.in    2015-08-21 16:41:35.322195578 -0300
    @@ -714,24 +714,28 @@
        sh dist_hook.sh
    
     samples:
    -   sh build_samples.sh $(prefix)
    -   mkdir -p  $(samplesdir)/src/wsf_c
    -   cp -rf examples/* $(samplesdir)/src/wsf_c
    -   cd $(samplesdir)
    -   rm -rf `find $(samplesdir)/ -type d -name *.svn`
    -   rm -rf `find $(samplesdir)/ -type d -name *.libs`
    -   rm -rf `find $(samplesdir)/ -type d -name *.deps`
    -   rm -rf `find $(samplesdir)/ -type f -name Makefile`
    -   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    -   cp config/axis2.xml $(prefix)
    +   @:
    +   
    +   #sh build_samples.sh $(prefix)
    +   #mkdir -p  $(samplesdir)/src/wsf_c
    +   #cp -rf examples/* $(samplesdir)/src/wsf_c
    +   #cd $(samplesdir)
    +   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
    +   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
    +   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    +   #cp config/axis2.xml $(prefix)
    
     install-data-hook:
    -   cp -rf docs/* $(docsdir)
    -   rm -rf `find $(samplesdir)/ -type d -name *.svn`
    -   rm -rf `find $(samplesdir)/ -type d -name *.libs`
    -   rm -rf `find $(samplesdir)/ -type d -name *.deps`
    -   rm -rf `find $(samplesdir)/ -type f -name Makefile`
    -   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
    +   @:  
    +
    +   #cp -rf docs/* $(docsdir)
    +   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
    +   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
    +   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
    +   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
     # Tell versions [3.59,3.63) of GNU make to not export all variables.
     # Otherwise a system limit (for SysV at least) may be exceeded.
     .NOEXPORT:
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-08-10
      • 1970-01-01
      • 1970-01-01
      • 2019-10-13
      • 2018-04-16
      • 2015-07-08
      • 2018-07-29
      相关资源
      最近更新 更多