summaryrefslogtreecommitdiff
path: root/poky/meta/files/rust-ccld-wrapper.c
diff options
context:
space:
mode:
authorjmbills <jason.m.bills@intel.com>2021-10-04 22:42:48 +0300
committerGitHub <noreply@github.com>2021-10-04 22:42:48 +0300
commit0c9e31989c615598b5d042ffab385606660c93c0 (patch)
tree8019999b0ca042482e5193d6cabc06220c71d776 /poky/meta/files/rust-ccld-wrapper.c
parent04cd92067d2481643df5010cb39b2134b648cf4d (diff)
parentffe6d597d9e3d4407cf8062b5d6505a80ce08f41 (diff)
downloadopenbmc-1-0.75.tar.xz
Merge pull request #72 from Intel-BMC/update2021-0.751-0.75
Update
Diffstat (limited to 'poky/meta/files/rust-ccld-wrapper.c')
-rw-r--r--poky/meta/files/rust-ccld-wrapper.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/poky/meta/files/rust-ccld-wrapper.c b/poky/meta/files/rust-ccld-wrapper.c
new file mode 100644
index 000000000..6bc9958b9
--- /dev/null
+++ b/poky/meta/files/rust-ccld-wrapper.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2021 Richard Purdie
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * Run the original script (argv[0] + ".real") with LD_LIBRARY_PATH unset
+ * This avoids issues where cargo is running a wrapper script using /bin/sh from the host
+ * which links to something which has an incompatible version in in recipe-sysroot-native
+ * such as libtinfo on centos 7.
+ */
+
+int main(int argc, char* argv[]) {
+ char *real = malloc(strlen(argv[0] + 5));
+ strcpy(real, argv[0]);
+ strcpy(real + strlen(argv[0]), ".real");
+ putenv("LD_LIBRARY_PATH=");
+ if(execv(real, argv) == -1) {
+ printf("Wrapper failed to execute, error: %s\n", strerror(errno));
+ return -1;
+ }
+}