0
在我的机器中,我们以root用户身份安装了GCC 4.1.2,但是为了编译LLVM和clang,我需要更高版本的GCC。所以我下载了并且在我的本地目录上安装了GCC 4.5.0。如何使用多个GCC-LLVM和clang
如何使现有程序引用GCC 4.5.0库和包含。
> gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> which gcc
/usr/bin/gcc
> setenv PATH gcc-4.5.0/bin/gcc/gcc-4.5.0/bin:$PATH
> gcc --version
gcc (GCC) 4.5.0
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> which gcc
gcc-4.5.0/bin/gcc/gcc-4.5.0/bin/gcc
难道只是设置系统路径将帮助我或者是还有什么需要对现有的代码来引用GCC 4.5.0套房呢?
gcc-4.5.0/bin/gcc/gcc-4.5.0/> ls -l
total 24
drwxrwxr-x 2 prasad ppusers 4096 Jun 13 21:32 bin
drwxrwxr-x 3 prasad ppusers 4096 Jun 13 21:32 include
drwxrwxr-x 3 prasad ppusers 4096 Jun 13 21:32 lib
drwxrwxr-x 2 prasad ppusers 4096 Jun 13 21:32 lib64
drwxrwxr-x 3 prasad ppusers 4096 Jun 13 21:32 libexec
drwxrwxr-x 6 prasad ppusers 4096 Jun 13 21:32 share
我会建议你把路径放到GCC_last_的本地拷贝中放在'$ PATH'中,也就是'export PATH = $ PATH:/ your/local/path'。而用'gcc-4.5'调用你的编译器。这样您仍然可以为系统构建应用程序以及您自己的应用程序。 –
但这根本不是目标。我需要仅使用GCC 4.5.0版编译代码 – Prakash
是的,您需要编译具有特定版本的_your_代码,但为_system_编译的代码应该使用系统提供的编译器。这是因为系统工具中可能存在不兼容的情况。我的建议当然可以和cobbal的答案结合起来,所以你按照我的建议设置PATH,然后做'CC = gcc-4.5 make'。 –