Optimal way to install clang locally when GCC is outdated

时间:2016-07-11 22:02:55

标签: linux clang

I need to use tools that depend on clang on a Unix machine I remote onto at work. Anything I install is locally installed onto ~/local. I do not have root permissions.

/usr is pretty outdated, with gcc being at version 4.4.7. clang requires gcc 4.7+

I read on linux from scratch that a gcc 6.1 installation requires 8.4 gb. This is not something I can do, because that's huge.

Can someone advise me on the best workaround to install up to date clang on my ~/local?

Please and thanks.

Edit:

Courtesy of Nishant, here is the short answer:

Set up a personal machine running the same linux distro and cross compile using gcc to your specific architecture. For me, I will run a Redhat 6.5 VM and compile using gcc an arm x64 binary. Thanks Nishant!

1 个答案:

答案 0 :(得分:2)

您可以从LLVM的发布网站获取Unix系统的预构建二进制文件:http://llvm.org/releases/

然后,您可以将二进制文件放在所需的任何本地文件夹中,并使用PATH变量来获取它,这可以通过附加以下内容来修改〜/ .bashrc文件来完成:

export PATH=$PATH:<clang-binary-directory>

现在,您可以使用命令行终端中的clang,就像安装它一样。

如果你只想从源代码构建,你可以获得更老的clang源代码,它将使用gcc 4.4.7并构建它,然后使用clang来构建clang。或者获取最新的clang二进制文件并使用它来构建最新的clang。

相关问题