How to install specific version clang 14.0.0? - clang

I use following steps install clang 14 success!But the version is 14.0.6.I want to install version 14.0.0.How do i do it?
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 14

Related

how to solve the glm problem when installing pymol?

I am trying to install pymol in CentOS 7 system. I installed the dependency glm-devel-0.9.6.3-1.el7.noarch by yum:
sudo yum install glm-devel.
During compiling I got an error related to glm as following:
layer1/SceneView.cpp:34:61: error: no matching function for call to ‘equal(const vec3&, const vec3&, float)’
Could anyone tell why this error appears?
I will appreciate any help!
Best regards.
install pymol in CentOS 7
Build example with updated glm-devel
# yum install mmtf-cpp-devel.x86_64 glew-devel.x86_64 libpng-devel freetype-devel msgpack-devel libxml2-devel python36-qt5-devel.x86_64 freeglut-devel mesa-libGL-devel.x86_64 python3-devel
# yum install ./glm-devel-0.9.9.6-6.el7.noarch.rpm
## works with the default python3 (3.6.8) and g++ -4.8.5
Link, glm-devel-0.9.9.6-6.el7 https://drive.google.com/file/d/1BXygEWqpvlbZg867dsXuW47T67Z0V0Q8/view?usp=sharing
https://github.com/schrodinger/pymol-open-source →
https://github.com/schrodinger/pymol-open-source/blob/master/INSTALL
git clone https://github.com/schrodinger/pymol-open-source.git
cd pymol-open-source/
python3 setup.py build
# python3 setup.py install
pymol ## the pymol GUI opens OK
There is also a binary version available, with python 3.7 included : https://pymol.org/2/ →
https://pymol.org/installers/PyMOL-2.5.2_293-Linux-x86_64-py37.tar.bz2 → tar xvf PyMOL-2.5.2_293-Linux-x86_64-py37.tar.bz2
cd pymol/ && ./pymol

How to cross-compile Coreutils or other GNU projects with clang/LLVM?

I have a tough need to compile Coreutils with llvm for other arch: arm/aarch64/mips/mips32/ppc/ppc32...
Since I install all the gcc-cross tools like mips-linux-gnu, powerpc64-linux-gnu and if I have a simple C program like that test.c
#include<stdio.h>
int main(){
printf("hello!");
return 0;
}
I can compile it to the arch, i.e.
clang --target=mips64-linux-gnuabi64 test.c -o test-mips64
➜ tests file test-mips64
test-mips64: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), dynamically linked, interpreter /lib64/ld.so.1, BuildID[sha1]=7b33d55a0d08e6cd18d966341590dc351e346a78, for GNU/Linux 3.2.0, not stripped
I try to the same way for compile Coreutils that try to set
export CC=clang
export CXX=clang++
CFLAGS = "--target=mips64-linux-gnuabi64"
./configure --host=mips64-linux-gnuabi64
Howerver, every time got errors in configure or make...
How should I set the configure? Can I easily compile Coreuntils with llvm for other archs?
It's a bit tricky to get the command-line options right for cross-compiling. I got it to work with the commands below, assuming you're working on a Debian-based system (like Debian or Ubuntu). Here are the steps.
Install gcc-mips64-linux-gnuabi64 and gcc-powerpc64-linux-gnu.
Choose the correct arguments for CFLAGS
-B/usr/mips64-linux-gnuabi64/bin/ to indicate we want to use the linker ld within that directory. Do the same for powerpc.
--target=mips64-linux-gnuabi64 to indicate what our target for compilation is. Do the same for powerpc.
-I/usr/mips64-linux-gnuabi64/include to include header files. Do the same for powerpc.
Use ./configure --host=mips64-linux-gnuabi to configure for mips64 and ./configure --host=powerpc64-linux-gnueabi to configure for powerpc64.
Here are the commands to compile for mips64:
make clean
CFLAGS="-B/usr/mips64-linux-gnuabi64/bin/ --target=mips64-linux-gnuabi64 -I/usr/mips64-linux-gnuabi64/include" \
./configure --host=mips64-linux-gnuabi
make
And the commands to compile for powerpc64:
make clean
CFLAGS="-B/usr/powerpc64-linux-gnu/bin/ --target=powerpc64-linux-gnueabi -I/usr/powerpc64-linux-gnu/include" \
./configure --host=powerpc64-linux-gnueabi
make
Here is the output of file ./src/ls to demonstrate that it is a powerpc64 executable:
$ file ./src/ls
./src/ls: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=97fe33981ca0112160f44a6fb678d6dc1b462114, not stripped
Below is a Dockerfile that can be used to reproducibly cross-compile coreutils for mips64 and powerpc64.
# Cross-compile GNU coreutils for mips64 and powerpc64 using clang.
# With help from https://medium.com/#wolfv/cross-compiling-arm-on-travis-using-clang-and-qemu-2b9702d7c6f3
FROM debian:buster
# Install compile-time dependencies.
RUN apt-get update \
&& apt-get install --yes \
clang \
curl \
gcc-mips64-linux-gnuabi64 \
gcc-powerpc64-linux-gnu \
make \
perl \
&& rm -rf /var/lib/apt/lists/*
# Download source code for release.
WORKDIR /tmp/coreutils
RUN curl -fsSL https://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz \
| tar xJ --strip-components 1
# Compile and install for mips64.
RUN CFLAGS="-B/usr/mips64-linux-gnuabi64/bin/ --target=mips64-linux-gnuabi64 -I/usr/mips64-linux-gnuabi64/include" \
./configure --host=mips64-linux-gnuabi --prefix=/opt/coreutils-mips \
&& make \
&& make install
# Compile and install for powerpc64.
RUN make clean \
&& CFLAGS="-B/usr/powerpc64-linux-gnu/bin/ --target=powerpc64-linux-gnueabi -I/usr/powerpc64-linux-gnu/include" \
./configure --host=powerpc64-linux-gnueabi --prefix=/opt/coreutils-powerpc64 \
&& make \
&& make install
# Keep only the compiled programs from the previous stage.
FROM debian:buster
COPY --from=0 /opt /opt
I am current working on a simple build tool in Python that maybe help you.
Unfortunately, still at moment, lacks clang implementation, but works fine with GCC and MSVC.
Basically the thing mix Json parameters files to generate command line building.
CppMagic

"cdk" command not found after installing python version

The "cdk" command is not found after installing with "pip install --upgrade aws-cdk.core" (per the docs).
The package successfully installs because it is found in the "site-packages" directory.
tennis.smith at C02TM089GY6N in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
$ ls
README.txt cattr/ docopt-0.6.2.dist-info/ pip/ requests-2.22.0.dist-info/ typing_extensions.py
__pycache__/ cattrs-0.9.0.dist-info/ docopt.py pip-19.3.dist-info/ setuptools/ urllib3/
attr/ certifi/ easy_install.py pkg_resources/ setuptools-41.2.0.dist-info/ urllib3-1.25.6.dist-info/
attrs-19.3.0.dist-info/ certifi-2019.9.11.dist-info/ idna/ publication-0.0.3.dist-info/ six-1.12.0.dist-info/ wheel/
aws_cdk/ chardet/ idna-2.8.dist-info/ publication.py six.py wheel-0.33.6.dist-info/
aws_cdk.core-1.13.1.dist-info/ chardet-3.0.4.dist-info/ jsii/ python_dateutil-2.8.0.dist-info/ tests/ yarg/
aws_cdk.cx_api-1.13.1.dist-info/ dateutil/ jsii-0.19.0.dist-info/ requests/ typing_extensions-3.7.4.dist-info/ yarg-0.1.9.dist-info/
Any ideas why it isn't being detected?
To install the CDK CLI run npm install -g aws-cdk.

avahi compilation error "libgdbm.so not found" ubuntu 16.04?

Getting libgdbm.so not found error, couldn't resolve even after installing proper package. Also I couldn't find proper documentation on compiling from source and installing.
To build avahi on Ubuntu I would suggest the following steps:
sudo apt-get build-dep avahi # (you'll need to have enabled deb-src lines in /etc/apt/sources.list for this to work, or you can use the software settings to enable source packages)
Then additionally install xml2man and python-gi-dev
sudo apt install python-gi-dev xml2man
Then configure with these options:
./configure --disable-gtk --disable-qt3 --disable-mono
Avahi always errors about a build dependency it can't find, requiring you to explicitly disable those items. Above I suggest to disable some old toolkits (gtk2 and qt3) plus mono support. If you get other errors you can generally use a similar --disable-X option to disable those. But for Ubuntu generally you can compile almost everything else.
gtk and qt3 is disabled by default in the latest git, but not the latest release.
A quick place to check for the required ubuntu deps would be the travis configuration: https://github.com/lathiat/avahi/blob/master/.travis.yml
Out of curiosity, what is the reason you're building from source? The Avahi packages in Ubuntu 16.04 should work well.
Compilation steps:
1) Install dependency
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
sudo apt-get install libqt4-dev libtool libglib2.0-dev intltool build-essential libgtk2.0-dev libdaemon-dev xmltoman
2) Generate configure file
bash autogen.sh
Ignore following error
checking for QT5... no
configure: error: Package requirements ( Qt5Core >= 5.0.0 ) were not met:
No package 'Qt5Core' found
3) Create makefile
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--disable-static \
--disable-mono \
--disable-monodoc \
--disable-python \
--disable-qt3 \
--disable-qt4 \
--disable-qt5 \
--disable-gdbm \
--enable-core-docs \
--with-distro=none \
--with-systemdsystemunitdir=no \
--disable-shared \
--disable-gtk
4) Make and install
make
sudo make install
[Edit] if debugging with custom logs/code use --disable-shared in configure else changes wont reflect.

Can't compile CUDA samples: ld: library not found for -lgomp clang: error: linker command failed with exit code 1 [duplicate]

I'm trying to get openmp to run in my program on Mavericks, however when I try to compile using the flag -fopenmp I get the following error:
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The command I am running is:
gcc myProgram.cpp -fopenmp -o myProgram
Also, when I run gcc I get Clang warnings which I find to be very strange. And looking into /usr/bin/gcc it does not appear to link to Clang.
Any suggestions on how to fix my Clang errors and get openmp to compile?
The gcc command in the latest Xcode suite is no longer the GCC frontend to LLVM (based on the very old GCC 4.2.1) but rather a symlink to clang. Clang does not (yet) support OpenMP. You have to install separately another version of GCC, e.g. by following this tutorial or by using any of the available software package management systems like MacPorts and Homebrew.
I just recently attacked this problem and have scripted the process of getting everything working based on the official instructions.
The script will download everything into ~/code for easy maintenance and will append the correct environment variables to your ~/.profile file. For advanced users, pick a nice location you want the lib, bin and include installed and move them manually. The script depends on knowing the latest OpenMP runtime from Intel, which can be altered at the top of the script.
The script should work out of the box with vanilla Mavericks, except for one small problem. In the OpenML runtime make script, it does not reliably accept clang when specified and continues with the default GCC. As such, if you don't have GCC installed (which is not normal on out of the box Mavericks), it will fail to build. To fix this, you must comment out two lines (as noted in the script) based on the libomp_20131209_oss.tgz build of OpenMP. Newer builds of OpenML might break this script, so use at your own peril on newer versions.
Simply save this script into a file, run 'chmod +x filename.sh', and run './filename.sh' from terminal. It will take a while to build LLVM and Clang, so be patient.
EDIT: This script will most likely fail on Yosemite and I am having issues using the built clang2 after the update to the dev builds of OSX 10.10.
INTEL_OPENMP_LATEST_BUILD_LINK=https://www.openmprtl.org/sites/default/files/libomp_20131209_oss.tgz
DEST_FOLDER = ~/code
CLANG_INCLUDE=${DEST_FOLDER}/llvm/include
CLANG_BIN=${DEST_FOLDER}/llvm/build/Debug+Asserts/bin
CLANG_LIB=${DEST_FOLDER}/llvm/build/Debug+Asserts/lib
OPENMP_INCLUDE=${DEST_FOLDER}/libomp_oss/exports/common/include
OPENMP_LIB=${DEST_FOLDER}/libomp_oss/exports/mac_32e/lib.thin
mkdir ${DEST_FOLDER}
cd ${DEST_FOLDER}
git clone https://github.com/clang-omp/llvm
git clone https://github.com/clang-omp/compiler-rt llvm/projects/compiler-rt
git clone -b clang-omp https://github.com/clang-omp/clang llvm/tools/clang
cd llvm
mkdir build
cd build
../configure
make
cd Debug+Asserts/bin
mv clang clang2
rm -rf clang++
ln -s clang2 clang2++
echo "LLVM+Clang+OpenMP Include Path : " ${CLANG_INCLUDE}
echo "LLVM+Clang+OpenMP Bin Path : " ${CLANG_BIN}
echo "LLVM+Clang+OpenMP Lib Path : " ${CLANG_LIB}
cd ${DEST_FOLDER}
curl ${INTEL_OPENMP_LATEST_BUILD_LINK} -o libomp_oss_temp.tgz
gunzip -c libomp_oss_temp.tgz | tar xopf -
rm -rf libomp_oss_temp.tgz
cd libomp_oss
echo "You need to do one or two things:"
echo "1.) [Required] Comment out line 433 from libomp_oss/src/makefile.mk"
echo "2.) [Optional] If you do not have GCC installed (not normal on vanilla Mavericks), you must comment out lines 450-451 in libomp_oss/tools/check-tools.pl. Have you done this or want to compile anyway?"
select yn in "Yes" "No"; do
case $yn in
Yes ) make compiler=clang; break;;
No ) exit;;
esac
done
echo "OpenMP Runtime Include Path : " ${OPENMP_INCLUDE}
echo "OpenMP Runtime Lib Path : " ${OPENMP_LIB}
(echo 'export PATH='${CLANG_BIN}':$PATH';
echo 'export C_INCLUDE_PATH='${CLANG_INCLUDE}':'${OPENMP_INCLUDE}':$C_INCLUDE_PATH';
echo 'export CPLUS_INCLUDE_PATH='${CLANG_INCLUDE}':'${OPENMP_INCLUDE}':$CPLUS_INCLUDE_PATH';
echo 'export LIBRARY_PATH='${CLANG_LIB}':'${OPENMP_LIB}':$LIBRARY_PATH';
echo 'export DYLD_LIBRARY_PATH='${CLANG_LIB}':'${OPENMP_LIB}':$DYLD_LIBRARY_PATH}') >> ~/.profile
source ~/.profile
echo "LLVM+Clang+OpenMP is now accessible through [ clang2 ] via terminal and does not conflict with Apple's clang"
If you are running homebrew you can fix this problem by calling:
brew install clang-omp
The compiler will be available under clang-omp++ name
Just worked through this problem. Here's the answer plus how to get it worked with Xcode.
Grab the latest version of openMP runtime library from
https://www.openmprtl.org/download
unzip and compile it by
mkdir build && cd build && cmake .. && make && sudo make install
install it by
sudo cp ./libiomp5.dylib /usr/lib/
sudo cp ./omp.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/
Grab openmp/clang from Git following the instructions on http://clang-omp.github.io/
compile openmp/clang
cd llvm && mkdir build && cd build && ../configure --enable-optimized && make -j
sudo make install
normally it would install clang/clang++ into /usr/local/bin, we need replace the Apple clang with our version
cd /usr/bin
sudo mv clang clang-apple
sudo mv clang++ clang++-apple
sudo ln -s /usr/local/bin/clang ./clang
sudo ln -s /usr/local/bin/clang++ ./clang++
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
sudo mv clang clang-apple
sudo mv clang++ clang++-apple
sudo ln -s /usr/local/bin/clang ./clang
sudo ln -s /usr/local/bin/clang++ ./clang++
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
sudo mv -f * ../../
Create a project in Xcode, using the Hello World code on clang-openmp website for test. After created, add "-fopenmp" to Custom Compiler Flags -> Other C Flags in project settings; add /usr/lib/libiomp5.dylib to the build phases of project (project settings -> Build Phases -> Drag /usr/lib/libiomp5.dylib into Link Binary with Libraries)
It should work. Yosemite + Xcode 6 is tested.
Note: the custom clang is NOT as stable as Apple's. Switch back if you meet strange instruction error after compiled.

Resources