[CMake] CPack problem with nsis on linux

Eric Noulard eric.noulard at gmail.com
Tue Dec 20 02:52:20 EST 2011


2011/12/19 Hendrik Kunert <hendrikkunert at freenet.de>:
>> How are you calling CPack? This does not look like a standard CPack
>> message...
>>
> I call it from CMakeList.txt, here is my code:

I wasn't that clear, for me "calling" CPack is something like:

1) make package
2) cpack -G NSIS
...

But it's also good to know you use CPack from a CMakeLists.txt

>    if(WIN32)
>        message(windows)
>        SET(CPACK_GENERATOR NSIS)
>        SET(CPACK_MONOLITHIC_INSTALL true)

Do you really need monolithic install with NSIS,
even with COMPONENTs NSIS produces a single installer file.

>        install (TARGETS wplookup
>             RUNTIME
>             DESTINATION .purple/plugins)
>
>        install (DIRECTORY ../resources DESTINATION /.purple/wplookup)

This one seems wrong

Your DESTINATION argument begins with "/"
shouldn't : "/.purple/wplookup"
be          : ".purple/wplookup"

>        set(CPACK_PACKAGE_NAME "WplookupInstaller")
>        set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
>
>    endif(WIN32)
> endif(UNIX)
>
> SET(CPACK_PACKAGE_VERSION_MAJOR "${wplookup_VERSION_MAJOR}")
> SET(CPACK_PACKAGE_VERSION_MINOR "${wplookup_VERSION_MINOR}")
> SET(CPACK_PACKAGE_VERSION_PATCH "${wplookup_VERSION_PATCH}")
> SET(CPACK_PACKAGE_VENDOR "Hendrik Kunert <kunerd at users.sourceforge.net>")
> SET(CPACK_PACKAGE_DESCRIPTION_FILE
> "${CMAKE_CURRENT_SOURCE_DIR}/DESCRIPTION")
> SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
>
> INCLUDE(CPack)
>
>
> Maybe I forgot something, that nsis needs. NSIS also works, I crosscompiled
> Pidgin with it and the installer was build without any problems.
> http://developer.pidgin.im/wiki/BuildingWinPidgin#CrossCompiling

OK, but pigdin does not seem to be built with CMake right.

Could you try:

cvs -z3 -d:pserver:anonymous at cvs.savannah.nongnu.org:/sources/certi co certi

this software (https://savannah.nongnu.org/projects/certi/)
should cross-compile just fine from Linux to win32.

cd certi
mkdir build-win32
cmake -DCMAKE_TOOLCHAIN_FILE=../scripts/Toolchain-cross-mingw32-linux.cmake ..
then
make package should produce NSIS and ZIP.

may be you'll need to update "Toolchain-cross-mingw32-linux.cmake"
with the appropriate
path for you.

>> could you try
>>
>> cpack --debug -G NSIS
>
> For this call I get the following output:
>
> CPack: /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cpack.cxx:211 Enable
> Debug
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackGenerator.cxx:972
> Looking for CMAKE_ROOT: /usr/share/cmake
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackGenerator.cxx:767
> cmCPackNSISGenerator::SetOption(CMAKE_ROOT, /usr/share/cmake)
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackGenerator.cxx:767
> cmCPackNSISGenerator::SetOption(CPACK_GENERATOR, NSIS)
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackGenerator.cxx:955
> Warning, GetOption return NULL for: CPACK_PROJECT_CONFIG_FILE
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackGenerator.cxx:955
> Warning, GetOption return NULL for: CPACK_INCLUDE_TOPLEVEL_DIRECTORY
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackNSISGenerator.cxx:337
> cmCPackNSISGenerator::Initialize()
> /usr/src/packages/BUILD/cmake-2.8.1/Source/CPack/cmCPackGenerator.cxx:955
> Warning, GetOption return NULL for: CPACK_TOPLEVEL_DIRECTORY

This is wrong, the  CPACK_TOPLEVEL_DIRECTORY cannot be NULL...

> terminate called after throwing an instance of 'std::logic_error'
>  what():  basic_string::_S_construct NULL not valid
> Abgebrochen

Thus the error.
Did you really run the command
cpack --debug -G NSIS

in an appropriately configure build tree?
Do you have a CPackConfig.cmake file in the build tree?
If yes could you send it?

Is your project open source and/or the source available somewhere ?

>> in the build tree and see what happen.
>
> Maybe you could give me an working example for using NSIS and CPack.

Try
https://savannah.nongnu.org/projects/certi/)

>> May be trying CMake 2.8.6 or even 2.8.7rc1 would be better.
>
> I will try this now.

Would be good, I am using 2.8.7rc1.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list