[CMake] error while stage install of crosscompiled binaries
Claus Klein
claus.klein at arcormail.de
Sat Jan 9 17:21:52 EST 2010
Hi all,
now I got it:
There are 3 different problems:
1.) never use an absolute DESTINATION path with INSTALL commands!
###XXX### INSTALL( FILES cmake/FindLibSmi.cmake DESTINATION $
{CMAKE_ROOT}/Modules )
2.) never use an absolute source Path!
###XXX### INSTALL( FILES ${CMAKE_BINARY_DIR}/libsmi.pc DESTINATION
lib/pkgconfig )
3) never use a Windows drive letter in one of this paths as "C:/usr"
with CMAKE_INSTALL_PREFIX=C:/usr
###XXX### INSTALL( FILES smi.conf-example DESTINATION $
{CMAKE_INSTALL_PREFIX}/${CMAKE_SYSTEMCONFIG} )
If not, you will get problems in some cases like crosscompile:
test -d build/CMakeFiles && rm -rf build/*
cd build && cmake -DCMAKE_C_COMPILER=i386-mingw32-gcc -
DCMAKE_CXX_COMPILER=i386-mingw32-g++ -DCMAKE_SYSTEM_NAME=Windows .. \
&& make 2>&1 | tee ../crosscompile.log
. . . .
+ make DESTDIR=/tmp/libsmi install/local
+ tee ../temp-install.log
[ 1%] Built target generate_dump_svg_script_h
[ 3%] Built target backend_smi_bison
[ 5%] Built target backend_sming_bison
[ 6%] Built target backend_smi_flex
[ 8%] Built target backend_sming_flex
[ 8%] Built target generated
[ 34%] Built target smi
[ 37%] Built target smidiff
[ 87%] Built target smidump
[ 91%] Built target smilint
[ 94%] Built target smiquery
[100%] Built target smixlate
Installing only the local directory...
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:31 (FILE):
file cannot create directory:
/tmp/libsmi/Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-
cmake/build/C:/usr/lib/pkgconfig.
Maybe need administrative privileges.
make: *** [install/local] Error 1
+ cmake -DCMAKE_INSTALL_PREFIX=C:/usr -DCMAKE_INSTALL_LOCAL_ONLY=1 -P
cmake_install.cmake
+ tee ../temp-install.log
-- Install configuration: "Release"
-- Installing: /Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-
cmake/build/C:/usr/lib/pkgconfig/libsmi.pc
-- Installing: /Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-
cmake/build/C:/usr/lib/pkgconfig/libsmi.pc
-- Installing: /Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-
cmake/build/C:/usr/etc/smi/smi.conf/smi.conf-example
-- Installing: /Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-
cmake/build/C:/usr/C:/usr/etc/smi/smi.conf/smi.conf-example <<<<
really bad!
-- Installing: /Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-
cmake/build/C:/usr/share/cmake/Modules/FindLibSmi.cmake
-- Installing: /opt/local/share/cmake-2.8/Modules/FindLibSmi.cmake
CMake Error at cmake_install.cmake:51 (FILE):
file INSTALL cannot copy file
"/Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-cmake/cmake/
FindLibSmi.cmake"
to "/opt/local/share/cmake-2.8/Modules/FindLibSmi.cmake".
+ cmake -DCMAKE_INSTALL_PREFIX=/tmp/libsmi/usr -
DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
+ tee ../temp-install.log
-- Install configuration: "Release"
-- Up-to-date: /tmp/libsmi/usr/lib/pkgconfig/libsmi.pc
-- Installing: /tmp/libsmi/usr/lib/pkgconfig/libsmi.pc
-- Up-to-date: /tmp/libsmi/usr/etc/smi/smi.conf/smi.conf-example
-- Installing: /tmp/libsmi/usr/C:/usr/etc/smi/smi.conf/smi.conf-example
-- Up-to-date: /tmp/libsmi/usr/share/cmake/Modules/FindLibSmi.cmake
-- Installing: /opt/local/share/cmake-2.8/Modules/FindLibSmi.cmake
CMake Error at cmake_install.cmake:51 (FILE):
file INSTALL cannot copy file
"/Users/clausklein/Workspace/c/libsmi/libsmi-latejuly09-cmake/cmake/
FindLibSmi.cmake"
to "/opt/local/share/cmake-2.8/Modules/FindLibSmi.cmake".
+ exit
claus-kleins-macbook-pro:libsmi-latejuly09-cmake clausklein$
I hope you see that something should changed with make install.
//regards
Claus
On 08.01.2010, at 22:26, Claus Klein wrote:
> Hi David,
>
> Yes, this works fine when I change the CMAKE_INSTALL_PREFIX at
> CMakeCache.txt, sure.
>
> There is only one fault: the config files will be rebuild with the
> wrong path before install :-((
>
>
> At least, I know 2 packages, NetSnmp and LibSmi, they has to be
> compiled with fix absolute paths,
> including the device name on Windows, that is not my idea! It would
> be better to use a ConfigFile and
> the program can be install at any place. But they is a history and
> they needs there MIB's.
> (What is the current drive to find this config file when I start c:/
> usr/bin/smilint from d:/workdir?)
>
> When I add the string replace command to the cmake_install.cmake
> file, it works as a quick hack.
> This should only remove the drive string in the middle, not the
> beginning of the PREFIX path:
>
> STRING(REGEX REPLACE "/[A-Za-z]:/" "/" CMAKE_INSTALL_PREFIX "$
> {CMAKE_INSTALL_PREFIX}")
>
> But I know that this can't be the general solution.
>
>
> I did not see any DESTDIR in this file, so I think it will be set as
> parameter or in environment?
> Only if DESTDIR is given, this drive name has to be replace.
>
> Where is the DESTDIR prepended to the PREFIX?
> Is there a template for this generated cmake_install.cmake?
>
> Claus
>
> On 08.01.2010, at 17:49, David Cole wrote:
>
>> On Fri, Jan 8, 2010 at 12:37 AM, Claus Klein <claus.klein at arcormail.de
>> > wrote:
>>
>> On 08.01.2010, at 02:25, Alexander Neundorf wrote:
>>
>> On Thursday 07 January 2010, Claus Klein wrote:
>> Hi
>>
>> i want to install a cross compiled (build host is a MAC OS X) project
>> to a temporary state dir to get an archive to distribute the
>> binaries.
>> The target is win32 (mingw), compiled to be installed at c:/usr as
>> CMAKE_INSTALL_PREFIX.
>> This prefix is used while compile the binaries, so I can't change it.
>>
>> I think, that when I use DESTDIR while "make DESTDIR=/tmp/cmake
>> install", the device (C:) should be removed before to use it as part
>> of a path like this:
>>
>> STRING(REGEX REPLACE "[A-Za-z:/]" "" CMAKE_INSTALL_PREFIX "$
>> {CMAKE_INSTALL_PREFIX}")
>>
>> head cmake_install.cmake
>> # Install script for directory: /Users/clausklein/Workspace/c/libsmi/
>> trunk
>> #
>> # Set the install prefix
>> IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
>> SET(CMAKE_INSTALL_PREFIX "C:/usr")
>> ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
>> STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "$
>> {CMAKE_INSTALL_PREFIX}")
>> . . . .
>>
>> As you can see, PREFIX is appended to DESDIR without modification.
>> which is wrong in this special case.
>>
>> Yes. So you would suggest to remove the drive letter from
>> CMAKE_INSTALL_PREFIX
>> when installing with DESTDIR set ?
>>
>> Alex
>>
>> Yes
>>
>> I think it is never a valid path in this case to on Windows itself:
>>
>> i.e. C:/tmp/cmake/C:/usr/lib/pkgconfig
>>
>> I want to create a zip archive at /tmp/cmake to install it on
>> Windows under C:/
>>
>> Claus
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
>> Can you try setting CMAKE_INSTALL_PREFIX to just "/usr" instead of
>> "C:/usr" to see if you can get what you want in that manner...?
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100109/370d0ba3/attachment-0001.htm>
More information about the CMake
mailing list