View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0003453 | CMake | CMake | public | 2006-06-28 10:41 | 2006-10-19 10:08 | ||||
Reporter | Ludovic Rousseau | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0003453: FindwxWindows.cmake: do not modify the output of wx-config --cxxflags | ||||||||
Description | The file /usr/share/CMake/Modules/FindwxWindows.cmake contains: SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`") cmake should not change the output of wx-config. With this code I cannot compile my source code and have the errors: /usr/bin/c++ `/usr/local/bin/wx-config --cxxflags|sed -e s/-I/-isystem/g` -o CMakeFiles/wxToolbox.dir/certificates.o -c /Users/lroussea/Documents/wxToolBox/certificates.cpp /usr/local/include/wx-2.6/wx/defs.h:600: error: template with C linkage /usr/local/include/wx-2.6/wx/string.h:937: error: declaration of C function 'wxString operator+(const wxString&, wxChar)' conflicts with /usr/local/include/wx-2.6/wx/string.h:935: error: previous declaration 'wxString operator+(const wxString&, const wxString&)' here /usr/local/include/wx-2.6/wx/string.h:939: error: declaration of C function 'wxString operator+(wxChar, const wxString&)' conflicts with /usr/local/include/wx-2.6/wx/string.h:937: error: previous declaration 'wxString operator+(const wxString&, wxChar)' here [... and lot of similar errors] The compilation works fine with the original -I instead of -isystem. Why should I use -isystem instead of -I? It it the job of wx-config to give me the correct arguments. I propose the attached patch | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | patch.txt [^] (610 bytes) 1969-12-31 19:00 [Show Content]
CMake.patch [^] (5,778 bytes) 1969-12-31 19:00 [Show Content] | ||||||||
Relationships | |
Relationships |
Notes | |
(0004399) Jan Woetzel (reporter) 2006-07-04 10:21 |
FYI: This bug is related to 0003462. I will add an option as aworkaround to FindwxWindows and FindwxWIdgets for compilers taht don't support -isystem and must use -I. Jan. |
(0004401) Jan Woetzel (reporter) 2006-07-04 13:15 |
Instead of an option I added an IF on CMAKE_CXX_COMPILER matching g++ (which supports isystem). Out of curiosity: what compiler is your /usr/bin/g++? Nobody else complained about -isystem for two years. FYI: The -isystem instead of -I is very useful when you compile your own code with -pedantic warnings and don't want to see teh warnings noise inside wx. Jan. |
(0004404) Ludovic Rousseau (reporter) 2006-07-05 09:03 |
/usr/bin/c++ --version powerpc-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5341) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I am using the standard compiler on a Mac OS X 10.4.7 with X Code 2.3 (I guess gcc comes with X Code) The error reported bug g++ is in defs.h line 600 /* sometimes the value of a variable is *really* not used, to suppress the */ /* resulting warning you may pass it to this function */ #ifdef __cplusplus # ifdef __BORLANDC__ # define wxUnusedVar(identifier) identifier # else template <class T> inline void wxUnusedVar(const T& WXUNUSED(t)) { } # endif #endif Line 600 is the "inline" line. I don't know C++ enough to know what g++ does not like here. I tried to find the minimal source file to trigger the bug. With a file containing just the line: #include "wx/wxprec.h" I have just one erro line: /usr/local/include/wx-2.6/wx/defs.h:600: error: template with C linkage With a file containing just the line #include "wx/wx.h" I have: /usr/local/include/wx-2.6/wx/defs.h:600: error: template with C linkage /usr/local/include/wx-2.6/wx/string.h:937: error: declaration of C function 'wxString operator+(const wxString&, wxChar)' conflicts with /usr/local/include/wx-2.6/wx/string.h:935: error: previous declaration 'wxString operator+(const wxString&, const wxString&)' here /usr/local/include/wx-2.6/wx/string.h:939: error: declaration of C function 'wxString operator+(wxChar, const wxString&)' conflicts with /usr/local/include/wx-2.6/wx/string.h:937: error: previous declaration 'wxString operator+(const wxString&, wxChar)' here /usr/local/include/wx-2.6/wx/string.h:941: error: declaration of C function 'wxString operator+(const wxString&, const wxChar*)' conflicts with /usr/local/include/wx-2.6/wx/string.h:939: error: previous declaration 'wxString operator+(wxChar, const wxString&)' here /usr/local/include/wx-2.6/wx/string.h:943: error: declaration of C function 'wxString operator+(const wxChar*, const wxString&)' conflicts with /usr/local/include/wx-2.6/wx/string.h:941: error: previous declaration 'wxString operator+(const wxString&, const wxChar*)' here /usr/local/include/wx-2.6/wx/string.h:1298: error: declaration of C function 'wxString operator+(const wxString&, const wxString&)' conflicts with /usr/local/include/wx-2.6/wx/string.h:943: error: previous declaration 'wxString operator+(const wxChar*, const wxString&)' here [many other similar error lines] |
(0004457) Jan Woetzel (reporter) 2006-07-16 11:10 |
Thanks for the information. Can you confirm that the bug is solved with IF (CMAKE_CXX_COMPILER MATCHES g\\+\\+) STRING(REGEX REPLACE "-I" "-isystem" wxWidgets_CXX_FLAGS ${wxWidgets_CXX_FLAGS}) ENDIF (CMAKE_CXX_COMPILER MATCHES g\\+\\+) in FindwxWindows.cmake/FindwxWidgets.cmake ? This solution is contained in the submitted patch for bug 0003443. I think this bug can be closed when bug 3443 patch is applied. Jan. |
(0004491) Brad King (manager) 2006-07-18 17:13 |
I'm trying to build CMake with the patch from bug 0003443 and I get the C linkage error: /usr/bin/g++ -isystem/Users/kitware/Software/wxWidgets-2.6.3/lib/wx/include/mac-ansi-release-2.6 -isystem/Users/kitware/Software/wxWidgets-2.6.3/include -isystem/Users/kitware/Software/wxWidgets-2.6.3/contrib/include -I/Users/kitware/My\ Programs/CMake-gcc/Source -I/Users/kitware/My\ Programs/CMake/Source -I/Users/kitware/My\ Programs/CMake-gcc/Utilities -I/Users/kitware/My\ Programs/CMake-gcc/Utilities/cmexpat -I/Users/kitware/My\ Programs/CMake-gcc/Utilities/cmtar -I/Users/kitware/My\ Programs/CMake/Source/CTest -I/Users/kitware/My\ Programs/CMake/Utilities/cmxmlrpc -I/Users/kitware/My\ Programs/CMake-gcc/Utilities/cmxmlrpc -I/Users/kitware/My\ Programs/CMake/Utilities -I/Users/kitware/My\ Programs/CMake/Source/CursesDialog/form -I/Users/kitware/Software/wxWidgets-2.6.3/lib/wx/include/mac-ansi-release-2.6 -I/Users/kitware/Software/wxWidgets-2.6.3/include -I/Users/kitware/Software/wxWidgets-2.6.3/contrib/include -I/Users/kitware/My\ Programs/CMake/Source/WXDialog -DCMAKE_BUILD_WITH_CMAKE -D__WXMAC__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA -o Source/WXDialog/CMakeFiles/WXDialog.dir/CMakeSetupFrame.o -c /Users/kitware/My\ Programs/CMake/Source/WXDialog/CMakeSetupFrame.cpp produces /Users/kitware/Software/wxWidgets-2.6.3/include/wx/defs.h:600: error: template with C linkage ... Replacing -isystem with just -I fixes the problem. The above command line was generated by a CMake bootstrap executable using the FindwxWidgets.cmake from the patch. |
(0004559) Ludovic Rousseau (reporter) 2006-07-31 05:22 |
I used the patch IF (CMAKE_CXX_COMPILER MATCHES "g\+\+") STRING(REGEX REPLACE "-I" "-isystem" wxWidgets_CXX_FLAGS ${wxWidgets_CXX+++_FLAGS}) ENDIF (CMAKE_CXX_COMPILER MATCHES "g\+\+") as suggested but I have the error: /usr/bin/cmake . CMake Error: Invalid escape sequence \+ Syntax error in cmake code at /usr/share/CMake/Modules/FindwxWindows.cmake:618: syntax error, unexpected cal_ERROR, expecting $end (3), when parsing string "g\+\+" -- Configuring done I also noted that the FindwxWindows.cmake file uses CMAKE_WXWINDOWS_CXX_FLAGS and not wxWidgets_CXX_FLAGS as proposed in the patch. The C++ compiler used on MacOS is c++ so I modified the patch to use: IF (CMAKE_CXX_COMPILER MATCHES "c\\+\\+") STRING(REGEX REPLACE "-I" "-isystem" CMAKE_WXWINDOWS_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS}) ENDIF (CMAKE_CXX_COMPILER MATCHES "c\\+\\+") and I can reproduce the bug: /usr/local/include/wx-2.6/wx/defs.h:600: error: template with C linkage Of course if I use "g\\+\\+" instead of "c\\+\\+" in the patch I do not have the problem since the include arguments is then not modified. I then generated a XCode project an tried to recompile it but get the error: Building target “libCertificates.so” of project “Toolbox” with configuration “Debug” — (42 errors) cd "/Users/lroussea/Documents/ToolBox WX/wxToolBox" /usr/bin/gcc-4.0 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -g -O0 -DCMAKE_INTDIR=\"Debug\" -fmessage-length=0 -mtune=G4 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -O0 -F/Users/lroussea/Documents/ToolBox\ WX/wxToolBox/Debug -I/Users/lroussea/Documents/ToolBox\ WX/wxToolBox/Debug/include -I/Users/lroussea/Documents/ToolBox\ WX/wxToolBox/Common -I/Users/lroussea/Documents/ToolBox\ WX/wxToolBox/Toolbox.build/Debug/libCertificates.so.build/DerivedSources -isystem/usr/local/lib/wx/include/mac-ansi-release-2.6 -isystem/usr/local/include/wx-2.6 -D__WXMAC__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA -fPIC -DCertificates_EXPORTS -c /Users/lroussea/Documents/ToolBox\ WX/wxToolBox/Certificates/certificate.cpp -o /Users/lroussea/Documents/gemsafe/ToolBox\ WX/wxToolBox/Toolbox.build/Debug/libCertificates.so.build/Objects-normal/ppc/certificate.o /usr/local/include/wx-2.6/wx/defs.h:600: error: template with C linkage /usr/local/include/wx-2.6/wx/string.h:937: error: declaration of C function 'wxString operator+(const wxString&, wxChar)' conflicts with /usr/local/include/wx-2.6/wx/string.h:935: error: previous declaration 'wxString operator+(const wxString&, const wxString&)' here Conclusion: Without the proposed patch - OK for Unix Makefiles target - OK for XCode target with the proposed patch - OK for Unix Makefiles target - NOT OK for XCode target I also noted that c++ is used for the Makefile and g++ is used for XCode. Maybe it can help? /usr/bin/cmake -G Xcode . -- Check for working C compiler: gcc -- Check for working C compiler: gcc -- works -- Check size of void* -- Check size of void* - done -- Check for working CXX compiler: g++ -- Check for working CXX compiler: g++ -- works -- Configuring done -- Generating done -- Build files have been written to: /Users/lroussea/Documents/ToolBox WX/wxToolBox /usr/bin/cmake -G "Unix Makefiles" . -- Check for working C compiler: gcc -- Check for working C compiler: gcc -- works -- Check size of void* -- Check size of void* - done -- Check for working CXX compiler: c++ -- Check for working CXX compiler: c++ -- works -- Configuring done -- Generating done -- Build files have been written to: /Users/lroussea/Documents/ToolBox WX/wxToolBox |
(0004560) Ludovic Rousseau (reporter) 2006-07-31 05:24 |
Argh! I just noted that the backslah is modified by the bug tracker tool. My patch contains "g\\+\\+" and should be read as quote g backslash backslash plus backslash backslash plus quote (the backslash are double) |
(0005212) Brad King (manager) 2006-10-04 19:24 |
This bug can be fixed when bug 0003462 is fixed. |
(0005215) Brad King (manager) 2006-10-04 19:35 |
Note that in order to get proper dependency scanning the include directories should still be added with INCLUDE_DIRECTORIES. Until bug 0003462 is implemented you can then ALSO add the -isystem option for GCC compilers as a FLAG instead of an include directory. |
(0005235) Brad King (manager) 2006-10-05 09:37 |
Bug 0003462 is now implemented. This bug can probably be fixed now. You should do something like this: - set wxWidgets_INCLUDE_DIRS normally in FindwxWidgets - In UsewxWidgets write IF(wxWidgets_INCLUDE_DIRS) INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS}) ENDIF(wxWidgets_INCLUDE_DIRS) |
(0005448) Jan Woetzel (reporter) 2006-10-17 16:14 |
The patch makes Find/Use wxWidgets compatible with -new -isystem via INCLUDE_DIRECTORIES( SYSTEM ..), see bug#2462 -wx 2.7.x and future 2.8.x (new names) -plus minor cleanups, e.g. use PATHS_SUFFIXES Tested with wxWidgets-2.7.0-1. Best, Jan. |
(0005449) Jan Woetzel (reporter) 2006-10-17 16:21 |
ps: -and dropped "-isystem" workaround/hack in favor of INCLUDE_DIRECTORES(SYSTEM ..) |
(0005471) Brad King (manager) 2006-10-19 10:08 |
Thanks, Jan. Applied: /cvsroot/CMake/CMake/Modules/FindwxWidgets.cmake,v <-- FindwxWidgets.cmake new revision: 1.5; previous revision: 1.4 /cvsroot/CMake/CMake/Modules/UsewxWidgets.cmake,v <-- UsewxWidgets.cmake new revision: 1.5; previous revision: 1.4 |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |