Search code examples
makefilegnu-makemocscorep

moc: Unknown option -isystem


I am trying to install score-p. It has standard build chain. I passed the configuration part successfully. Makefile was generated automatically after configuration. Then I did make and got an error. The problem is moc complains that -isystem is an unknown option. The option is embedded in QT_CPPFLAGS. If I delete this option then moc complains that too many input files were specified. What should I do?

$(editor_plugin_moc_o): ../src/GUI-qt/plugins/SourceCodeEditor/%.moc.cpp: $(SRC_ROOT)src/GUI-qt/plugins/SourceCodeEditor/%.h
    @echo "Create moc file $@"
    @$(MKDIR_P) ../src/GUI-qt/plugins/SourceCodeEditor
    @$(MOC) $(QT_CPPFLAGS) $(CUBE_INCLUDES) $(GUI_INCLUDES) $(CUBE_DEBUG_FLAGS) $(DEFINE_TRACE_BROWSER) $< -o $@

Solution

  • The GCC -isystem option takes an argument, so it would be something like -isystem /some/dir/include. You can't just remove the -isystem option without removing its argument as well.

    However, it seems likely that if you remove both of them you'll get compile errors because header files cannot be found.

    I recommend you try turning the -isystem option into a normal -I option, that moc will understand:

    @$(MOC) $(patsubst -isystem,-I,$(QT_CPPFLAGS)) $(CUBE_INCLUDES) $(GUI_INCLUDES) $(CUBE_DEBUG_FLAGS) $(DEFINE_TRACE_BROWSER) $< -o $@