Ticket #586 (closed defect: fixed)
cmake rules install into /usr/lib on x86_64
| Reported by: | tuju | Owned by: | dgollub |
|---|---|---|---|
| Priority: | normal | Milestone: | OpenSync 0.40 |
| Component: | OpenSync | Version: | 0.33 |
| Severity: | normal | Keywords: | r2625 |
| Cc: |
Description
$ rpm --eval %{_lib}
lib64
$ arch
x86_64
inside spec file
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/usr \
-D LIBRARY_OUTPUT_PATH:PATH=%{_lib} \
-D OPENSYNC_DEBUG_MODULES:BOOL=ON \
-D OPENSYNC_TRACE:BOOL=ON \
-D OPENSYNC_UNITTESTS:BOOL=ON \
.
make %{?_smp_mflags}
}}}}
and %{buildroot} contains
{{{
$ find /var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/ | grep "/usr/lib"
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/libopensync.so.1.0.0
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/pkgconfig
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/pkgconfig/opensync-1.0.pc
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/opensync
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/opensync/formats
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/opensync/formats/libplain.so
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/opensync/formats/libxmlformat-doc.so
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/opensync/formats/libxmlformat.so
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/opensync/formats/libfile.so
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/libopensync.so
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/libopensync.so.1
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/python
/var/tmp/libopensync-0.33-0.fc6.2625svn-root-tuju/usr/lib/python/site-packages
}}}
Change History
comment:2 Changed 4 years ago by tuju
relevant part of cmake_install.cmake
FILE(INSTALL DESTINATION "/usr/lib/python/site-packages" TYPE FILE FILES "/home/tuju/PKGS/BUILD/libopensync-0.33svn2625/wrapper/_opensync.so") FILE(INSTALL DESTINATION "/usr/lib/python/site-packages" TYPE FILE FILES "/home/tuju/PKGS/BUILD/libopensync-0.33svn2625/wrapper/opensync.py")
For some reason the _opensync.so creation fails.
comment:3 Changed 4 years ago by tuju
with
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/usr \
-D OPENSYNC_DEBUG_MODULES:BOOL=ON \
-D OPENSYNC_TRACE:BOOL=ON \
-D OPENSYNC_UNITTESTS:BOOL=ON \
.
build succeeds but installs into /usr/lib.
comment:4 follow-up: ↓ 5 Changed 4 years ago by tuju
with
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/usr \
-D LIBRARY_OUTPUT_PATH:PATH=/usr/lib \
-D OPENSYNC_DEBUG_MODULES:BOOL=ON \
-D OPENSYNC_TRACE:BOOL=ON \
-D OPENSYNC_UNITTESTS:BOOL=ON \
.
build fails with following:
[ 58%] Building C object opensync/CMakeFiles/opensync.dir/plugin/opensync_sink.o [ 59%] Building C object opensync/CMakeFiles/opensync.dir/version/opensync_version.o Linking C shared library /usr/lib/libopensync.so /usr/bin/ld: cannot open output file /usr/lib/libopensync.so.1.0.0: Permission denied collect2: ld returned 1 exit status make[2]: *** [/usr/lib/libopensync.so.1.0.0] Error 1 make[1]: *** [opensync/CMakeFiles/opensync.dir/all] Error 2 make: *** [all] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.57892 (%build)
for some reason it tries to install during the build into real root.
comment:5 in reply to: ↑ 4 Changed 4 years ago by dgollub
- Status changed from new to assigned
I guess the reason for build failure in 4 is LIBRARY_OUTPUT_PATH.
Quote from http://www.cmake.org/Wiki/CMake_Useful_Variables
LIBRARY_OUTPUT_PATH
set this variable to specify a common place where CMake should put all libraries (instead of CMAKE_CURRENT_BINARY_DIR)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
As far as i understand the LIBRARY_OUTPUT_PATH variable is not about the installation destination - it's more about the build destination for the object file.
Regarding building for x86_64 and the library suffix you should use:
-DLIB_SUFFIX=64
This variable is provided by one of the OpenSync? modules already. Not quite sure if this is the common CMake way to provie this.
Let me know if this works for you.
comment:6 Changed 4 years ago by tuju
- Status changed from assigned to closed
- Resolution set to fixed
using the rpm built-in macro:
%{cmake} \
-D OPENSYNC_DEBUG_MODULES:BOOL=ON \
-D OPENSYNC_TRACE:BOOL=ON \
-D OPENSYNC_UNITTESTS:BOOL=ON \
.
make %{?_smp_mflags}
solved the issue. and yes, that actually builds with
+ export FFLAGS + /usr/bin/cmake -DLIB_SUFFIX=64 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS:BOOL=ON -D OPENSYNC_DEBUG_MODULES:BOOL=ON -D OPENSYNC_TRACE:BOOL=ON -D OPENSYNC_UNITTESTS:BOOL=ON .
closing.
comment:8 Changed 23 months ago by sim
decoration Changed 1 year ago by admin
bathtub Changed 1 year ago by admin
solar system Changed 1 year ago by admin
stair parts Changed 1 year ago by admin
solar supply Changed 1 year ago by admin

And build fails too.