在没有c编译器的linux上安装gcc

时间:2022-06-26 20:08:33

How can I install gcc on a system that have not any c compiler? this system is a linux base firewall and have not any c compiler.

如何在没有任何c编译器的系统上安装gcc ?该系统是linux基础防火墙,没有任何c编译器。

5 个解决方案

#1


13  

I guess you a have an appliance running Linux and shell-access, but neither a package manager nor a compiler is installed.

我猜您有一个运行Linux和shell访问的设备,但是既没有安装包管理器,也没有安装编译器。

So, you need to cross-compile gcc and the whole toolchain (at least binutils) - this is quite simple, because the ./configure scripts of gcc, binutils, gdb etc. support cross-compiling with the --target= option. So all you have to do is to find out the target architecure (uname helps) and then download, unpack the gcc sources on a linux-host and run ./configure --target=$YOUR_TARGET.

因此,您需要交叉编译gcc和整个工具链(至少是binutils)——这非常简单,因为gcc、binutils、gdb等的./configure脚本支持与—target=选项交叉编译。因此,您所要做的就是找出目标体系结构(uname帮助),然后在linux-host上下载、解压gcc源代码并运行。/configure——target=$YOUR_TARGET。

With this, you now can build a cross-compiler gcc - this still runs on your host, but produces binaries for your target (firewall appliances).

有了这个,您现在可以构建一个跨编译器gcc—它仍然在您的主机上运行,但是为您的目标(防火墙设备)生成二进制文件。

This may already be sufficient for you, a typical desktop PC is much faster than a typical appliance, so it may make sense to compile everything you need on the Desktop PC with the cross-compiler and cross-binutils.

这对您来说可能已经足够了,典型的桌面PC要比典型的设备快得多,因此使用交叉编译器和交叉二进制文件编译桌面PC上需要的所有东西可能是有意义的。

But if you really wish to do so, you can now also use your cross-compiler to compile a gcc running on your target (set this as --host= option) and compiling for your target (set this as --target option).

但是,如果您确实希望这样做,那么现在还可以使用交叉编译器编译在目标上运行的gcc(将其设置为——host=选项)并编译目标(将其设置为——target选项)。

You can find details about allowed host/targets and examples in the gcc documentation: http://gcc.gnu.org/install/specific.html.

您可以在gcc文档中找到关于允许的主机/目标的详细信息和示例:http://gcc.gnu.org/install/.html。

#2


1  

It depends on the distribution, if it's based on debian or some other of the big ones you can install gcc through apt-get or similar tool.

它取决于发行版,如果它基于debian或其他大型软件,您可以通过apt-get或类似工具安装gcc。

If it's a more basic system you need to compile gcc yourself on another computer and copy it over. It will be easiest if you have another computer with the same architecture (i386, arm or x86_64 for example).

如果是一个更基本的系统,您需要自己在另一台计算机上编译gcc并复制它。如果您有另一台具有相同架构的计算机(例如,i386、arm或x86_64),这将是最容易的。

I think that you might want to compile it statically also, so that you don't have dependencies on external libraries.

我认为您可能也想静态地编译它,这样就不会依赖于外部库。

#3


0  

If it's a debian based distribution, you can use

如果是基于debian的发行版,你可以使用。

sudo apt-get install gcc

Note: maybe you must change "gcc" by a specific version of the debian package.

注意:也许您必须使用debian软件包的特定版本来更改“gcc”。

#4


0  

How do you plan to get all the source code needed for GCC loaded onto your machine? Could you mount the ISO image onto this machine and install from there?

如何计划将GCC加载到您的机器上所需的所有源代码?你能把ISO镜像装到这台机器上并从那里安装吗?

#5


0  

Since you are using Endian Firewall, see "Building a development box" at the following link:

由于您正在使用Endian防火墙,请参见以下链接中的“构建开发框”:

http://alumnus.caltech.edu/~igormt/endian/tips.html

http://alumnus.caltech.edu/ igormt /尾数法/ tips.html

#1


13  

I guess you a have an appliance running Linux and shell-access, but neither a package manager nor a compiler is installed.

我猜您有一个运行Linux和shell访问的设备,但是既没有安装包管理器,也没有安装编译器。

So, you need to cross-compile gcc and the whole toolchain (at least binutils) - this is quite simple, because the ./configure scripts of gcc, binutils, gdb etc. support cross-compiling with the --target= option. So all you have to do is to find out the target architecure (uname helps) and then download, unpack the gcc sources on a linux-host and run ./configure --target=$YOUR_TARGET.

因此,您需要交叉编译gcc和整个工具链(至少是binutils)——这非常简单,因为gcc、binutils、gdb等的./configure脚本支持与—target=选项交叉编译。因此,您所要做的就是找出目标体系结构(uname帮助),然后在linux-host上下载、解压gcc源代码并运行。/configure——target=$YOUR_TARGET。

With this, you now can build a cross-compiler gcc - this still runs on your host, but produces binaries for your target (firewall appliances).

有了这个,您现在可以构建一个跨编译器gcc—它仍然在您的主机上运行,但是为您的目标(防火墙设备)生成二进制文件。

This may already be sufficient for you, a typical desktop PC is much faster than a typical appliance, so it may make sense to compile everything you need on the Desktop PC with the cross-compiler and cross-binutils.

这对您来说可能已经足够了,典型的桌面PC要比典型的设备快得多,因此使用交叉编译器和交叉二进制文件编译桌面PC上需要的所有东西可能是有意义的。

But if you really wish to do so, you can now also use your cross-compiler to compile a gcc running on your target (set this as --host= option) and compiling for your target (set this as --target option).

但是,如果您确实希望这样做,那么现在还可以使用交叉编译器编译在目标上运行的gcc(将其设置为——host=选项)并编译目标(将其设置为——target选项)。

You can find details about allowed host/targets and examples in the gcc documentation: http://gcc.gnu.org/install/specific.html.

您可以在gcc文档中找到关于允许的主机/目标的详细信息和示例:http://gcc.gnu.org/install/.html。

#2


1  

It depends on the distribution, if it's based on debian or some other of the big ones you can install gcc through apt-get or similar tool.

它取决于发行版,如果它基于debian或其他大型软件,您可以通过apt-get或类似工具安装gcc。

If it's a more basic system you need to compile gcc yourself on another computer and copy it over. It will be easiest if you have another computer with the same architecture (i386, arm or x86_64 for example).

如果是一个更基本的系统,您需要自己在另一台计算机上编译gcc并复制它。如果您有另一台具有相同架构的计算机(例如,i386、arm或x86_64),这将是最容易的。

I think that you might want to compile it statically also, so that you don't have dependencies on external libraries.

我认为您可能也想静态地编译它,这样就不会依赖于外部库。

#3


0  

If it's a debian based distribution, you can use

如果是基于debian的发行版,你可以使用。

sudo apt-get install gcc

Note: maybe you must change "gcc" by a specific version of the debian package.

注意:也许您必须使用debian软件包的特定版本来更改“gcc”。

#4


0  

How do you plan to get all the source code needed for GCC loaded onto your machine? Could you mount the ISO image onto this machine and install from there?

如何计划将GCC加载到您的机器上所需的所有源代码?你能把ISO镜像装到这台机器上并从那里安装吗?

#5


0  

Since you are using Endian Firewall, see "Building a development box" at the following link:

由于您正在使用Endian防火墙,请参见以下链接中的“构建开发框”:

http://alumnus.caltech.edu/~igormt/endian/tips.html

http://alumnus.caltech.edu/ igormt /尾数法/ tips.html