如何在CentOS 7上安装Mailtrain新闻通讯应用程序
使用其他系统?Mailtrain是一个基于Node.js和MySQL / MariaDB构建的开源自托管新闻通讯应用程序。
LLVM是一个开源编译器基础结构。LLVM始于2000年,自2005年以来一直被Apple广泛使用和修改。Clang是可与LLVM系统一起使用的C,C ++,Objective-C和Objective-C ++编译器。Clang于2007年由Apple创立,从那以后Google和Intel参与了Clang的持续开发。
Clang的开发人员声称,与GCC相比,它的编译速度更快,使用的内存更少,在编译过程中提供了更多用户友好的诊断方法,并且与GCC兼容。
CentOS遵循Red Hat Enterprise Linux(RHEL)的开发。RHEL努力成为一个稳定的服务器平台,这意味着它不会急于包含所有内容的最新版本。
在撰写本文时,CentOS 6正式发布了LLVM&Clang v3.4.2。但是,Clang v3.6已发布。
官方建议是,如果您需要更新版本的LLVM和Clang,则应考虑使用其他UNIX发行版,该发行版更侧重于支持最新版本的软件包。
幸运的是,您可以在CentOS上安装更新版本的LLVM和Clang GCC。这与纯粹使用正式发行的软件有所不同,但有时您可能会感到别无选择。
本文介绍了如何安装CentOS 6正式支持的LLVM和Clang版本,以及如何安装更新版本。本文假定您已经全新安装了CentOS 6 VPS,但是您当然可以按照已经使用的VPS上的说明进行操作。
锵是从GCC很大程度上独立,但这篇文章的写作,锵仍然使用(即通过GCC安装了几个共享库crtbegin.o
,gcc
和gcc_s
)。如果在CentOS 6上安装LLVM和Clang,并且您的系统上也没有针对这些共享库的GCC,则将无法编译任何内容。理想情况下,yum对gcc和gcc-c ++的clang具有程序包依赖关系,但是在��写本文时,yum尚未意识到该依赖关系。
此外,从源代码构建更新版本的LLVM和Clang需要G ++ v4.7 +,您只能通过按源安装来在CentOS 6上使用。
如果执行以下所有步骤,则将获得2个版本的GCC和2个版本的LLVM&Clang。这包括官方支持的二进制旧版本和每个程序从源头的较新版本。但是,无需执行以下所有步骤。您可以决定是要使用官方支持的LLVM&Clang二进制较旧版本,还是要从源代码获得较新版本,然后运行适合您决定的任何说明部分。
重要! 首先,通过执行文章如何在CentOS 6上安装GCC中的步骤安装官方支持的(旧)GCC版本-您无需执行该文章标题“从源代码安装新版本的GCC”下的步骤。 ”。
安装LLVM和Clang
sudo yum install clang
--- This will bring in llvm as a dependency
检查安装的版本,并查看其位置。
clang --version
May say: clang version 3.4.2 (tags/RELEASE_34/dot2-final)
which clang
/usr/bin/clang
gcc --version
May say: gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
g++ --version
May say: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
which gcc
/usr/bin/gcc
which g++
/usr/bin/g++
要在CentOS上通过源代码构建LLVM和Clang,您必须具有GCC v4.7或更高版本。CentOS 6在yum中没有这么高的版本,因此您首先必须从源代码安装更新的GCC。
重要! 首先,通过执行“ 如何在CentOS 6上安装GCC ”一文中的步骤从源代码安装GCC的较新版本-您确实需要执行该文章中的所有步骤,包括在“从以下位置安装GCC的较新版本”标题下资源”。
安装其他必需的软件包。
sudo yum install cmake
安装较新版本的Python。LLVM和Clang v3.6.0需要Python v2.7 +,但CentOS 6 yum存储库仅具有Python v2.6.6。
mkdir ~/sourceInstallations
cd ~/sourceInstallations
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -xvf Python-2.7.9.tgz
cd Python-2.7.9
./configure && make && sudo make install
确定所需的LLVM和Clang版本。该命令将为您显示可用版本的“标签”。
svn ls http://llvm.org/svn/llvm-project/llvm/tags | grep RELEASE
RELEASE_1/
...
RELEASE_352/
RELEASE_360/
RELEASE_361/
svn ls http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_361
rc1/
--- At this time, there is no final, just a release candidate. You could certainly use a release candidate, but this article will show how to use a final release.
svn ls http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360
final/
rc1/
rc2/
rc3/
rc4/
获取所需的LLVM和Clang版本的源。这将运行几分钟。本文的其余部分专为RELEASE_360/
将要下载的源而编写~/sourceInstallations/llvm_RELEASE_360/
-您将不得不替换适当的标签以适合将来的版本。下面的目录compiler-rt
,libcxx
以及libcxxabi
是不是绝对必要的,但含有的某些功能,LLVM和Clang的有GCC没有,所以都包含在这篇文章。您还可以选择使用其他LLVM“子项目”,例如Dragonegg,LLDB,OpenMB,vmkit,poly,libclc,klee,SAFECode和lld。您可以在LLVM网站上阅读有关内容。
cd ~/sourceInstallations
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/final llvm_RELEASE_360
cd llvm_RELEASE_360/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/final clang
cd ../projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_360/final compiler-rt
svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_360/final libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_360/final libcxxabi
cd ..
svn update
At revision X.
--- Hopefully this outputs one line saying "At revision X", but numbers instead of "X". If it downloads more source files, a new revision was released while you were downloading the source code. This is highly unlikely unless you're using trunk (the most up to date, maybe unstable code.) But, if this happens, perform a svn update in the tools/clang, projects/compiler-rt, projects/libcxx, projects/libcxxabi, and again ~/sourceInstallations/llvm_RELEASE_360, until you are fully up to date.
构建LLVM和Clang。这将运行一段时间。如果正确完成,您将在最后一行看到“成功”。通常,看到一些看似错误的消息会快速滚动。在与源目录不同的目录中构建事物始终是一个好主意。
mkdir ../llvm_RELEASE_360_build
cd ../llvm_RELEASE_360_build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ ../llvm_RELEASE_360 && make && sudo make install && echo success
--- If your VPS has multiple cores, you can speed up the build by changing the middle part
--- of this line from "&& make &&" to "&& make -j <number of cores> &&".
--- You can see the number of cores your VPS has by running "nproc"
--- If you omit -DCMAKE_BUILD_TYPE=Release, the build defaults to debug. This is great if you need to debug LLVM & Clang itself, but slows down compilation of your end programs considerably.
--- If you omit the references to gcc and g++, it will default to using the older binary versions in /usr/bin/, and will not compile.
检查安装的版本,并查看其位置。
clang --version
May say: clang version 3.6.0 (tags/RELEASE_360/final 237229)
clang++ --version
May say: clang version 3.6.0 (tags/RELEASE_360/final 237229)
which clang
/usr/local/bin/clang
which clang++
/usr/local/bin/clang++
将新库添加到ld(GNU链接器)。
echo "/usr/local/lib" > usrLocalLib.conf
sudo mv usrLocalLib.conf /etc/ld.so.conf.d/
sudo ldconfig
--- This may say a file or two "is not an ELF file - it has the wrong magic bytes at the start."
--- You may ignore this message. It is silent about the work it successfully completed.
(可选)制作一个“ hello world”程序。
mkdir ~/code
cd ~/code
Create a file main.cpp that says:
#include <iostream>
using namespace std;
int main() {
cout << "Hello world!" << endl;
return 0;
}
--- One way to create this file is to run "vi main.cpp", hitting "i" to enter insert mode,
--- typing the above file, hitting ESC, and hitting "ZZ" to save.
clang++ main.cpp -o main
./main
Hello World!
clang++ -stdlib=libc++ -lc++abi main.cpp -o main
--- This uses Clang's libc++ and libc++abi, instead of the GNU stdlibc++ and stdlibc++abi
./main
Hello world!
如果需要,请使用LLVM和Clang。
You could set LLVM & Clang to be your system's default C and C++ compiler by running:
echo "export CC=/usr/local/bin/gcc" >> ~/.bashrc
echo "export CXX=/usr/local/bin/g++" >> ~/.bashrc
source ~/.bashrc
Once and a while there is a difference between Clang and GCC, but it's becoming more and more rare. To be more conservative, you could specify in your code's buildsystem to use LLVM & Clang, but otherwise leave your system's default to the source build of GCC.
(可选)回收硬盘驱动器空间。您的~/sourceInstallations
文件夹将占用大约11GB的磁盘空间。保留文件夹可能是明智的选择,因为将来可能需要使用一些可选的配置选项,并且完成很多工作会更快。而且,如上所述,您可以将其他“子项目”添加到LLVM和Clang。此外,构建过程还会生成日志,以便日后在出现问题时进行检查和处理。但是,在稍早运行“ sudo make install”之后,已安装的LLVM和Clang并不依赖于此目录中的任何内容,而且空间可能非常宝贵,因此您可以执行此步骤并回收11GB。
cd ~/
rm -rf sourceInstallations
--- Again, if you can spare the space, you may someday be happy to have left it there.
现在,您具有更新的LLVM&Clang /usr/local/bin
,具有更新的64位LLVM&Clang库/usr/local/lib
,并且具有新的LLVM&Clang include文件/usr/local/include
。
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
快速学习如何在Ubuntu 16.04上安装OpenSIPS控制面板,为VoIP提供商提供支持的功能。
学习如何在Fedora 28上安装Akaunting,一款适合小型企业和自由职业者的开源会计软件。
使用其他系统?Mailtrain是一个基于Node.js和MySQL / MariaDB构建的开源自托管新闻通讯应用程序。
了解導致Minecraft延遲的原因和解決方案,包括優化伺服器性能和減少滯後的步驟。
勒索軟件攻擊呈上升趨勢,但人工智能能否幫助應對最新的計算機病毒?AI 是答案嗎?在這裡閱讀知道是 AI 布恩還是禍根
ReactOS,一個開源和免費的操作系統,這裡有最新版本。它能否滿足現代 Windows 用戶的需求並打倒微軟?讓我們更多地了解這種老式但更新的操作系統體驗。
Whatsapp 終於為 Mac 和 Windows 用戶推出了桌面應用程序。現在您可以輕鬆地從 Windows 或 Mac 訪問 Whatsapp。適用於 Windows 8+ 和 Mac OS 10.9+
閱讀本文以了解人工智能如何在小型公司中變得流行,以及它如何增加使它們成長並為競爭對手提供優勢的可能性。
最近,Apple 發布了 macOS Catalina 10.15.4 補充更新以修復問題,但似乎該更新引起了更多問題,導致 mac 機器變磚。閱讀這篇文章以了解更多信息