Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make doc fails with segmentation fault in doxygen 1.9.0 on macOS #520

Closed
scpeters opened this issue Dec 30, 2020 · 13 comments
Closed

make doc fails with segmentation fault in doxygen 1.9.0 on macOS #520

scpeters opened this issue Dec 30, 2020 · 13 comments
Labels
macOS macOS support

Comments

@scpeters
Copy link
Member

Since doxygen 1.9.0 was released into homebrew-core in Homebrew/homebrew-core#67817, make doc has been failing for ign-gazebo with a segmentation fault in doxygen itself:

make[2]: *** [CMakeFiles/doc] Segmentation fault: 11

Running make doc VERBOSE=1 shows that the following command is used: doxygen build/api_tagfile.dox. By editing build/api_tagfile.dox so that QUIET = NO, you can get verbose output from make doc. I see the following lines just before the failure:

Preprocessing <prefix>/ign-gazebo/include/ignition/gazebo/Util.hh...
Parsing file <prefix>/ign-gazebo/include/ignition/gazebo/Util.hh...
Building macro definition list...
Building group list...
Building directory list...
Building namespace list...
Segmentation fault: 11

I've built doxygen from source in debug mode and have isolated the segmentation fault to a specific line in doxygen.cpp. I will submit a bug report to doxygen. In the meantime, we may want to disable generation of docs in this repository.

@scpeters
Copy link
Member Author

I uncommented a printf from doxygen and get the following output:

diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 3472f8f1..d4546ff3 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -1558,7 +1558,7 @@ static void buildNamespaceList(const Entry *root)
           tagName     = tagInfo->tagName;
           tagFileName = tagInfo->fileName;
         }
-        //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data());
+        printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data());
         // add namespace to the list
         nd = toNamespaceDefMutable(
             Doxygen::namespaceLinkedMap->add(fullName,
Building macro definition list...
Building group list...
Building directory list...
Building namespace list...
++ new namespace std lang=Unknown tagName=/usr/local/share/ignition/ignition-cmake2/doxygen/cppreference.tag.xml
++ new namespace std::regex_constants lang=Unknown tagName=/usr/local/share/ignition/ignition-cmake2/doxygen/cppreference.tag.xml
++ new namespace std::chrono lang=Unknown tagName=/usr/local/share/ignition/ignition-cmake2/doxygen/cppreference.tag.xml
++ new namespace std::rel_ops lang=Unknown tagName=/usr/local/share/ignition/ignition-cmake2/doxygen/cppreference.tag.xml
++ new namespace std::this_thread lang=Unknown tagName=/usr/local/share/ignition/ignition-cmake2/doxygen/cppreference.tag.xml
++ new namespace std::experimental lang=Unknown tagName=/usr/local/share/ignition/ignition-cmake2/doxygen/cppreference.tag.xml
++ new namespace ignition lang=Unknown tagName=/usr/local/Cellar/ignition-math6/6.8.0~pre1/share/ignition/ignition-math6/ignition-math6.tag.xml
++ new namespace ignition::math lang=Unknown tagName=/usr/local/Cellar/ignition-math6/6.8.0~pre1/share/ignition/ignition-math6/ignition-math6.tag.xml
++ new namespace ignition::math::eigen3 lang=Unknown tagName=/usr/local/Cellar/ignition-math6/6.8.0~pre1/share/ignition/ignition-math6/ignition-math6.tag.xml
++ new namespace ignition::math::IGNITION_MATH_VERSION_NAMESPACE lang=Unknown tagName=/usr/local/Cellar/ignition-math6/6.8.0~pre1/share/ignition/ignition-math6/ignition-math6.tag.xml
++ new namespace ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph lang=Unknown tagName=/usr/local/Cellar/ignition-math6/6.8.0~pre1/share/ignition/ignition-math6/ignition-math6.tag.xml
++ new namespace ignition::msgs lang=Unknown tagName=/usr/local/Cellar/ignition-msgs4/4.9.0_5/share/ignition/ignition-msgs4/ignition-msgs4.tag.xml
++ new namespace ignition::msgs::IGNITION_MSGS_VERSION_NAMESPACE lang=Unknown tagName=/usr/local/Cellar/ignition-msgs4/4.9.0_5/share/ignition/ignition-msgs4/ignition-msgs4.tag.xml
++ new namespace ignition::physics lang=Unknown tagName=/usr/local/Cellar/ignition-physics1/1.10.0_2/share/ignition/ignition-physics1/ignition-physics1.tag.xml
++ new namespace ignition::physics::dartsim lang=Unknown tagName=/usr/local/Cellar/ignition-physics1/1.10.0_2/share/ignition/ignition-physics1/ignition-physics1.tag.xml
++ new namespace ignition::physics::mesh lang=Unknown tagName=/usr/local/Cellar/ignition-physics1/1.10.0_2/share/ignition/ignition-physics1/ignition-physics1.tag.xml
++ new namespace ignition::physics::sdf lang=Unknown tagName=/usr/local/Cellar/ignition-physics1/1.10.0_2/share/ignition/ignition-physics1/ignition-physics1.tag.xml
++ new namespace ignition::sensors lang=Unknown tagName=/usr/local/Cellar/ignition-sensors2/2.9.1/share/ignition/ignition-sensors2/ignition-sensors2.tag.xml
++ new namespace ignition::sensors::IGNITION_SENSORS_VERSION_NAMESPACE lang=Unknown tagName=/usr/local/Cellar/ignition-sensors2/2.9.1/share/ignition/ignition-sensors2/ignition-sensors2.tag.xml
++ new namespace ignition::gazebo lang=C++ tagName=(null)
++ new namespace ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE lang=C++ tagName=(null)
++ new namespace ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::components lang=C++ tagName=(null)
++ new namespace ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::serializers lang=C++ tagName=(null)
++ new namespace ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::traits lang=C++ tagName=(null)
++ new namespace ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::events lang=C++ tagName=(null)
++ new namespace ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::gui lang=C++ tagName=(null)
++ new namespace ignition::gazebo::gui lang=C++ tagName=(null)
Process 23471 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100389654 doxygen`buildNamespaceList(root=0x00000001032ce218) at doxygen.cpp:1569:13
   1566	                createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine,
   1567	                             root->startColumn,fullName,tagName,tagFileName,
   1568	                             root->type,root->spec&Entry::Published))));
-> 1569	        nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
   1570	        nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
   1571	        nd->addSectionsToDefinition(root->anchors);
   1572	        nd->setHidden(root->hidden);
Target 0: (doxygen) stopped.
(lldb) print nd
(NamespaceDefMutable *) $0 = 0x0000000000000000

it seems the output of createNamespaceDef on line 1563 is a nullptr

@scpeters
Copy link
Member Author

it seems similar to doxygen/doxygen#8192 but not quite the same

@scpeters
Copy link
Member Author

I believe the following patch to ign-gazebo fixes it:

diff --git a/include/ignition/gazebo/gui/GuiEvents.hh b/include/ignition/gazebo/gui/GuiEvents.hh
index 524805dd..90efc184 100644
--- a/include/ignition/gazebo/gui/GuiEvents.hh
+++ b/include/ignition/gazebo/gui/GuiEvents.hh
@@ -29,9 +29,9 @@ namespace ignition
 {
 namespace gazebo
 {
-namespace gui {
 // Inline bracket to help doxygen filtering.
 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
+namespace gui {
 /// \brief Namespace for all events. Refer to the EventManager class for
 /// more information about events.
 namespace events

that may break ABI, but it could be helpful in creating a small reproduction of the error in order to report a proper issue to doxygen

scpeters added a commit to scpeters/ign-gazebo that referenced this issue Dec 30, 2020
@scpeters
Copy link
Member Author

I believe the following patch to ign-gazebo fixes it:

diff --git a/include/ignition/gazebo/gui/GuiEvents.hh b/include/ignition/gazebo/gui/GuiEvents.hh
index 524805dd..90efc184 100644
--- a/include/ignition/gazebo/gui/GuiEvents.hh
+++ b/include/ignition/gazebo/gui/GuiEvents.hh
@@ -29,9 +29,9 @@ namespace ignition
 {
 namespace gazebo
 {
-namespace gui {
 // Inline bracket to help doxygen filtering.
 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
+namespace gui {
 /// \brief Namespace for all events. Refer to the EventManager class for
 /// more information about events.
 namespace events

that may break ABI, but it could be helpful in creating a small reproduction of the error in order to report a proper issue to doxygen

that seems to fix it when I run doxygen in debug mode but not with the homebrew binaries (see failed CI in #521)

@chapulina chapulina added the macOS macOS support label Dec 30, 2020
@chapulina
Copy link
Contributor

Thanks for debugging, @scpeters

we may want to disable generation of docs in this repository.

Another thing we can consider is not generating docs in macOS. Our official docs are deployed using Ubuntu, and I'm not sure if many users are making use of documentation generation on macOS. I'd be ok only supporting doc generation (and other tooling like static codecheck and coverage) only on Linux to reduce our maintenance surface.

That said, I think it's good that we're catching this early and can solve it before Doxygen 1.9.0 shows up on Ubuntu.

@scpeters
Copy link
Member Author

Another thing we can consider is not generating docs in macOS

yes, that's the right step to take

That said, I think it's good that we're catching this early and can solve it before Doxygen 1.9.0 shows up on Ubuntu.

I just tried building doxygen from source on 18.04 with gcc and I can't reproduce it, so I think it is specific to macOS or clang.

ok, now I'm going to enjoy my vacation

@chapulina
Copy link
Contributor

not generating docs in macOS

Ok, an attempt here: osrf/homebrew-simulation#1258

@scpeters
Copy link
Member Author

not generating docs in macOS

Ok, an attempt here: osrf/homebrew-simulation#1258

that would disable doxygen for all our packages. I think only ign-gazebo is suffering from this issue, so I would just put an if(NOT APPLE) block around ign_create_docs in CMakeLists.txt for ign-gazebo

@chapulina
Copy link
Contributor

that would disable doxygen for all our packages.

The way I understood it, that would still keep doxygen for those specific packages, and downstream packages that want to generate docs would need to declare the build dependency themselves. That sounds like the most correct thing to do, I don't think downstream packages should be relying on a build dependency from their dependencies, right?

I can go ahead and add doxygen as an optional build dependency for all packages downstream of those, except for ign-gazebo, if you agree.

@doxygen
Copy link

doxygen commented Dec 30, 2020

Can you check if the crash is solved when applying this fix to doxygen? doxygen/doxygen@4a070f8

@chapulina
Copy link
Contributor

Here's the suppression to make docs for macOS: #523

@scpeters
Copy link
Member Author

scpeters commented Jan 1, 2021

Can you check if the crash is solved when applying this fix to doxygen? doxygen/doxygen@4a070f8

Yes! Thank you so much; that fixes the segmentation fault when run against our api_tagfile.dox, but it looks make doc has 2 invocations of doxygen and the 2nd one has a segmentation fault as well. I am investigating that now to get a backtrace...

@scpeters
Copy link
Member Author

scpeters commented Jan 1, 2021

Can you check if the crash is solved when applying this fix to doxygen? doxygen/doxygen@4a070f8

Yes! Thank you so much; that fixes the segmentation fault when run against our api_tagfile.dox, but it looks make doc has 2 invocations of doxygen and the 2nd one has a segmentation fault as well. I am investigating that now to get a backtrace...

never mind; it's all fixed by doxygen/doxygen@4a070f8; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS macOS support
Projects
None yet
Development

No branches or pull requests

3 participants