问题标签 [crosstool-ng]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1157 浏览

c - How to reduce ELF section padding?

I used crosstool-NG to create a PowerPC toolchain with gcc 6.3.0 and glibc 2.25. I have the following test program, test.c:

I compiled it with the command:

The final binary is 66904 bytes, which is much larger than expected. The section headers look like this:

You can see that there's a large jump between the .eh_frame and .ctors sections. If I use 'hd' to look at the file, I can see that the space between .eh_frame and .ctors is filled entirely with null bytes.

Why is gcc adding such a huge amount of space between the sections and is there any way to change its behavior?

0 投票
0 回答
418 浏览

gcc - 如何配置 gcc 以在特定位置搜索 crt1.o 和其他 libc 文件?

我正在尝试使用 Crosstool-NG 为 Raspberry Pi 构建交叉编译工具链。我已经这样做了。但是,当我尝试使用--sysroot选项(如本答案中所述)将我的工具链与来自 Raspberry Pi 的 rootfs 一起使用时,我收到以下错误:

问题是 Raspberry Pi 设备上的此标头位于 中/usr/include/arm-linux-gnueabihf,而不仅仅是/usr/include目录中。我可以使用标志将此目录添加到包含目录列表中-I,但随后出现以下错误:

问题类似:libm库位于 中/usr/lib/arm-linux-gnueabihf,而不仅仅是/usr/lib/目录中。当然我可以使用-Lflag 来解决这个问题,但无论如何我都会收到以下错误:

原因是一样的:crt1.o位于/usr/lib/arm-linux-gnueabihf目录中。并且没有标志可以解决这个问题。我的编译器配置为crt1.o/usr/lib/目录中搜索。而且我必须在子目录中的文件中创建符号链接/usr/lib来解决这个问题。crtarm-linux-gnueabihf

因此,所有 libc 文件都位于非标准位置。crt1.o在我的 Ubuntu 上,它也位于一个非标准位置,它位于/usr/lib/i386-linux-gnu. 似乎许多工具链都使用这种行为,因此我猜这是gcc的一些标准功能。

所以问题是:是否有任何选项可以编译gcc以使其搜索头文件、库和crt1.o某个特定位置?如何配置我的工具链以将所有libc文件放入arm-linux-gnueabihf子目录?我想应该有一些 gcc配置选项来执行此操作。但是哪一个?

0 投票
0 回答
331 浏览

mips - Cross-compiling for mips under x86_64 with MSA support

I’m trying to build a toolchain for cross-compiling for MIPS under x86 with crosstool-ng. According to GCC 7.2.0 documentation it must support msa instructions. But when I’m building an application with assembly msa instructions using buit toolchain the application doesn’t execute and fails with "Illegal Instruction". What am I doing wrong?

I'm building the application with the following cflags: -mmsa, -mhard-float -mfp64, but without -mnan=2008, because in this case I got a problem with missing gnu/stubs-o32_hard_2008.h The text of .config file for croosstool-ng:

0 投票
1 回答
597 浏览

c - 交叉编译、Crosstool、Makefile、libreadline

我正在使用 Simplicity Studio 为我的应用程序生成代码。它会自动生成一个 Makefile,我能够构建在我的主机 pc amd64 ubuntu 16.02 上运行的应用程序。

现在我想构建应用程序,以便它可以在 Raspberry Pi 中运行。所以我安装了 crostool-ng 和 Rpi crosstool。现在我对 make 文件不太了解,但我做了make CC=arm-linux-gnueabihf-gcc而不是make.

它失败了

致命错误:readline/readline.h:没有这样的文件或目录

我已经为 armhf 安装了libreadline-devlibreadline-dev

我这样做对吗?我需要做一些其他的改变吗?

我以前没有从事过大型项目,而且我对 makefile 的理解非常糟糕。

我为 Pi 编译了简单的 C 程序,它们可以工作。

生成文件

应用程序代码和生成文件

0 投票
1 回答
239 浏览

c - 共享对象文件中标记为 RWE 的程序头

我在基于 Intel 的 64 位 Linux 系统上使用交叉编译器来构建我们的一些软件,以便它可以在 32 位 PowerPC 芯片上运行。交叉编译器由 Crosstools 生产。

当我对交叉编译器生成的共享对象文件(.so 文件)运行“readelf -a”时,部分输出显示如下:

问题是标头标记为 RWE。评估我们软件的潜在客户对此有疑问,并希望它只是 RW。

第二个交叉编译器由相同版本的 Crosstools 生成并针对相同版本的 gcc,为 64 位 PowerPC 芯片生成代码。此交叉编译器生成的共享对象文件不生成任何 RWE 标头(第二个 LOAD 标头仅标记为 RW)。

在这两种情况下,编译和链接的 gcc 限定符都是相同的。

我对交叉编译器和 ELF 头文件的世界有点陌生。有没有办法让 32 位交叉编译器创建没有标头 RWE 的共享对象文件?

如果做不到这一点,有没有办法(安全地)修补已经创建的 .so 文件以更改标有 RWE 的标头,使其标为 RW?

0 投票
2 回答
1026 浏览

linux - 使用 crosstool-ng 构建 ARM 交叉编译器失败

我正在做一个从 Free Electron 到构建交叉编译工具链的实验室但是当我运行构建命令时,它在下载东西后不久就失败了......

我的东西:xubuntu 14.04.3 | 交叉工具-ng-1.19.0

当我运行 ./ct-ng build

0 投票
1 回答
445 浏览

linux - 在 crosstool-ng 上运行 make 时找不到标记命令

出于某种原因,在我的 ubuntu 系统上,在 crosstool-ng 上运行 make 会引发此错误。我尝试查看是否可以找到具有标记命令的包,但我认为不存在。

0 投票
1 回答
1513 浏览

c++ - 使用 crosstool-ng 编译 gcc 时出错

有人可以帮我解决这个错误吗?我正在尝试使用 ct-ng(版本 1.23.0)构建 arm-unknown-linux-gnueabi。

我不确定这是 gcc 源代码问题还是我可以在 ct-ng 中更改某些配置以忽略此错误。

显然这就是那里的错误。

0 投票
1 回答
593 浏览

c - 致命错误:omp.h:没有使用 arm-unknown-linux-uclibcgnueabi (crosstool-ng) 的文件或目录

似乎使用 crosstool-ng 创建的任何 gcc 都缺少 omp.h,有没有办法解决这个问题?

如果我使用arm-linux-gnueabi-gccapt-get 直接在 Ubuntu 中安装,我不会收到此错误。

0 投票
0 回答
130 浏览

mips - 多 MIPS 平台编译

我有多个具有不同 CPU 和不同内核和 uclibc 版本的 MIPS 平台

我想用将在所有设备上运行的单个工具链编译“Hello World”程序。

我正在使用带有以下配置的 crosstool-ng 构建工具链:

  • MIPS1 拱型 (-march=mips1)
  • 软 FPU(应该在没有硬件 FPU 的设备上工作)
  • 静态可执行文件(避免库依赖失败)
  • 旧内核版本(应该由具有较新内核的设备支持)

我错过了什么吗?我仍然有该程序仅在使用其专用工具链时才起作用的设备(例如 RTL819xD)

谢谢