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

2014-10-24 Thread Corentin Desfarges

Hi everybody!


First, thank you for all your advices.


Can you publish the source package?

As Martin said, mysource package  is available in Debian-Med [1]

 But configuring files directly to installation locations (like your 
/usr/bin) is a bad idea. This requires superuser powers
 at configuration time - which you usually don't have. Instead, just 
configure it to the build directory, use it there and
 install it later using CMake's installation commands: 
http://www.cmake.org/Wiki/CMake:Install_Commands


 A little correction: It actually said RUNTIME_OUTPUT_DIR (which is 
/usr/bin) in the original file, not
 CMAKE_CURRENT_BINARY_DIR (which would be better!). The point stays 
the same: You are configuring files to

 /usr/bin/, which is not a good idea.

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.


 Btw. I think your package is also missing a build dependency to 
libqt4-opengl-dev.


Yes I fixed it.

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...



Finally thank you again for your help.

Best regards,

Corentin

[1] 
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=debian-med/fw4spl.git



--
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/544a1649.5070...@gmail.com



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

2014-10-24 Thread Martin Steghöfer

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



--
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/544a3896.2090...@steghoefer.eu



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

2014-10-23 Thread Andrey Rahmatullin
On Thu, Oct 23, 2014 at 03:01:02PM +0200, Corentin Desfarges wrote:
 I'm currently working on the packaging of fw4spl (an open source framework)
 and I got this CMake error when I use pbuilder :
 
  CMake Error: Could not open file for write in copy operation
 /usr/bin/qt.conf.tmp
  CMake Error: : System Error: Permission denied
  CMake Error at SrcLib/core/fwGuiQt/CMakeLists.txt:12 (configure_file):
   configure_file Problem configuring file
Did you read the CMakeLists.txt?

 I've seen that this problem has been frequently raised, but aside from a
 change of CMake version (and I can't, obviously), I didn't found any
 solution.
 A strange thing is that when I use debuild, the issue doesn't happen.
 
 Hoping someone will have an idea...
Can you publish the source package?

-- 
WBR, wRAR


signature.asc
Description: Digital signature


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

2014-10-23 Thread Martin Steghöfer

Hi Corentin!

Corentin Desfarges wrote:

Hi all,

I'm currently working on the packaging of fw4spl (an open source 
framework) and I got this CMake error when I use pbuilder :


 CMake Error: Could not open file for write in copy operation 
/usr/bin/qt.conf.tmp

 CMake Error: : System Error: Permission denied
 CMake Error at SrcLib/core/fwGuiQt/CMakeLists.txt:12 (configure_file):
  configure_file Problem configuring file


In order to get efficient help, you should really provide a little bit 
more information, e.g. the lines mentioned in the error message or a URL 
to your source package. I finally found it in debian-med and pulled it.


The line in question says:
  configure_file(${CMAKE_CURRENT_LIST_DIR}/bin/qt.conf 
${CMAKE_CURRENT_BINARY_DIR}/qt.conf)

where CMAKE_CURRENT_BINARY_DIR is /usr/bin.

But configuring files directly to installation locations (like your 
/usr/bin) is a bad idea. This requires superuser powers at 
configuration time - which you usually don't have. Instead, just 
configure it to the build directory, use it there and install it later 
using CMake's installation commands: 
http://www.cmake.org/Wiki/CMake:Install_Commands


Btw. I think your package is also missing a build dependency to 
libqt4-opengl-dev.


Cheers,
Martin



--
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/54492666.7060...@steghoefer.eu



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

2014-10-23 Thread Martin Steghöfer

El 23/10/14 a les 18:01, Martin Steghöfer ha escrit:

The line in question says:
  configure_file(${CMAKE_CURRENT_LIST_DIR}/bin/qt.conf 
${CMAKE_CURRENT_BINARY_DIR}/qt.conf)

where CMAKE_CURRENT_BINARY_DIR is /usr/bin.


A little correction: It actually said RUNTIME_OUTPUT_DIR (which is 
/usr/bin) in the original file, not CMAKE_CURRENT_BINARY_DIR (which 
would be better!).


The point stays the same: You are configuring files to /usr/bin/, which 
is not a good idea.


Cheers,
Martin


--
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/54492cf8.70...@steghoefer.eu