Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何从crosstool ng工具链名称中删除供应商名称_Linux - Fatal编程技术网

Linux 如何从crosstool ng工具链名称中删除供应商名称

Linux 如何从crosstool ng工具链名称中删除供应商名称,linux,Linux,如何配置crosstool ng以从生成的工具链名称中删除供应商名称 例如,在不指定供应商零件的情况下创建手臂交叉工具链将导致以下命名输出 arm-unknown-linux-gnueabihf-g++ 如果我提供了一个供应商,例如“linaro”,那么我的输出将是 arm-linaro-linux-gnueabihf-g++ 我想要的是让crosstool ng输出如下名称 arm-linux-gnueabihf-g++ 我知道您可以使用menuconfig中的“Tuple's sed tra

如何配置crosstool ng以从生成的工具链名称中删除供应商名称

例如,在不指定供应商零件的情况下创建手臂交叉工具链将导致以下命名输出

arm-unknown-linux-gnueabihf-g++

如果我提供了一个供应商,例如“linaro”,那么我的输出将是

arm-linaro-linux-gnueabihf-g++

我想要的是让crosstool ng输出如下名称

arm-linux-gnueabihf-g++

我知道您可以使用menuconfig中的“Tuple's sed transform”和“Tuple's alias”这些工具,但它们只创建到arm-unknown-gnueabihf-g++等的符号链接


我有一个工具链,它与我正在玩的一个板一起提供,这些工具链省略了供应商的部分。所以我的问题是“他们是如何做到的?”

即使文档中说明:

CT_TARGET_VENDOR:[…]可以将其设置为空,以从目标元组中删除VENDOR字符串

(见附件)

如果未给出CT\U目标供应商的值,则当前行为将返回到“未知”

早在2011年,crosstool ng邮件列表中就讨论过这种情况,并且提供了一个解决方案补丁,可以帮助您

该补丁的想法是:

[…]提供了一个假供应商和 然后把它去掉

在crosstool ng源的脚本/函数中

见:


由于
arm
本身并没有很好的定义,我认为添加更多的信息,如供应商,是相当有利的。umlaute感谢您的回复我希望我可以添加10颗星对我来说,情况是编译raspberry pi stretch的QT,它现在在/usr/lib/arm-linux-gnueabihf中有库,而不是/usr/lib/arm-raspbian-linux-gnueabihf,后者由配置代码machineTuple=$$eval($$${currentConfig}.tests.machineTuple.tuple)中的-dumpmachine确定!isEmpty(machineTuple):\pkgConfigLibdir=“$$pkgConfigLibdir:$$sysroot/usr/lib/$$machineTuple/pkgconfig”
diff -r a31d097e28cd -r 5b1330e7264a scripts/functions
--- a/scripts/functions Wed Oct 19 15:27:32 2011 +1300
+++ b/scripts/functions Wed Oct 19 16:23:36 2011 +1300
@@ -944,6 +944,20 @@
     fi
 }

+# Computes the target tuple from the configuration and the supplied
+# vendor string
+CT_BuildOneTargetTuple() {
+    local vendor="${1}"
+    local target
+
+    target="${CT_TARGET_ARCH}"
+    target="${target}${vendor:+-${vendor}}"
+    target="${target}${CT_TARGET_KERNEL:+-${CT_TARGET_KERNEL}}"
+    target="${target}${CT_TARGET_SYS:+-${CT_TARGET_SYS}}"
+
+    echo "${target}"
+}
+
 # Compute the target tuple from what is provided by the user
 # Usage: CT_DoBuildTargetTuple
 # In fact this function takes the environment variables to build the target
@@ -994,10 +1008,7 @@
     CT_DoKernelTupleValues

     # Finish the target tuple construction
-    CT_TARGET="${CT_TARGET_ARCH}"
-    CT_TARGET="${CT_TARGET}${CT_TARGET_VENDOR:+-${CT_TARGET_VENDOR}}"
-    CT_TARGET="${CT_TARGET}${CT_TARGET_KERNEL:+-${CT_TARGET_KERNEL}}"
-    CT_TARGET="${CT_TARGET}${CT_TARGET_SYS:+-${CT_TARGET_SYS}}"
+    CT_TARGET=$(CT_BuildOneTargetTuple "${CT_TARGET_VENDOR}")

     # Sanity checks
     __sed_alias=""
@@ -1012,7 +1023,14 @@
     esac

     # Canonicalise it
-    CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
+    if [ -n "${CT_TARGET_VENDOR}" ]; then
+        CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
+    else
+        # Canonicalise with a fake vendor string then strip it out
+        local target=$(CT_BuildOneTargetTuple "CT_INVALID")
+        CT_TARGET=$(CT_DoConfigSub "${target}" |sed -r -s s:CT_INVALID-::)
+    fi
+
     # Prepare the target CFLAGS
     CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ENDIAN_CFLAG}"
     CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ARCH_CFLAG}"