[cfe-dev] Building libc++ RPMs on RHEL 6.x 64bit

Zack Perry zack.perry at sbcglobal.net
Fri Jul 26 23:29:15 PDT 2013


I have been trying to build RPM packages for libc++ 3.3 on a RHEL 6.4 box. I need both static and shared libraries. So, I learned some basics of cmake and then modified the bundled CMakeList.txt. Got that part to work.

But since in RHEL 6.x, all 64-bit libraries should go to /usr/lib64 instead of /usr/lib,  I have been attempting to use the following to get the job done:

(A) During building, I use
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX}) 
to have all library files (*.so* and *.a) located in lib64 rather than lib.

(B) Using a ADD_LIBRARY... command as shown below
ADD_LIBRARY(c++ STATIC ... 
together with 
set_target_properties(c++ PROPERTIES ARCHIVE_OUTPUT_DIRECTORY${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX}) INSTALL(TARGETS c++  ARCHIVE DESTINATION lib${LIB_SUFFIX}) 
to get the static library installed in /usr/lib64. 

(C) In addition, with 
INSTALL(FILES ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX}/libc++.so DESTINATION lib${LIB_SUFFIX})
INSTALL(FILES ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX}/libc++.so.1 DESTINATION lib${LIB_SUFFIX})
INSTALL(FILES ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX}/libc++.so.1.0 DESTINATION lib${LIB_SUFFIX}) 
to have shared libary also installed in /usr/lib64 too.

But a copy of the shared library is still installed in /usr/lib in the resulting RPM; see below:

$ rpm -qlp libcxx-3-3-0.el6.x86_64.rpm 
[...]
/usr/lib
/usr/lib/libc++.so
/usr/lib/libc++.so.1
/usr/lib/libc++.so.1.0
/usr/lib64
/usr/lib64/libc++.a

/usr/lib64/libc++.so
/usr/lib64/libc++.so.1
/usr/lib64/libc++.so.1.0



If I were to write a RPM spec file, the _libdir macro automatically handles this. With cmake, given the fact that I am still new to it, I would appreciate a hint/pointer as to the right directive to use.  

-- Zack




More information about the cfe-dev mailing list