[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: CMake Error: Could not open file for write in copy operation ... System Error: Permission denied



Hi Corentin!


El 24/10/14 a les 11:05, Corentin Desfarges ha escrit:
I removed lines in question and replaced them by :
configure_file("${CMAKE_CURRENT_LIST_DIR}/bin/qt.conf" "${CMAKE_CURRENT_BINARY_DIR}/qt.conf") (And CMAKE_CURRENT_BINARY_DIR isn't /usr/bin this time). And it works ! I mean the CMake configuration is done successfully.

Great! :-)

Another little question : The configuration is okay, but as soon as the build starts, I've an error (about libraries just built but not found), and to fix it, I use "pdebuild --use-pdebuild-internal". Is it a good practise ? I've never used this option before...

Again, a little more information right here in the list (without having to download and build your package) would be helpful. Without additional information, the only thing to say here is: No, it's not good practice. It's more of a workaround.

When I build your package (including the fixes of the problem you had before), I see the following line: /usr/bin/ld: cannot open output file /usr/lib/fw4spl/libfwCore.so.0.1: No such file or directory

This tells me that at build time you have the same problem that you had before at configure time: Your package is trying to write things to /usr. The only time things should be written to global locations like this is during the installation target. There you can safely assume that you either have super-user powers or writing to the location CMAKE_INSTALL_PREFIX doesn't require them.

Looking at the main CMakeLists.txt, I'd say that the branch with CLASSIC_INSTALL=ON is the sane way to do thing. In the other branch (CLASSIC_INSTALL=OFF) I'm seeing dangerous things like:
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_DIR})
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_DIR})

Removing those lines will make it compile.

I am under the impression that whoever wrote the CMakeLists.txt was not aware of CMake's Install Commands [1] and tried to simulate their effect with the CLASSIC_INSTALL=OFF branches, by making CMake write everything directly to installation locations. A better strategy would be: Do everything like in the CLASSIC_INSTALL=ON branches and add additional INSTALL commands. This way, if the user just executes "make", you will have the "classic install". If he executes "make install" afterwards, then CMake copies the compiled/configured stuff to installation locations (as defined by the INSTALL commands in the CMakeLists.txt). And at that stage, you can safely assume that you have enough privileges to actually do that.

I hope that helps! :-)

Cheers,
Martin

[1] http://www.cmake.org/Wiki/CMake:Install_Commands



Reply to: