MantisBT - CMake
View Issue Details
0009721CMakeCPackpublic2009-10-15 18:242013-10-07 10:03
Marcelo Canga 
Brad King 
normalminoralways
closedfixed 
CMake-2-6 
CMake 2.8.11CMake 2.8.11 
0009721: Cpack in Macos segfaults when trying to build a NSIS (crosscompiled) package
I am having trouble building a NSIS package running cpack from my mac
for windows xp

This is what I have on my cross-compile setup in my mac:

   I have a cross-compile setup working in Macos, mingw-gcc
   I have cpack - zip running on my mac for windows xp

This is what I have in windows xp:
  I have cpack - nsis for windows xp running from windows xp

This is what is not working,
   I can't run cpack nsis from my mac for windows xp.

When I try to run cpack from my mac, the process die with the
following message,

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

The traceback is in "Additional Information". I uploaded the file CPackConfig.cmake FYI.

I compiled the cmake distribution, versions 2.6.4 and current CVS version 2.9.0
with similar results,
This is my conversation with Alex about 2.6.4 run,

Thanks.
Can you please put this in the cmake bugtracker at
http://public.kitware.com/Bug/ [^] ?
Can you also check whether this also happens with cmake cvs HEAD / 2.8.0 RC3 ?

Thanks
Alex

r --config ./CPackConfig.cmake

#0 0x967afe42 in __kill ()
#1 0x967afe34 in kill$UNIX2003 ()
0000002 0x9682223a in raise ()
0000003 0x9682e679 in abort ()
0000004 0x92c29005 in __gnu_cxx::__verbose_terminate_handler ()
0000005 0x92c2710c in __gxx_personality_v0 ()
0000006 0x92c2714b in std::terminate ()
0000007 0x92c27261 in __cxa_throw ()
0000008 0x92be7a6a in std::__throw_logic_error ()
#9 0x92c0f366 in std::string::_S_construct<char const*> ()
0000010 0x92c0f4ac in std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string ()
#11 0x000204a0 in cmCPackNSISGenerator::InitializeInternal
(this=0x82a8e0) at /download/cmake-2.6.4/Source/CPack/
cmCPackNSISGenerator.cxx:383
0000012 0x0000d98e in cmCPackGenerator::Initialize (this=0x82a8e0,
name=0x824b9c "NSIS", mf=0xbfffea38) at /download/cmake-2.6.4/Source/
CPack/cmCPackGenerator.cxx:925
0000013 0x00005e7a in main (argc=3, argv=0xbffff3d8) at /download/
cmake-2.6.4/Source/CPack/cpack.cxx:385

This is the 383 line,
383 std::string tmpFile = this-

GetOption("CPACK_TOPLEVEL_DIRECTORY");

This is the 925 line,
925 int result = this->InitializeInternal();

this is the 385 line,
385 if ( parsed && !cpackGenerator->Initialize(gen, mf) )
No tags attached.
? CPackConfig.cmake (5,028) 2009-10-15 18:24
https://public.kitware.com/Bug/file/2561/CPackConfig.cmake
patch cmCPackNSISGenerator.patch (2,138) 2010-04-14 16:24
https://public.kitware.com/Bug/file/3025/cmCPackNSISGenerator.patch
? cmCPackNSISGenerator.cxx_patch (3,114) 2012-11-04 16:41
https://public.kitware.com/Bug/file/4555/cmCPackNSISGenerator.cxx_patch
Issue History
2009-10-15 18:24Marcelo CangaNew Issue
2009-10-15 18:24Marcelo CangaFile Added: CPackConfig.cmake
2009-10-16 12:59Bill HoffmanNote Added: 0018079
2009-10-16 13:26Bill HoffmanStatusnew => assigned
2009-10-16 13:26Bill HoffmanAssigned To => Bill Hoffman
2009-10-16 13:37Marcelo CangaNote Added: 0018082
2010-04-14 16:24Gerald HofmannNote Added: 0020186
2010-04-14 16:24Gerald HofmannFile Added: cmCPackNSISGenerator.patch
2012-11-04 16:41Graham MenhennittFile Added: cmCPackNSISGenerator.cxx_patch
2012-11-04 16:46Graham MenhennittNote Added: 0031418
2013-03-08 08:22Brad KingNote Added: 0032539
2013-03-08 08:22Brad KingAssigned ToBill Hoffman => Brad King
2013-03-08 08:22Brad KingStatusassigned => resolved
2013-03-08 08:22Brad KingResolutionopen => fixed
2013-03-08 08:22Brad KingFixed in Version => CMake 2.8.11
2013-03-08 08:22Brad KingTarget Version => CMake 2.8.11
2013-10-07 10:03Robert MaynardNote Added: 0033984
2013-10-07 10:03Robert MaynardStatusresolved => closed

Notes
(0018079)
Bill Hoffman   
2009-10-16 12:59   
That should be set here:
int cmCPackGenerator::PrepareNames()
...
  this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());

How do you setup nsis to work on the Mac? I have never tried that platform combination.
(0018082)
Marcelo Canga   
2009-10-16 13:37   
The easiest is to use makensis from the Macport distribution.

I also tried to compile it. This is a bigger effort since it requires additional libraries that are hard to compile.
(0020186)
Gerald Hofmann   
2010-04-14 16:24   
NSIS from Macports does not return a release version string.

makensis -VERSION
< v25-Feb-2010.cvs

Version checking in cmCPackNSISGenerator.cxx fails indefinitely because the expected regex is not matched.

I have uploaded a patch. Now only a release version string is checked for the minimum required version. If NSIS returns a cvs build version string (like it does when built by Macports), there is no version checking done at all. I think in this case a check is dispensable.

I do not fully understand why the CPACK_TOPLEVEL_DIRECTORY access fails when no matching NSIS version is found though. Maybe someone feels to fix the error handling if actually no valid NSIS version string was returned.
(0031418)
Graham Menhennitt   
2012-11-04 16:46   
I've uploaded a slight improvement to the patch file from Gerald. This version is a patch against CMake 2.8.10 and it also correctly handles the case where the version check fails and the CPACK_TOPLEVEL_DIRECTORY option is not set (mentioned by Gerald above).

Could we please get this rather trivial fix applied in time for the next release. Otherwise cross-building NSIS on Linux and/or Mac doesn't work.

Thanks,
  Graham
(0032539)
Brad King   
2013-03-08 08:22   
Patch applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=79478904 [^]
(0033984)
Robert Maynard   
2013-10-07 10:03   
Closing resolved issues that have not been updated in more than 4 months.