View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0007917 | CMake | CMake | public | 2008-11-02 16:10 | 2011-05-02 14:46 | ||||
Reporter | Hartmut Seichter | ||||||||
Assigned To | Miguel Figueroa | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | CMake 2.8.4 | Fixed in Version | CMake 2.8.4 | ||||||
Summary | 0007917: CMake 2.6.2 generating Xcode project with wxWidgets depency does not work | ||||||||
Description | Attached a very basic (wxWidget Minimal) example which shows the following behaviour on CMake 2.6.2: - using the Xcode generator and target set to i386;ppc (aka Universal) the project can't be linked: the linker bails out with the error in 1) - using the Makefile generator and same settings (target set to Universal "i386;ppc") all works fine 1) Error when using Xcode cd /Users/seichter/Development/wxTemplate/build /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/seichter/Development/wxTemplate/build/Debug -L/usr/local/lib/Debug -L/Developer/SDKs/MacOSX10.5.sdk/usr/local/lib -F/Users/seichter/Development/wxTemplate/build/Debug -filelist /Users/seichter/Development/wxTemplate/build/wxTemplate.build/Debug/wxTemplate.build/Objects-normal/i386/wxTemplate.LinkFileList -mmacosx-version-min=10.5 -Wl,-search_paths_first -headerpad_max_install_names -L/usr/local/lib -arch ppc -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL -lwx_base_carbonu-2.8 -lwx_macu_core-2.8 -lwx_macu_adv-2.8 -lwx_macu_gl-2.8 -o /Users/seichter/Development/wxTemplate/build/wxTemplate.build/Debug/wxTemplate.build/Objects-normal/i386/wxTemplate ld warning: in /Users/seichter/Development/wxTemplate/build/wxTemplate.build/Debug/wxTemplate.build/Objects-normal/i386/Main.o, file is not of required architecture Undefined symbols for architecture ppc: "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/hM/hM6dJIrUFPyrPc0lx9wjmU+++TI/-Tmp-//ccpnLsSz.out (No such file or directory) "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/hM/hM6dJIrUFPyrPc0lx9wjmU+++TI/-Tmp-//ccpnLsSz.out (No such file or directory) cd /Users/seichter/Development/wxTemplate/build /Developer/usr/bin/g++-4.0 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/seichter/Development/wxTemplate/build/Debug -L/usr/local/lib/Debug -L/Developer/SDKs/MacOSX10.5.sdk/usr/local/lib -F/Users/seichter/Development/wxTemplate/build/Debug -filelist /Users/seichter/Development/wxTemplate/build/wxTemplate.build/Debug/wxTemplate.build/Objects-normal/ppc/wxTemplate.LinkFileList -mmacosx-version-min=10.5 -Wl,-search_paths_first -headerpad_max_install_names -L/usr/local/lib -arch ppc -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL -lwx_base_carbonu-2.8 -lwx_macu_core-2.8 -lwx_macu_adv-2.8 -lwx_macu_gl-2.8 -o /Users/seichter/Development/wxTemplate/build/wxTemplate.build/Debug/wxTemplate.build/Objects-normal/ppc/wxTemplate ld warning: in /Users/seichter/Development/wxTemplate/build/wxTemplate.build/Debug/wxTemplate.build/Objects-normal/ppc/Main.o, file is not of required architecture Undefined symbols for architecture i386: "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/hM/hM6dJIrUFPyrPc0lx9wjmU+++TI/-Tmp-//cc9BqhwW.out (No such file or directory) "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/hM/hM6dJIrUFPyrPc0lx9wjmU+++TI/-Tmp-//cc9BqhwW.out (No such file or directory) Build failed (2 errors) | ||||||||
Additional Information | - Xcode Version 3.1.1 - CMake 2.6.2 wxWidgets 2.8.9 compiled as unicode, cocoa, shared and installed in /usr/local/* AFAIR this issue didn't exist with CMake 2.6.1 | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | wxTemplate.zip [^] (4,888 bytes) 2008-11-02 16:10 wxTemplate_updated.zip [^] (4,349 bytes) 2011-01-20 12:06 | ||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0014448) Hartmut Seichter (reporter) 2008-12-29 06:17 |
FindwxWidgets copies the -arch flags from wxconfig which works for Makefiles but not for Xcode. Xcode than completely ignores the library statement. A working workaround is this: set(Apple_wxWidgets_LIBRARIES) foreach(LIB ${wxWidgets_LIBRARIES}) #message(STATUS "Checking ${LIB}") if(${LIB} MATCHES "-arch") message(STATUS "Skipping ${LIB}") else() #message(STATUS "Added ${LIB}") list(APPEND Apple_wxWidgets_LIBRARIES ${LIB}) endif() endforeach() set(wxWidgets_LIBRARIES ${Apple_wxWidgets_LIBRARIES}) |
(0014463) Miguel Figueroa (developer) 2009-01-03 00:06 |
Could you post the output of the following commands: wx-config --libs wx-config --list ---- BTW, you should use the following line, rather than the USE_LIBS: find_package(wxWidgets REQUIRED base core adv gl) Also, the following two lines are already inserted by the include(${wxWidgets_USE_FILE}): add_definitions(${wxWidgets_DEFINITIONS}) include_directories(${wxWidgets_INCLUDE_DIRS}) So, they are not needed. Make sure these things are not causing problems at your end. ---- Thanks, --Miguel |
(0014464) Hartmut Seichter (reporter) 2009-01-04 02:42 |
Thanks for pointing out the extra lines - I removed them. However, same result. Below the two commands. This is off a vanilla wxWidgets 2.8.x branch off the SVN. In CMake I change the default detected /usr/bin/wx-config to the version listed below and I also tick the Unicode version. And btw. if I select the static version it also doesn't work - same errors as above. Hartmuts-Mac:wxTemplate seichter$ /usr/local/bin/wx-config --libs -L/usr/local/lib -arch ppc -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL -lwx_macu_richtext-2.8 -lwx_macu_aui-2.8 -lwx_macu_xrc-2.8 -lwx_macu_qa-2.8 -lwx_macu_html-2.8 -lwx_macu_adv-2.8 -lwx_macu_core-2.8 -lwx_base_carbonu_xml-2.8 -lwx_base_carbonu_net-2.8 -lwx_base_carbonu-2.8 Hartmuts-Mac:wxTemplate seichter$ /usr/local/bin/wx-config --list Default config is mac-unicode-release-2.8 Default config will be used for output Alternate matches: mac-ansi-release-static-2.8 |
(0014465) Miguel Figueroa (developer) 2009-01-04 04:57 |
I don't develop on a Mac and don't have one for testing, but it seems to me that I'm picking the wx-config output as it should. That is, the linking line above corresponds to the output of the selected wxWidgets wx-config --libs. So, the problem seems to be with the Xcode Generator. It seems to me that you need to select the architecture in the Xcode GUI and maybe remove the -arch flags from the build line. So, this should be handled by the generator. If to handle it the generator needs the FindwxWidgets/UsewxWidgets module to set a few things (such as properties), then this can be handled at that level. --Miguel |
(0014468) Hartmut Seichter (reporter) 2009-01-06 05:06 |
I don't think this is an Xcode issue per se. CMake supports since 2.4 to control universal/fat binaries with CMAKE_OSX_ARCHITECTURES. As the cmake rerun will override the Xcode settings it is the prefered way. Hence, the UsewxWidgets module should honour the settings of this variable - maybe yield an error when the architecture is not available. But in general it should strip the -arch flag from the library list. I guess one could also argue this is upstream an wxWidgets problem. As an example it would make sense to have a CMAKE_OSX_ARCHITECTURE set to "i386" and wxWidgets been build as Universal i386;ppc;ppc_64;x64 - linking should still succeed. Its up to the user to use the lipo command to slim down the bundled libs for deployment. |
(0014469) Miguel Figueroa (developer) 2009-01-06 13:23 |
So, what I gather from your experience is that: 1. The value of CMAKE_OSX_ARCHITECTURES should have priority over what wx-config provides as output. 2. If the value of CMAKE_OSX_ARCHITECTURES is found in the list provided by wx-config, then we can succeed in finding wxWidgets and we simply strip the -arch commands. If it is not, then we should return wxWidgets_FOUND=FALSE. That is we set CMAKE_OSX_ARCHITECTURE to i386 and wx-config --libs returns ... -arch ppc -arch ppc_64 -arch x64 ... 3. What happens if CMAKE_OSX_ARCHITECTURES is not set? Do we keep the -arch commands in the build line? Do we extract them and use them to set the CMAKE_OSX_ARCHITECTURES variable? Do we strip them out and simply ignore them? Let's discuss this here first and then I'll poll the list for any additional feedback before I apply a patch to solve this. Thanks, --Miguel |
(0015951) Miguel Figueroa (developer) 2009-04-07 10:16 |
I need feedback on this to decide what is the correct way to proceed. I don't have the environment for debugging either. |
(0016074) Hartmut Seichter (reporter) 2009-04-20 01:20 edited on: 2009-05-14 00:02 |
Sorry haven't looked in here for a while 1 - yes as you can link with an Intel target against a universal library 2 + 3 - CMAKE_OSX_ARCHITECTURES seems always been set on Mac version of CMake and defaults to the host platform (so on an Intel MacBook its a i386, on a PowerMac its ppc) 2 yes, sounds reasonable if CMAKE_OSX_ARCHITECTURE is not found in the list it will fail to link, so you can give the user the chance in CMake to fix the problem. If both or the one are found, strip them/it and return the rest of the libs. So the only way it could fail if a i386 target tries to link against ppc only and vice versa (well, there could be potentially more as you already identified - this should become more apparent with wxWidgets / wxOSX in the trunk) |
(0024856) David Cole (manager) 2011-01-18 11:03 |
Is this still an issue with CMake 2.8.3 or the recently posted CMake 2.8.4-rc1? Please try again and let us know if this is still a problem... Thanks. |
(0024971) Hartmut Seichter (reporter) 2011-01-20 16:30 |
Sorry, checked again. Works as expected. Used 2.8.4-rc1 and checked with Xcode and makefiles. |
(0024973) David Cole (manager) 2011-01-20 16:32 |
Excellent! Resolving as fixed based on lastest comment from reporter... Please re-open if there is anything that needs to be added here. Thanks! |
(0026371) David Cole (manager) 2011-05-02 14:46 |
Closing resolved issues that have not been updated in more than 3 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-11-02 16:10 | Hartmut Seichter | New Issue | |
2008-11-02 16:10 | Hartmut Seichter | File Added: wxTemplate.zip | |
2008-12-29 06:17 | Hartmut Seichter | Note Added: 0014448 | |
2009-01-02 23:46 | Miguel Figueroa | Status | new => assigned |
2009-01-02 23:46 | Miguel Figueroa | Assigned To | => Miguel Figueroa |
2009-01-02 23:53 | Miguel Figueroa | Relationship added | duplicate of 0008272 |
2009-01-03 00:06 | Miguel Figueroa | Note Added: 0014463 | |
2009-01-04 02:42 | Hartmut Seichter | Note Added: 0014464 | |
2009-01-04 04:57 | Miguel Figueroa | Note Added: 0014465 | |
2009-01-04 04:58 | Miguel Figueroa | Assigned To | Miguel Figueroa => |
2009-01-06 05:06 | Hartmut Seichter | Note Added: 0014468 | |
2009-01-06 13:23 | Miguel Figueroa | Note Added: 0014469 | |
2009-01-06 13:23 | Miguel Figueroa | Assigned To | => Miguel Figueroa |
2009-04-07 10:16 | Miguel Figueroa | Note Added: 0015951 | |
2009-04-07 10:16 | Miguel Figueroa | Status | assigned => feedback |
2009-04-20 01:20 | Hartmut Seichter | Note Added: 0016074 | |
2009-05-14 00:02 | Hartmut Seichter | Note Edited: 0016074 | |
2011-01-18 11:03 | David Cole | Note Added: 0024856 | |
2011-01-20 11:51 | Hartmut Seichter | Note Added: 0024960 | |
2011-01-20 11:51 | Hartmut Seichter | Status | feedback => assigned |
2011-01-20 12:06 | Hartmut Seichter | File Added: wxTemplate_updated.zip | |
2011-01-20 16:27 | Hartmut Seichter | Note Deleted: 0024960 | |
2011-01-20 16:30 | Hartmut Seichter | Note Added: 0024971 | |
2011-01-20 16:32 | David Cole | Note Added: 0024973 | |
2011-01-20 16:32 | David Cole | Status | assigned => resolved |
2011-01-20 16:32 | David Cole | Fixed in Version | => CMake 2.8.4 |
2011-01-20 16:32 | David Cole | Resolution | open => fixed |
2011-01-20 16:32 | David Cole | Target Version | => CMake 2.8.4 |
2011-01-20 16:32 | David Cole | Additional Information Updated | |
2011-05-02 14:46 | David Cole | Note Added: 0026371 | |
2011-05-02 14:46 | David Cole | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |