[英]How can I change the installation path of an autotools-based Bitbake recipe?
I have an autotools-based BitBake recipe which I would like to have binaries installed in /usr/local/bin
and libraries installed in /usr/local/lib
(instead of /usr/bin
and /usr/lib
, which are the default target directories). 我有一个基于autotools的BitBake配方,我希望在
/usr/local/bin
安装二进制文件,并在/usr/local/lib
安装/usr/local/lib
(而不是/usr/bin
和/usr/lib
,这是默认的目标目录)。
Here's a part of the autotools.bbclass
file which I found important. 这是
autotools.bbclass
文件的一部分,我发现它很重要。
CONFIGUREOPTS = " --build=${BUILD_SYS} \
--host=${HOST_SYS} \
--target=${TARGET_SYS} \
--prefix=${prefix} \
--exec_prefix=${exec_prefix} \
--bindir=${bindir} \
--sbindir=${sbindir} \
--libexecdir=${libexecdir} \
--datadir=${datadir} \
--sysconfdir=${sysconfdir} \
--sharedstatedir=${sharedstatedir} \
--localstatedir=${localstatedir} \
--libdir=${libdir} \
...
I thought that the easiest way to accomplish what I wanted to do would be to simply change ${bindir}
and ${libdir}
, or perhaps change ${prefix}
to /usr/local
, but I haven't had any success in this area. 我认为完成我想做的最简单的方法就是简单地更改
${bindir}
和${libdir}
,或者将${prefix}
更改${prefix}
/usr/local
,但我没有取得任何成功。这片区域。 Is there a way to change these installation variables, or am I thinking about this in the wrong way? 有没有办法改变这些安装变量,或者我是否以错误的方式考虑这个问题?
As per Ross Burton's suggestion, I've tried adding the following to my recipe: 根据Ross Burton的建议,我尝试将以下内容添加到我的食谱中:
prefix="/usr/local"
exec_prefix="/usr/local"
but this causes the build to fail during that recipe's do_configure()
task, and returns the following: 但这会导致构建在该配方的
do_configure()
任务期间失败,并返回以下内容:
| checking for GLIB... no
| configure: error: Package requirements (glib-2.0 >= 2.12.3) were not met:
|
| No package 'glib-2.0' found
This package can be found during a normal build without these modified variables. 在没有这些修改变量的正常构建期间可以找到此包。 I thought that adding the following line might allow the system to find the package metadata for glib:
我认为添加以下行可能允许系统找到glib的包元数据:
PKG_CONFIG_PATH = " ${STAGING_DIR_HOST}/usr/lib/pkgconfig "
but this seems to have made no difference. 但这似乎没有任何区别。
I've also tried Ross Burton's other suggestion to add these variable assignments into my distribution's configuration file, but this causes it to fail during meta/recipes-extended/tzdata
's do_install()
task. 我还尝试过Ross Burton的另一个建议,即将这些变量赋值添加到我的发行版的配置文件中,但这会导致它在
meta/recipes-extended/tzdata
的do_install()
任务中失败。 It returns that DEFAULT_TIMEZONE is set to an invalid value.
它返回
DEFAULT_TIMEZONE is set to an invalid value.
Here's the source of the error from tzdata_2015g.bb
这是
tzdata_2015g.bb
的错误tzdata_2015g.bb
# Install default timezone
if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
install -d ${D}${sysconfdir}
echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
else
bberror "DEFAULT_TIMEZONE is set to an invalid value."
exit 1
fi
I'm assuming that I've got a problem with ${datadir}
, which references ${prefix}
. 我假设我遇到了
${datadir}
的问题,它引用了${prefix}
。
Do you want to change paths for everything or just one recipe? 你想改变一切或仅一个食谱的路径吗? Not sure why you'd want to change just one recipe to
/usr/local
, but whatever. 不知道为什么你只想将一个食谱改为
/usr/local
,但无论如何。
If you want to change all of them, then the simple way is to set prefix
in your local.conf
or distro configuration ( prefix = "/usr/local"
). 如果要更改所有这些,那么简单的方法是在
local.conf
或发行版配置中设置prefix
( prefix = "/usr/local"
)。
If you want to do it in a particular recipe, then just assigning prefix="/usr/local"
and exec_prefix="/usr/local"
in the recipe will work. 如果你想在特定的配方中做,那么只需在配方中分配
prefix="/usr/local"
和exec_prefix="/usr/local"
。
These variables are defined in meta/conf/bitbake.conf
, where you can see that bindir
is $exec_prefix/bin
, which is probably why assigning prefix
didn't work for you. 这些变量在
meta/conf/bitbake.conf
中定义,您可以在其中看到bindir
是$exec_prefix/bin
,这可能是分配prefix
不适合您的原因。
Your first strategy was on the right track, but you were clobbering more than you wanted by changing only "prefix". 你的第一个策略是在正确的轨道上,但你只是通过改变“前缀”来破坏你想要的东西。 If you look in sources/poky/meta/conf/bitbake.conf you'll find everything you are clobbering when you set the variable "prefix" to something other than "/usr" (like it was in my case).
如果你查看sources / poky / meta / conf / bitbake.conf,当你将变量“prefix”设置为“/ usr”以外的其他东西时,你会发现你正在破坏的一切(就像我的情况一样)。 In order to modify only the install path with what would manually be the "--prefix" option to configure, I needed to set all the variables listed here in that recipe:
为了仅修改安装路径,手动使用“--prefix”选项进行配置,我需要设置该配方中列出的所有变量:
prefix="/your/install/path/here"
datadir="/usr/share"
sharedstatedir="/usr/com"
exec_prefix="/usr"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.