5

I'm trying to debug a problem I got during a make package:

CMake Error at /usr/local/Cellar/cmake/3.4.3/share/cmake/Modules/BundleUtilities.cmake:861 (message):
    error: fixup_bundle: not a valid bundle

I've seen that there are some message(STATUS ....) inside but they do not get printed.

as example, at the beginning the funcion fixup_bundle contained in that file (/usr/local/Cellar/cmake/3.4.3/share/cmake/Modules/BundleUtilities.cmake) there are these lines:

message(STATUS "fixup_bundle")
message(STATUS "  app='${app}'")
message(STATUS "  libs='${libs}'")
message(STATUS "  dirs='${dirs}'")

but when I run cmake I don't get those printed even with make package VERBOSE=1.

but if I remove the STATUS those get printed so I was wondering how to "actvate" the STATUS messages

bibi
  • 3,671
  • 5
  • 34
  • 50
  • The difference could be that `STATUS` messages go to `stdout`. Do you call `make package` e.g. inside a shell script? Or can you add some details about your host environment? – Florian Feb 18 '16 at 09:19
  • I'm calling it from shell, I have no redirection. I'm on osx 10.9 – bibi Feb 18 '16 at 09:54
  • Sorry for the late reply. I'm trying to reproduce this and it would help if you could give a minimal CMake example script including your CPack configuration. It would help to see what make rule CMake does generate for the `package` target. – Florian Mar 10 '16 at 21:25
  • oh thanks! I've updated the question – bibi Mar 10 '16 at 22:07

1 Answers1

4

I could reproduce your problem and you won't get the status messages if CPack's source code is not changed. The behavior you're experiencing is how CPack is currently implemented.

If you look into your CMake generated package makefile rule you will find something like:

# Special rule for the target package
package: preinstall
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
    [your path here]/cpack.exe --config ./CPackConfig.cmake
.PHONY : package

So you're calling cpack.exe when doing make package. To reproduce your problem I just appended the following line to CPackConfig.cmake:

message(STATUS "+++ Test +++")

As you have already tested, only if I remove the STATUS keyword I see the message. So I've tested to directly call from the command line:

> cpack.exe --verbose --debug --config ./CPackConfig.cmake

But still didn't get the message. When debugging cpack.exe I could see that STATUS messages do finally call cmake::UpdateProgress() and there is simply no ProgressCallback set in CPack.

I think a fix is very simple, but I'm not sure if you're willing to change CMake's source code or e.g. if you want to raise a ticket in CMake's bug tracker.

Edit: I've successfully tested the following code extensions for cpack.cxx with STATUS messages:

void cpackProgress(const char *msg, float prog, void* ptr)
{
    (void)prog;
    cmCPackLog* log = static_cast<cmCPackLog*>(ptr);
    cmCPack_Log(log, cmCPackLog::LOG_OUTPUT, msg << std::endl);
}

and then

int main (int argc, char const* const* argv)
{
    [...]
    cmake cminst;
    cminst.SetProgressCallback(cpackProgress, &log);
    [...]
}
Florian
  • 39,996
  • 9
  • 133
  • 149
  • thanks, I've added the cpack tag to the question, maybe there's a hidden/magic flag in cpack... and a cpack guru will eventually answer. I wait before flagging as answered the question – bibi Mar 16 '16 at 09:25
  • @bibi You're welcome. Fair enough. I've added a code example for the necessary `cpack.cxx` extensions. In the currently existing CPack code only [`cmCPackGenerator::InstallProjectViaInstallCMakeProjects()`](https://github.com/Kitware/CMake/blob/master/Source/CPack/cmCPackGenerator.cxx#L722) is calling `SetProgressCallback()`. – Florian Mar 16 '16 at 20:19