-
Notifications
You must be signed in to change notification settings - Fork 3
build
to write ...
taub is a experiment environment for llvm-prof and llvm-pred. it is a cluster.
but the problem is, we didn't have root account to install dependencies, such as clang or llvm or gcc. so we need some tricks on CMake to support successfully compile binary.
this tricks is little difficult, so we write down here.
-
install llvm-3.5.0 and clang-3.5.0 rpms without root.
first, find llvm-3.5.0 on rpmfind.net taub using redhat el6, so we need find rpm packages on el6.
yes, i put a copy on copr.fedoraproject.org . there are llvm-3.5 and gcc48 rpms. you can download it if it doesn't delete by admin.
then, you need uncompress package and put it in home directory. using command like this:
rpm2cpio <rpm file> | cpio -id
put files in
~/.local
or~/usr
or~/usr/local
also, don't forget modify
~/.bashrc
, like this:export PATH=$HOME/.local/bin:$PATH export LD_LIBRARY_PATH=$HOME/.local/lib:$HOME/.local/lib64:$LD_LIBRARY_PATH
you need make sure home directory is before system path, then bash would use our self clang or llvm in advance.
-
setting custom build flags in cmake
just like general linux system, cd in llvm-prof directory, and run:
mkdir build; cd build; export CC=clang #a export CXX=clang++ cmake .. #b cmake .. -DCMAKE_CXX_FLAGS="-nostdinc++ -I$HOME/usr/include/c++/4.8.2 \ -I$HOME/usr/include/c++/4.8.2/x86_64-redhat-linux7E" \ -DCMAKE_EXE_LINKER_FLAGS="-L$HOME/usr/lib/gcc/x86_64-redhat-linux7E/4.8.2/ \ -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic" #c cmake .. -DCMAKE_INSTALL_PREFIX="$HOME/usr/local" #d make make install
-
taub's gcc version is 4.4.7, it is too old and doesn't support c++11, so we should use clang to compile code.
-
run cmake first to establist original files.
-
run cmake again with custom CXX flags, by default, clang would use system libstdc++, which version is 4.4.7, doesn't contail c++11 part. we should link to our gcc48's libstdc++. theory is right, but when i use
ldd lib/libLLVMProf.so
it shows:linux-vdso.so.1 => (0x00007fffc5bff000) libstdc++.so.6 => /usr/local/gcc-4.7.1/lib64/libstdc++.so.6 (0x00007f82f397f000) libm.so.6 => /lib64/libm.so.6 (0x00007f82f36e7000) libgcc_s.so.1 => /usr/local/gcc-4.7.1/lib64/libgcc_s.so.1 (0x00007f82f34d2000) libc.so.6 => /lib64/libc.so.6 (0x00007f82f313d000) /lib64/ld-linux-x86-64.so.2 (0x00007f82f4056000)
also
ldd src/llvm-prof
it shows:linux-vdso.so.1 => (0x00007fff7b7cf000) libLLVM-3.5.so => /home/wzzhang/usr/lib64/llvm/libLLVM-3.5.so (0x00007f04998d6000) libLLVMProfiling.so => /home/wzzhang/project/llvm-prof/build2/lib/libLLVMProfiling.so (0x00007f0499508000) libm.so.6 => /lib64/libm.so.6 (0x00007f0499270000) libgcc_s.so.1 => /usr/local/gcc-4.7.1/lib64/libgcc_s.so.1 (0x00007f049905a000) libc.so.6 => /lib64/libc.so.6 (0x00007f0498cc6000) /lib64/ld-linux-x86-64.so.2 (0x00007f049b43e000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0498aa9000) libffi.so.5 => /home/wzzhang/usr/lib64/libffi.so.5 (0x00007f04988a0000) libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f049867f000) librt.so.1 => /lib64/librt.so.1 (0x00007f0498477000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f0498272000) libstdc++.so.6 => /usr/local/gcc-4.7.1/lib64/libstdc++.so.6 (0x00007f0497f6b000)
the problem is it still linked to libstdc++ with version 4.7.1,(before i use
module load gcc
to register gcc/4.7.1 into system path) not static link with our gcc 4.8. i don't know why, but since it can run successfully, i skip this problem. -
finally, since we couldn't write file in system path, we need install it in our home directory.
after these steps, we successfully install our llvm-prof without root account.
-