|
From: LRN <lr...@gm...> - 2010-02-15 12:03:49
|
On 13.02.2010 19:57, Al Dimond wrote: > On Saturday 13 February 2010 02:33:25 LRN wrote: > >> On 12.02.2010 16:00, James Crook wrote: >> >>> On 12/02/2010 05:22, shan chak wrote: >>> >>>> Hi, >>>> I was following http://wiki.wxwidgets.org/Guides_%26_Tutorials >>>> and I faced a lot of problems while setting code blocks with >>>> wxWidgets. Anybody know where to ask for solutions? >>>> and how to create a user page in audacity wiki? >>>> Is learning wxWidget mandatory to start developing audacity? >>>> >>> Are you developing on Windows or on Linux? I develop on Windows, >>> and I use MSVC 2008 as my development environment, not code >>> blocks. I don't think any of us are using code blocks (or dialog >>> blocks). I think you'll find MSVC much easier to use, but it >>> still takes a bit of setting up. Try with that. >>> >> Or you can spend a few months fixing Audacity's code and configure >> scripts to make them buildable with MinGW in MSys. That would be >> much appreciated. >> >> > Before I got a real copy of Windows (and before I was very familiar > with Audacity specifically) I got Audacity building under MinGW's Linux > cross compiler and running in Wine. MinGW in MSys should be easier > than that because it's not a cross-compile (it takes a lot of manual > work to get configure to work for cross compiles). There are a lot of > #ifdef checks that check for Cygwin that need to also check for MinGW, > and IIRC that's most of the work for Audacity's source. Getting > everything in lib-src to build would be harder, not least because > you'd have to get changes approved upstream. > > So that sounds like a decent project if you are willing to muck > through config scripts and makefiles a little bit. If you're interested > in doing it I'll see if I can find my old notes on what I did (some of > which was sort of hacktastic "just get it building"-type stuff). > > - Al > > I've tried that. It should be noted that my MinGW/MSys environment was made for GStreamer ( http://gstreamer.freedesktop.org/wiki/BuildGStreamerWithMinGWAndMsys ), so it has expat, libxml2, sndfile and some other stuff already installed. Updated my trunk, copied it into separate directory (argh, why don't we have git?), cd'ed into it in MSys. $ configure ... configure: error: "Could not find wx-config: is wxWidgets installed? is wx-config in your path?" Hey, I DO have wxWidgets built! Oh, wait, it is built with MSVC...right, now I have to build wxWidgets as well. $ cd ../wxWidgets-2.8.9 $ configure ... config.status: creating lib/wx/config/msw-ansi-release-2.8 config.status: creating lib/wx/config/inplace-msw-ansi-release-2.8 ... Hey! Where's unicode? $ configure --help | grep code ... --enable-unicode compile wxString with Unicode support ... $ configure --enable-unicode ... config.status: creating lib/wx/config/msw-unicode-release-2.8 config.status: creating lib/wx/config/inplace-msw-unicode-release-2.8 ... Ah, that's better! $ make ...after a few minutes... Ok, it worked. Now, I don't want to see wxWidgets in my environment. I really don't. $ configure --enable-unicode --prefix=/local/wxWidgets-2.8.9 && make && make install Ok, now -- back to Audacity $ cd ../audacity.msys $ PATH=$PATH:/local/wxWidgets-2.8.9/bin configure ... checking for library containing dlopen... no ./configure: line 261: return: required: numeric argument required configure: error: dlopen not found Right, dlopen...Looking in configure.in...I see, I doesn't have a section for MinGW. Let's add it. ... Now we have to recreate the configure script. $ aclocal -I ./m4 $ autoconf $ PATH=$PATH:/local/wxWidgets-2.8.9/bin configure Cool. It configured. Now, configure it with a prefix too: $ PATH=$PATH:/local/wxWidgets-2.8.9/bin configure --prefix=/local/Audacity Ok, now, the moment of truth: $ make ... gtk/FileDialogPrivate.cpp:165: error: 'wxGenericFileDialog' has not been declared ... Oh, right, lib-src/FileDialog/configure.ac needs changing too. And its configure pair must be regenerated manually. $ cd lib-src/FileDialog $ aclocal $ autoconf $ cd ../.. $ PATH=$PATH:/local/wxWidgets-2.8.9/bin configure --prefix=/local/Audacity ... win/FileDialogPrivate.cpp:96:20: error: ComDef.h: No such file or directory ... There is no such file in MinGW. Found it in v6.0/VC/Include , copied info /mingw/include $ make ... f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/ComDef.h:27:21: error: comutil.h: No such file or directory f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/ComDef.h:285:21: error: comip.h: No such file or directory f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/ComDef.h:329:22: error: comdefsp.h: No such file or directory ... ok, I can get that too. $ make ... f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/comip.h:30:17: error: new.h: No such file or directory ... And this one too. $ make ... f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/new.h:27:21: error: crtdefs.h: No such file or directory ... Come on! When will this end? $ make ... f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/crtdefs.h:59:17: error: sal.h: No such file or directory f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/crtdefs.h:150:20: error: vadefs.h: No such file or directory ... *sigh* $ make ... f:\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/comutil.h:80: error: expected type-specifier before '...' token ... Saw that one coming. OK, let's try another way. IShellFolderPtr is absent in MinGW headers, and we can't include Windows PSDK, so let's just rip out that definition. H-m-m...it is not defined. What does Google say about it? ... Ah, http://www.techreplies.com/development-resources-58/devcpp-ishellfolderptr-377244/# explains it all. Added IFolderView definition, but that didn't work -- it also requires IID_IFolderView constant which I cannot provide. So eventually I had to comment out the code that uses ifolderview. Might break Vista compatibility (according to comments), though that might be fixable (according to the same comments). I've also asked MinGW people to update their shlobj and shell32. $ make ... In file included from stream_decoder.c:56: ../../include/share/alloc.h:41:5: error: #error In file included from stream_decoder.c:56: ../../include/share/alloc.h: In function 'safe_malloc_mul_2op_': ../../include/share/alloc.h:120: error: 'SIZE_T_MAX' undeclared (first use in this function) Cool, Audacity's copy of libflac source is outdated. Copied #ifdef from fresh libflac trunk. $ make ... f:\projects\audacity.msys\lib-src\soundtouch\source\SoundTouch/TDStretch.h:238: undefined reference to `vtable for soundtouch::TDStretch3DNow' ... Yeah, that's a known SoundTouch bug. For now let's hack it away (i've sent a patch to SoundTouch maintainer some time ago, it also included this fix). $ make ... nyquist/cmt/cext.h:156: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'MyMaxMem' ... Of course, nyquist thinks that if a program is built with autotools, it's automatically built on UNIX. Right. After fixing switches.h: $ make ... nyquist/cmt/midifns.c:27:26: error: sys/resource.h: No such file or directory ... A bit more hacking in switches.h.... $ make ... nyquist/cmt/cext.h:178: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'is' ... No malloc? How so? Why HAVE_MALLOC_H is not kicking in? Why isn't it defined? Ah, we need DOS defined too (who would have thought...). And we don't have GetTimeOfDay, etc, etc. OK, fixed everything. Now: $ make ... nyquist/nyqsrc/multiread.c:19:21: error: sndfile.h: No such file or directory ... But -I../libsndfile/src is there! Why sndfile.h is not found? Oh, it does not exist indeed -- it was not built. Because configure script found my (system) sndfile and assumed that it will be used. But forgot to tell nyquist about that. $ cd ../.. $ CPPFLAGS="-I/local/include" PATH=$PATH:/local/wxWidgets-2.8.9/bin configure --prefix=/local/Audacity && make ... tstring.cpp:74: error: definition of static data member 'TagLib::String::null' of dllimport'd class ... Yeah, now taglib. Luckily, I already know how to fix it - http://gstreamer.freedesktop.org/wiki/BuildingGstPluginsGoodInMinGWMsys $ make ... ln -sf .libs/libportaudio.a portaudio-v19/lib/libportaudio.a ln: creating symbolic link `portaudio-v19/lib/libportaudio.a' to `.libs/libportaudio.a': No such file or directory ... portaudio-v19/lib/libportaudio.a does not exist indeed. portaudio-v19/lib/.libs/libportaudio.a does. OK, I don't have any explanation for that one. I've fixed Makefile and Makefile.in, but this might be incorrect. $ make Wo-o-oho-o-o! At last i'm actually building Audacity itself. ... SampleFormat.h:41: error: 'AUDACITY_DLL_API' does not name a type ... OK, let's extend Cygwin's #ifdef to MinGW $ make ... In file included from Dither.cpp:41: float_cast.h: In function 'long int lrint(double)': float_cast.h:72: error: '_asm' was not declared in this scope ... Aha, everyone's favorite WIN32-means-MSVC bug. Fix! $ make In file included from F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/defs.h:2856, from F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/list.h:32, from F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/filefn.h:15, from blockfile/SimpleBlockFile.cpp:64: F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/msw/winundef.h: In function 'HWND__* CreateDialog(HINSTANCE__*, const TCHAR*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM))': F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/msw/winundef.h:39: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE__*, cons t WCHAR*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM), LPARAM)' Google tells me that this is happening because windows.h is included before wxWidgets (wx, apparently, defines necessary constants before including windows.h). The fix is simple -- include wx first. $ make ... AudacityApp.cpp: In member function 'void AudacityApp::AssociateFileTypes()': AudacityApp.cpp:1892: error: call of overloaded 'wxString(wxRegKey&)' is ambiguous F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/string.h:692: note: candidates are: wxString::wxString(wxChar, size_t) F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/string.h:690: note: wxString::wxString(const wxString&) F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/string.h:689: note: wxString::wxString(const wxStringBase&) F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/string.h:682: note: wxString::wxString(int) ... I think it is because of tmpRegAudPath = wxString(associateFileTypes).Lower(); Ok, call QueryDefaultValue() explicitly... $ make ... In file included from F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/defs.h:2856, from F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/list.h:32, from F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/filefn.h:15, from PlatformCompatibility.cpp:23: F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/msw/winundef.h: In function 'HWND__* CreateDialog(HINSTANCE__*, const TCHAR*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM))': F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/msw/winundef.h:39: error: cannot convert 'const TCHAR*' to 'const WCHAR*' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE__*, cons t WCHAR*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM), LPARAM)' ... Same windows.h-before-wx story. Fix. $ make ... Tags.cpp: In member function 'void TagsEditor::OnSave(wxCommandEvent&)': Tags.cpp:1204: error: 'class XMLFileWriterException' has no member named 'GetMessageW' ... OK, that's really weird. Why would g++ replace "GetMessage" with "GetMessageW"? It's not a WinAPI call. Ah, because Mingw does #define GetMessage GetMessageW. Now, let's welcome a few #undef GetMessage into Audacity source... $ make ... In file included from export/../commands/../AudacityApp.h:19, from export/../commands/CommandManager.h:20, from export/../Project.h:28, from export/Export.cpp:70: F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/app.h:230:59: error: macro "Yield" passed 1 arguments, but takes just 0 F:/MSYS/1.0.11/local/wxWidgets-2.8.9/include/wx-2.8/wx/app.h:406:49: error: macro "Yield" passed 1 arguments, but takes just 0 ... Another look at MinGW headers -- and here it is: #define Yield() Ok, undef that beast too. $ make ... export/Export.cpp: In member function 'void ExportMixerPanel::OnPaint(wxPaintEvent&)': export/Export.cpp:928: error: 'class wxMemoryDC' has no member named 'DrawText' export/Export.cpp:955: error: 'class wxMemoryDC' has no member named 'DrawText' ... Seems to be something different than a #define breaking everything. But is it? DrawText is a member of wxMemoryDC's parent class wxDC. Syntax highlighting comes in handy here -- it draws "DrawText" in my editor in white, indicating that it thinks that it is not a common chunk of text. And indeed, deep in winuser.h we will find #define DrawText DrawTextW Problem is, wxWidgets is already compiled with #include <windows.h> and actually exports DrawTextW instead of DrawText. OK, that's it. Let's try it the other way: leave everything as it was, and define UNICODE unconditionally in CPPFLAGS. OK, i'm tired of logging everything I do. I'll go less verbose from now on. -DUNICODE and -D_UNICODE didn't help with DrawText (only with TCHAR/WCHAR madness). I had to hunt for all #include <windows.h> in Audacity and kill them (replace with <wx/defs.h> which includes windows.h too, but does in in a safe way). After that I got hit by mad.h header being empty. Apparently, mad.h.sed (or, to be specific, sed's "$" syntax) is designed to work with LF line endings, while Audacity promptly checkouts CRLF from svn. Note that I didn't have such problems with libmad that I've got from a tarball (tarballs are LF-only, apparently). I've fixed that by running dos2unix on these files, but it's still a problem. Another thing that hit me only now is the fact that configure.in calls sed with -i (in-place edit). MSys sed doesn't have that option. Fixed that by writing the output into temporary file and renaming it into Makefile after that. At the linking phase some things showed up. First, libid3tag has unresolved externals from libz. I've tried to fix that, but it didn't work. So i've just added -lz to Audacity's LIBS. Same with twolame. Although there I also had to hack twolame.h ( same as in http://gstreamer.freedesktop.org/wiki/BuildingGstPluginsUglyInMinGWMsys ). Generally as a rule you should ALWAYS use -no-undefined LDFLAG and -fno-common CPPFLAG on Windows when building something with GCC. And finally it was built. But when I ran audacity.exe ("make install" left it alone in the prefix/bin subdirectory) it started complaining about missing dlls. Honestly, I got tired of this and just gave it each and every dll it asked for -- the ones i've built myself earlier (not the ones from lib-src, because some of them did not produce dlls at all, even the ones that are supposed to). And finally i've got it running. It works. Wo-o-oho-o-o! Though error dialogues are absent (for example, when i tried to load ffmpeg, it has shown me no dialogs whatsoever, just asked for ffmpeg library location right away and then either hooked it up (shown its version in the preferences dialog) or didn't. I kinda like it that way, but users may not.. Diff attached. Besides the diff you also have to copy nyquist files from sys/win/msvc to sys/win (except for switches.h) |