[cmake-developers] [CMake 0015699]: Link project to custom libc version installed in /opt without bothering system
Mantis Bug Tracker
mantis at public.kitware.com
Sun Aug 16 07:07:02 EDT 2015
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=15699
======================================================================
Reported By: pavel.odintsov
Assigned To:
======================================================================
Project: CMake
Issue ID: 15699
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2015-08-16 07:07 EDT
Last Modified: 2015-08-16 07:07 EDT
======================================================================
Summary: Link project to custom libc version installed in
/opt without bothering system
Description:
Hello, folks!
I'm trying to build my application project which links to custom libc version
installed in /opt.
I have installed glibc 2.22 and gcc 5.2.2 in /opt.
And I have following cmake file:
cmake_minimum_required (VERSION 2.8)
project(MyProject)
# Run this code this way:
# cd build
# cmake -DCMAKE_C_COMPILER=/opt/gcc520/bin/gcc
-DCMAKE_CXX_COMPILER=/opt/gcc520/bin/g++ ..
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_COMPILER "/opt/gcc520/bin/gcc")
set(CMAKE_CXX_COMPILER "/opt/gcc520/bin/g++")
# Remove all standard path's
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "")
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
# Specify path's to custom compiled gcc and glibc
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;gcc;gcc_s;m;c")
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/opt/glibc_2.22/include")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES
"/opt/glibc_2.22/lib;/opt/gcc520/lib64;/opt/glibc_2.22/lib;/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11")
# Specify custom ld-linux dynamic linker path
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}
-Wl,--dynamic-linker=/opt/glibc_2.22/lib/ld-linux-x86-64.so.2")
# Specify full RPATH for build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# Create builds in current folder with install RPATH
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "/opt/gcc520/lib64;/opt/glibc_2.22/lib")
add_executable(suxx suxx.cpp)
So when I'm running this manifest it still uses system includes/libraries. But
It should not do it.
I could offer strace of make command here:
strace -s 1024 -f -etrace=execve make
execve("/usr/bin/make", ["make"], [/* 24 vars */]) = 0
Process 13613 attached
[pid 13613] execve("/usr/bin/cmake", ["/usr/bin/cmake",
"-H/root/cmake_custom_libc", "-B/root/cmake_custom_libc/build",
"--check-build-system", "CMakeFiles/Makefile.cmake", "0"], [/* 27 vars */]) = 0
[pid 13613] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13613, si_uid=0,
si_status=0, si_utime=1, si_stime=0} ---
Process 13614 attached
[pid 13614] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_progress_start", "/root/cmake_custom_libc/build/CMakeFiles",
"/root/cmake_custom_libc/build/CMakeFiles/progress.marks"], [/* 27 vars */]) = 0
[pid 13614] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13614, si_uid=0,
si_status=0, si_utime=0, si_stime=0} ---
Process 13615 attached
[pid 13615] execve("/usr/local/sbin/make", ["make", "-f",
"CMakeFiles/Makefile2", "all"], [/* 27 vars */]) = -1 ENOENT (No such file or
directory)
[pid 13615] execve("/usr/local/bin/make", ["make", "-f", "CMakeFiles/Makefile2",
"all"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
[pid 13615] execve("/usr/sbin/make", ["make", "-f", "CMakeFiles/Makefile2",
"all"], [/* 27 vars */]) = -1 ENOENT (No such file or directory)
[pid 13615] execve("/usr/bin/make", ["make", "-f", "CMakeFiles/Makefile2",
"all"], [/* 27 vars */]) = 0
Process 13616 attached
[pid 13616] execve("/usr/local/sbin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/depend"], [/* 27 vars
*/]) = -1 ENOENT (No such file or directory)
[pid 13616] execve("/usr/local/bin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/depend"], [/* 27 vars
*/]) = -1 ENOENT (No such file or directory)
[pid 13616] execve("/usr/sbin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/depend"], [/* 27 vars
*/]) = -1 ENOENT (No such file or directory)
[pid 13616] execve("/usr/bin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/depend"], [/* 27 vars
*/]) = 0
Process 13617 attached
[pid 13617] execve("/bin/sh", ["/bin/sh", "-c", "cd
/root/cmake_custom_libc/build && /usr/bin/cmake -E cmake_depends \"Unix
Makefiles\" /root/cmake_custom_libc /root/cmake_custom_libc
/root/cmake_custom_libc/build /root/cmake_custom_libc/build
/root/cmake_custom_libc/build/CMakeFiles/suxx.dir/DependInfo.cmake --color="],
[/* 27 vars */]) = 0
Process 13618 attached
[pid 13618] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E", "cmake_depends",
"Unix Makefiles", "/root/cmake_custom_libc", "/root/cmake_custom_libc",
"/root/cmake_custom_libc/build", "/root/cmake_custom_libc/build",
"/root/cmake_custom_libc/build/CMakeFiles/suxx.dir/DependInfo.cmake",
"--color="], [/* 27 vars */]) = 0
[pid 13618] +++ exited with 0 +++
[pid 13617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13618,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13617] +++ exited with 0 +++
[pid 13616] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13617,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13616] +++ exited with 0 +++
[pid 13615] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13616,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13619 attached
[pid 13619] execve("/usr/local/sbin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/build"], [/* 27 vars */])
= -1 ENOENT (No such file or directory)
[pid 13619] execve("/usr/local/bin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/build"], [/* 27 vars */])
= -1 ENOENT (No such file or directory)
[pid 13619] execve("/usr/sbin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/build"], [/* 27 vars */])
= -1 ENOENT (No such file or directory)
[pid 13619] execve("/usr/bin/make", ["make", "-f",
"CMakeFiles/suxx.dir/build.make", "CMakeFiles/suxx.dir/build"], [/* 27 vars */])
= 0
Process 13620 attached
[pid 13620] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_progress_report", "/root/cmake_custom_libc/build/CMakeFiles", "1"], [/*
27 vars */]) = 0
[100%] [pid 13620] +++ exited with 0 +++
[pid 13619] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13620,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13621 attached
[pid 13621] execve("/bin/sh", ["/bin/sh", "-c", "/usr/bin/cmake -E
cmake_echo_color --switch= --green \"Building CXX object
CMakeFiles/suxx.dir/suxx.cpp.o\""], [/* 27 vars */]) = 0
Process 13622 attached
[pid 13622] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_echo_color", "--switch=", "--green", "Building CXX object
CMakeFiles/suxx.dir/suxx.cpp.o"], [/* 27 vars */]) = 0
Building CXX object CMakeFiles/suxx.dir/suxx.cpp.o
[pid 13622] +++ exited with 0 +++
[pid 13621] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13622,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13621] +++ exited with 0 +++
[pid 13619] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13621,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13623 attached
[pid 13623] execve("/opt/gcc520/bin/g++", ["/opt/gcc520/bin/g++", "-O3",
"-DNDEBUG", "-std=c++11",
"-Wl,--dynamic-linker=/opt/glibc_2.22/lib/ld-linux-x86-64.so.2", "-o",
"CMakeFiles/suxx.dir/suxx.cpp.o", "-c", "/root/cmake_custom_libc/suxx.cpp"], [/*
27 vars */]) = 0
Process 13624 attached
[pid 13624]
execve("/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/cc1plus",
["/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/cc1plus", "-quiet",
"-imultiarch", "x86_64-linux-gnu", "-D_GNU_SOURCE", "-D", "NDEBUG",
"/root/cmake_custom_libc/suxx.cpp", "-quiet", "-dumpbase", "suxx.cpp",
"-mtune=generic", "-march=x86-64", "-auxbase-strip",
"CMakeFiles/suxx.dir/suxx.cpp.o", "-O3", "-std=c++11", "-o", "/tmp/ccQUQdy0.s"],
[/* 29 vars */]) = 0
[pid 13624] +++ exited with 0 +++
[pid 13623] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13624,
si_uid=0, si_status=0, si_utime=16, si_stime=2} ---
Process 13625 attached
[pid 13625] execve("/usr/local/sbin/as", ["as", "--64", "-o",
"CMakeFiles/suxx.dir/suxx.cpp.o", "/tmp/ccQUQdy0.s"], [/* 29 vars */]) = -1
ENOENT (No such file or directory)
[pid 13625] execve("/usr/local/bin/as", ["as", "--64", "-o",
"CMakeFiles/suxx.dir/suxx.cpp.o", "/tmp/ccQUQdy0.s"], [/* 29 vars */]) = -1
ENOENT (No such file or directory)
[pid 13625] execve("/usr/sbin/as", ["as", "--64", "-o",
"CMakeFiles/suxx.dir/suxx.cpp.o", "/tmp/ccQUQdy0.s"], [/* 29 vars */]) = -1
ENOENT (No such file or directory)
[pid 13625] execve("/usr/bin/as", ["as", "--64", "-o",
"CMakeFiles/suxx.dir/suxx.cpp.o", "/tmp/ccQUQdy0.s"], [/* 29 vars */]) = 0
[pid 13625] +++ exited with 0 +++
[pid 13623] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13625,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13623] +++ exited with 0 +++
[pid 13619] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13623,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13626 attached
[pid 13626] execve("/bin/sh", ["/bin/sh", "-c", "/usr/bin/cmake -E
cmake_echo_color --switch= --red --bold \"Linking CXX executable suxx\""], [/*
27 vars */]) = 0
Process 13627 attached
[pid 13627] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_echo_color", "--switch=", "--red", "--bold", "Linking CXX executable
suxx"], [/* 27 vars */]) = 0
Linking CXX executable suxx
[pid 13627] +++ exited with 0 +++
[pid 13626] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13627,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13626] +++ exited with 0 +++
[pid 13619] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13626,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13628 attached
[pid 13628] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_link_script", "CMakeFiles/suxx.dir/link.txt", "--verbose="], [/* 27 vars
*/]) = 0
Process 13629 attached
[pid 13629] execve("/opt/gcc520/bin/g++", ["/opt/gcc520/bin/g++", "-O3",
"-DNDEBUG", "-std=c++11",
"-Wl,--dynamic-linker=/opt/glibc_2.22/lib/ld-linux-x86-64.so.2",
"CMakeFiles/suxx.dir/suxx.cpp.o", "-o", "suxx", "-rdynamic",
"-Wl,-rpath,/opt/gcc520/lib64:/opt/glibc_2.22/lib"], [/* 27 vars */]) = 0
Process 13630 attached
[pid 13630]
execve("/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/collect2",
["/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/collect2", "-plugin",
"/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/liblto_plugin.so",
"-plugin-opt=/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper",
"-plugin-opt=-fresolution=/tmp/ccvXyPTt.res",
"-plugin-opt=-pass-through=-lgcc_s", "-plugin-opt=-pass-through=-lgcc",
"-plugin-opt=-pass-through=-lc", "-plugin-opt=-pass-through=-lgcc_s",
"-plugin-opt=-pass-through=-lgcc", "--eh-frame-hdr", "-m", "elf_x86_64",
"-export-dynamic", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o",
"suxx", "/usr/lib/x86_64-linux-gnu/crt1.o", "/usr/lib/x86_64-linux-gnu/crti.o",
"/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtbegin.o",
"-L/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0",
"-L/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../lib64",
"-L/lib/x86_64-linux-gnu", "-L/lib/../lib64", "-L/usr/lib/x86_64-linux-gnu",
"-L/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../..",
"--dynamic-linker=/opt/glibc_2.22/lib/ld-linux-x86-64.so.2",
"CMakeFiles/suxx.dir/suxx.cpp.o", "-rpath",
"/opt/gcc520/lib64:/opt/glibc_2.22/lib", "-lstdc++", "-lm", "-lgcc_s", "-lgcc",
"-lc", "-lgcc_s", "-lgcc",
"/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtend.o",
"/usr/lib/x86_64-linux-gnu/crtn.o"], [/* 32 vars */]) = 0
Process 13631 attached
[pid 13631] execve("/usr/bin/ld", ["/usr/bin/ld", "-plugin",
"/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/liblto_plugin.so",
"-plugin-opt=/opt/gcc520/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper",
"-plugin-opt=-fresolution=/tmp/ccvXyPTt.res",
"-plugin-opt=-pass-through=-lgcc_s", "-plugin-opt=-pass-through=-lgcc",
"-plugin-opt=-pass-through=-lc", "-plugin-opt=-pass-through=-lgcc_s",
"-plugin-opt=-pass-through=-lgcc", "--eh-frame-hdr", "-m", "elf_x86_64",
"-export-dynamic", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o",
"suxx", "/usr/lib/x86_64-linux-gnu/crt1.o", "/usr/lib/x86_64-linux-gnu/crti.o",
"/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtbegin.o",
"-L/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0",
"-L/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../lib64",
"-L/lib/x86_64-linux-gnu", "-L/lib/../lib64", "-L/usr/lib/x86_64-linux-gnu",
"-L/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../..",
"--dynamic-linker=/opt/glibc_2.22/lib/ld-linux-x86-64.so.2",
"CMakeFiles/suxx.dir/suxx.cpp.o", "-rpath",
"/opt/gcc520/lib64:/opt/glibc_2.22/lib", "-lstdc++", "-lm", "-lgcc_s", "-lgcc",
"-lc", "-lgcc_s", "-lgcc",
"/opt/gcc520/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/crtend.o",
"/usr/lib/x86_64-linux-gnu/crtn.o"], [/* 32 vars */]) = 0
[pid 13631] +++ exited with 0 +++
[pid 13630] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13631,
si_uid=0, si_status=0, si_utime=2, si_stime=1} ---
[pid 13630] +++ exited with 0 +++
[pid 13629] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13630,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13629] +++ exited with 0 +++
[pid 13628] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13629,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13628] +++ exited with 0 +++
[pid 13619] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13628,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13619] +++ exited with 0 +++
[pid 13615] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13619,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13632 attached
[pid 13632] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_progress_report", "/root/cmake_custom_libc/build/CMakeFiles", "1"], [/*
27 vars */]) = 0
[100%] [pid 13632] +++ exited with 0 +++
[pid 13615] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13632,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
Process 13633 attached
[pid 13633] execve("/bin/sh", ["/bin/sh", "-c", "echo \"Built target suxx\""],
[/* 27 vars */]) = 0
Built target suxx
[pid 13633] +++ exited with 0 +++
[pid 13615] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13633,
si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid 13615] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13615, si_uid=0,
si_status=0, si_utime=0, si_stime=0} ---
Process 13634 attached
[pid 13634] execve("/usr/bin/cmake", ["/usr/bin/cmake", "-E",
"cmake_progress_start", "/root/cmake_custom_libc/build/CMakeFiles", "0"], [/* 27
vars */]) = 0
[pid 13634] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13634, si_uid=0,
si_status=0, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
So could you recommend how I can build my project without anything from my
system at all? I need all code and libraries from /opt.
Thanks!
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-08-16 07:07 pavel.odintsov New Issue
======================================================================
More information about the cmake-developers
mailing list