Hi Hiratara,

On 22 May 2012 04:22, Honma Masahiro <hira.tara@gmail.com> wrote:
I'm a Japanese programer and apologize for my poor broken English :(

Much better than my non-existant Japanese :-)
 
I want to compile a sample program which uses wxHaskell
on Mac OS X Lion, but I couldn't build it.

I compiled HelloWorld.hs and I got following linker errors.


% ghc -package wx -o helloworld HelloWorld.hs
Linking helloworld ...
ld: warning: ignoring file
/System/Library/Frameworks//QuickTime.framework/QuickTime, file was
built for unsupported file format which is not the architecture being
linked (x86_64)
ld: warning: could not create compact unwind for _ffi_call_unix64:
does not use RBP or RSP based frame

This is a link issue with multimedia on Lion. It seems that Quicktime is a 32 bit library only. You can ignore this.
 
Undefined symbols for architecture x86_64:
 "_wxListItemAttr_CreateEx", referenced from:
     _sUn6_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _sUng_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_Create", referenced from:
     _wxcorezm0zi90zi0zi1_GraphicsziUIziWXCoreziWxcClassesAL_listItemAttrCreate1_info
in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrlVirtual_CreateWithCb", referenced from:
     _sW0i_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _sW0E_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrlVirtual_Create", referenced from:
     _sWbY_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _sWcg_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_SetTextColour", referenced from:
     _s15xV_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_SetFont", referenced from:
     _s15BK_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s15BO_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_SetBackgroundColour", referenced from:
     _s15Gu_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_HasTextColour", referenced from:
     _s1BbT_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2Jq5_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_HasFont", referenced from:
     _s1Bdd_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2JnT_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_HasBackgroundColour", referenced from:
     _s1Bex_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2JlH_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_GetTextColor", referenced from:
     _s1BfQ_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2JjR_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_GetFont", referenced from:
     _s1Bh9_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2Ji1_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListItemAttr_GetBackgroundColor", referenced from:
     _s1Bis_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2Jgb_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrlVirtual_SetOnGetItemTextCallback", referenced from:
     _s1BB6_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2IKc_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrlVirtual_SetOnGetItemImageCallback", referenced from:
     _s1BCC_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2IIo_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrlVirtual_SetOnGetItemColumnImageCallback", referenced from:
     _s1BE8_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2IGA_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrlVirtual_SetOnGetItemAttrCallback", referenced from:
     _s1BFE_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2IEM_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrl_RefreshItem", referenced from:
     _s1C5g_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2HVB_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrl_IsVirtual", referenced from:
     _s1C6N_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2HTp_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
 "_wxListCtrl_GetItemFont", referenced from:
     _s1Cz0_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
     _s2H2z_info in libHSwxcore-0.90.0.1.a(WxcClassesAL.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

I need to check, but this looks as though you have a version of wxc which is incompatible with the wxcore you have. This is almost probably my fault (incorrect dependencies), and nothing to do with you - the install steps you have taken look correct to me.

I will check whether I see the same problem on a clean install of wxHaskell, and upload a new version if needed. 
 
What should I do to fix these errors?

I built ghc and wxWidgets by following steps;

% brew install haskell-platform
 (version: 2011.4.0.0)
% cabal update
% cabal install llvm
 (version: 3.0.1.0)
% brew install wxmac --use-llvm --devel
 (version: 2.9.3.1)
% cabal install wx cabal-macosx
 (version: 0.90.0.1 and 0.2.2)
% ghc -package wx -o helloworld HelloWorld.hs
 (I got errors described above.)

$ ghc `wx-config --libs` -package wx -o helloworld HelloWorld.hs
 (I also tried this commnad, but I got the same result.)

These steps look correct to me.
 
Then, I also try to compile hworld.cpp by using wxWidgets.
I got warnings below, but I could run ./hworld .

% g++ hworld.cpp `wx-config --libs` `wx-config --cxxflags` -o hworld
ld: warning: ignoring file
/System/Library/Frameworks//QuickTime.framework/QuickTime, file was
built for unsupported file format which is not the architecture being
linked (x86_64)

This is the C++ version of the warning that Quicktime is a 32 bit framework, and cannot be linked to a  64 bit binary. Again, you can ignore this (it needs to be fixed in wxWidgets).

Best regards
Jeremy