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

help2man fails to generate megaglest_editor.6 #50

Closed
akien-mga opened this issue Jan 23, 2015 · 9 comments
Closed

help2man fails to generate megaglest_editor.6 #50

akien-mga opened this issue Jan 23, 2015 · 9 comments
Labels

Comments

@akien-mga
Copy link
Contributor

Building MegaGlest 3.11.0 (but this was already valid previously judging by Mageia's patch to disable manpage generation since 3.9.0), the generation of megaglest_editor.6 fails with:

Linking CXX executable megaglest_editor
[ 69%] Built target megaglest_editor
Scanning dependencies of target megaglest_editor.6
help2man: can't get `--help' info from /home/akien/Mageia/Checkout/megaglest/BUILD/megaglest-3.11.0/build/source/glest_map_editor/megaglest_editor
Try `--no-discard-stderr' if option outputs to stderr
source/glest_map_editor/CMakeFiles/megaglest_editor.6.dir/build.make:49: recipe for target 'source/glest_map_editor/CMakeFiles/megaglest_editor.6' failed

Mageia's patch also disabled the generation of the g3d_viewer man page, so I suppose it must also fail in a similar way.

@tomreyn
Copy link
Member

tomreyn commented Jan 24, 2015

We should either add --help output to these tools (preferred) or not run help2man (to automatically generate man pages) on those (only).

@tomreyn tomreyn added the bug label Jan 24, 2015
@titiger
Copy link
Member

titiger commented Feb 9, 2015

@akien-mga: 3.11.0 had a bug in the map editor which crashes it on startup on some systems, depending on the wxwidget version which was used. Maybe thats why you got no output for --help?
Or was the output not sufficient enough ? In this case, what would you expect to be the output of --help ?

@akien-mga
Copy link
Contributor Author

Well I've just tried and it's true that megaglest_editor crashes on my system with wxWidgets 2.8.12. I'll try to build against wxWidgets 3.0 and see if that fixes the issue.

For the --help output, I don't have particular wishes, I'm just reporting that the default buildsystem seems to fine it incompatible with the generation of a manpage via help2man.
With the installed binary, the --help output is:

megaglest_editor --help
Using wxWidgets version [2.8.12.0]
MegaGlest map editor v1.6.1 [Using wxWidgets 2.8.12]

glest_map_editor [GBM OR MGM FILE]

Creates or edits glest/megaglest maps.
Draw with left mouse button (select what and how large area in menu or toolbar)
Pan trough the map with right mouse button
Zoom with middle mouse button or mousewheel

@akien-mga
Copy link
Contributor Author

The bug is still valid with megaglest 3.11.1.

I confirm that megaglest_editor and megaglest_g3dviewer both have a valid --help output, but for some reason help2man doesn't like it during the build. I checked the advice given in the build error, both files redirect their --help stream to stdout, so it's not a stdout vs. stderr issue.

@akien-mga
Copy link
Contributor Author

Ok, the funny thing is that this bug happens only when I try to build a megaglest RPM. If I build without the RPM spec file but using the exact same CMake and make arguments, I get no issue with help2man...

I don't know why it would behave differently when run through a RPM spec file, maybe the shell environments differs and something funny happens?

My guess would be that something delays the generation/copy of the linked executable, but make still goes on and gives the hand to the manpage generation too early. I've confirmed that trying to run help2man on a non-existing target gives the same error as in my initial post:

$ help2man --name='blabla' --section=6 -N -o test.6 ./ThisFileDoesNotExist
help2man: can't get `--help' info from ./ThisFileDoesNotExist
Try `--no-discard-stderr' if option outputs to stderr

A workaround could be to add some delay between the linking step and the step which generates the man page. Do you know how I could achieve that?

@akien-mga
Copy link
Contributor Author

I've dug in some more, and it seems help2man fails even if I call it myself in the RPM spec file, so this whole issue is about an RPM issue. IMO you can close it as invalid.

@filux filux added invalid and removed bug labels Mar 12, 2015
@akien-mga
Copy link
Contributor Author

Actually the --no-discard-stderr advised by the error message was not a bad tip, I've patch the CMakeLists.txt files to add this argument to the two problematic targets (no idea why it works fine for glest_game), and it does the trick:

Index: megaglest-3.11.1/source/glest_map_editor/CMakeLists.txt
===================================================================
--- megaglest-3.11.1/source/glest_map_editor/CMakeLists.txt
+++ megaglest-3.11.1/source/glest_map_editor/CMakeLists.txt 2015-03-12 20:17:34.644512947 +0100
@@ -168,11 +168,11 @@
            MESSAGE("***-- Found xvfb-run: ${XVFB_EXEC} about to build manpage with it.")

            add_custom_target(${TARGET_NAME_MANPAGE} ALL
-                   COMMAND ${XVFB_EXEC} --auto-servernum --server-num=770 ${HELP2MAN} --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
+                   COMMAND ${XVFB_EXEC} --auto-servernum --server-num=770 ${HELP2MAN} --no-discard-stderr --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
                DEPENDS ${TARGET_NAME})
        ELSE()
            add_custom_target(${TARGET_NAME_MANPAGE} ALL
-                   COMMAND ${HELP2MAN} --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
+                   COMMAND ${HELP2MAN} --no-discard-stderr --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
                DEPENDS ${TARGET_NAME})
        ENDIF()
    ENDIF()
Index: megaglest-3.11.1/source/g3d_viewer/CMakeLists.txt
===================================================================
--- megaglest-3.11.1/source/g3d_viewer/CMakeLists.txt
+++ megaglest-3.11.1/source/g3d_viewer/CMakeLists.txt   2015-03-12 20:17:04.468858390 +0100
@@ -175,11 +175,11 @@
            MESSAGE("***-- Found xvfb-run: ${XVFB_EXEC} about to build manpage with it.")

            add_custom_target(${TARGET_NAME_MANPAGE} ALL
-                   COMMAND ${XVFB_EXEC} --auto-servernum --server-num=770 ${HELP2MAN} --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
+                   COMMAND ${XVFB_EXEC} --auto-servernum --server-num=770 ${HELP2MAN} --no-discard-stderr --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
                DEPENDS ${TARGET_NAME})
        ELSE()
            add_custom_target(${TARGET_NAME_MANPAGE} ALL
-                   COMMAND ${HELP2MAN} --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
+                   COMMAND ${HELP2MAN} --no-discard-stderr --name='${MG_MANPAGE_DESCRIPTION}' --section=6 -N -o ${HELP2MAN_OUT_PATH}${TARGET_NAME_MANPAGE} ${HELP2MAN_OUT_PATH}${TARGET_NAME}
                DEPENDS ${TARGET_NAME})
        ENDIF()
    ENDIF()

The fact that one target is working and the other two don't makes me wonder if there would be a difference in the way those --help methods are coded (maybe for the editor and g3dviewer it's handled somehow by wxgtk?) that could explain why some seem to send their output to stderr when in a RPM build environment...

@filux filux added the bug label Mar 12, 2015
@tomreyn tomreyn removed the invalid label Aug 28, 2015
@tomreyn
Copy link
Member

tomreyn commented Aug 28, 2015

So this seems to be a bug in some software we depend on. We might still try to work around it.

softcoder added a commit that referenced this issue Oct 27, 2015
@softcoder
Copy link
Member

This patch is applied

softcoder added a commit that referenced this issue Oct 28, 2015
@filux filux closed this as completed Oct 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants