Page 1 of 2

Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Wed Mar 13, 2013 1:58 pm
by agrbalan
I'm here because I believe I have tried EVERYTHING in order to build audacity 2.0.3 with wxWidgets 2.8.12 on Windows 7

Audacity project does compile well but I can't get the final exe file.

I'm using VS C++ 2008 express, SDK 7.1 for Windows 7.

I compiled every configuration of wxWidgets 2.8.12 (Debug, Release, Dll Debug, Dll Release, Dll Unicode Debud, Dll Unicode release). I had no problem here and I even compiled a few samples. I set the WXWIN variable correctly.

Then, when I try to complie audacity I get many errors like this in the BuildLog.htm:

>>>> echo Project : error PRJ0019: A tool returned an error code from "Copying mand5"

Also, I get other few (11) compilation errors:


C:wxWidgets-2.8.12includewx/app.h(230) : warning C4002: too many actual parameters for macro 'Yield'
C:wxWidgets-2.8.12includewx/app.h(230) : error C2059: syntax error : '{'
C:wxWidgets-2.8.12includewx/app.h(230) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
C:wxWidgets-2.8.12includewx/app.h(406) : warning C4002: too many actual parameters for macro 'Yield'
C:wxWidgets-2.8.12includewx/app.h(406) : error C2059: syntax error : '='
C:wxWidgets-2.8.12includewx/app.h(406) : error C2238: unexpected token(s) preceding ';'
C:wxWidgets-2.8.12includewx/msw/app.h(38) : warning C4002: too many actual parameters for macro 'Yield'
C:wxWidgets-2.8.12includewx/msw/app.h(38) : error C2208: 'bool' : no members defined using this type
c:audacity-srcsrcwidgets../Envelope.h(106) : error C2589: '(' : illegal token on right side of '::'
c:audacity-srcsrcwidgets../Envelope.h(106) : error C2059: syntax error : '::'
c:audacity-srcsrcwidgets../Envelope.h(106) : error C2589: '(' : illegal token on right side of '::'
c:audacity-srcsrcwidgets../Envelope.h(106) : error C2589: '(' : illegal token on right side of '::'
......srcexportExportCL.cpp(490) : error C2039: 'Yield' : is not a member of 'wxApp'
C:wxWidgets-2.8.12includewx/msw/app.h(26) : see declaration of 'wxApp'


Please, can somebody help me?

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Wed Mar 13, 2013 5:57 pm
by agrbalan
Well, finally I managed to solve the problems.

I didn't think I must change the source code, but it was necessary for 3 files. Here are the modifications:

1 - Add a #define NOMINMAX at the very beginning of Audacity.h
2 - Add a #define PLATFORM_MAX_PATH 260 in the SimpleBlockFile.cpp
3 - Add a #include "wx/msw/winundef.h" in app.h


Now I wonder whether the developers or everyone else get these same errors or not... When I check out a new version, will I have to do it all again? :?:

Thanks

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Wed Mar 13, 2013 7:27 pm
by Gale Andrews
You should not be getting those errors - I compile every day with the same environment and Windows SDK as you.

In Visual Studio at Project >Audacity_Properties >Configuration_Properties >C/C++ > Precompiled_Headers do you see Precompiled Header File .$(ConfigurationName)/audacity.pch ?

Have you changed any settings in Visual Studio?

Were you following http://wiki.audacityteam.org/wiki/Developing_On_Windows ?


Gale

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Wed Mar 13, 2013 7:49 pm
by agrbalan
Thank you, Gale

Yes, I have ".$(ConfigurationName)/audacity.pch" where you mentioned.

I didn't change any settings in VS 2008. It's a straightforward instalation. First SKD 7.1, then VC 2008 C++

And finally, yes, I can say followed very rigorously all directions from http://wiki.audacityteam.org/wiki/Developing_On_Windows.

I got rid of these few inclusion conflicts, but I ended up with one link error, as follows:


Creating library C:audacity-srcwinUnicode ReleaseAudacity.lib and object C:audacity-srcwinUnicode ReleaseAudacity.exp
ExportCL.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class wxClassInfo * __thiscall wxTimer::GetClassInfoW(void)const " ([email protected]@@[email protected]@XZ)
C:audacity-srcwinUnicode ReleaseAudacity.exe : fatal error LNK1120: 1 unresolved externals

I would like very much to have Audacity running with Asio but I couldn't even compile without it.

If you have more directions, please, let me know.
Thank you
André

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Wed Mar 13, 2013 8:28 pm
by Gale Andrews
agrbalan wrote:I got rid of these few inclusion conflicts
How?
agrbalan wrote:I would like very much to have Audacity running with Asio but I couldn't even compile without it.
Did your original errors before you modified the Audacity source occur when you were linking to the ASIO SDK? Or before you linked to the ASIO SDK?

To compile with ASIO, please see wincompile.txt (scroll down).

Also see "HELP! I get linker errors!" in that document.

I don't think we can help if you are modifying the Audacity sources in unknown ways. If your intention is to build with ASIO then it is best to do a complete fresh checkout of the Audacity sources, make sure you have defined an environment variable called ASIOSDK_DIR, reboot, then try to build Unicode Release of Audacity again.


Gale

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Wed Mar 13, 2013 9:53 pm
by agrbalan
Gale Andrews wrote:How?
1 - Add a #define NOMINMAX at the very beginning of Audacity.h
2 - Add a #define PLATFORM_MAX_PATH 260 in the SimpleBlockFile.cpp
3 - Add a #include "wx/msw/winundef.h" in app.h

These are the only modifications I made in the code in order to eliminate compiling errors.
Gale Andrews wrote:Did your original errors before you modified the Audacity source occur when you were linking to the ASIO SDK? Or before you linked to the ASIO SDK?
No. I didn't play with anything about ASIO yet. I was just trying to build Audacity alone first.
Gale Andrews wrote:Also see "HELP! I get linker errors!" in that document.
I read but I couldn't figure out a way to fix it.

Thank you Gale.
If you think I can get a binary file of Audacity with Asio for window 7 from someone else, please let me know.
Thanks,
André

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Thu Mar 14, 2013 1:36 am
by Gale Andrews
agrbalan wrote:
Gale Andrews wrote:How?
1 - Add a #define NOMINMAX at the very beginning of Audacity.h
2 - Add a #define PLATFORM_MAX_PATH 260 in the SimpleBlockFile.cpp
3 - Add a #include "wx/msw/winundef.h" in app.h

These are the only modifications I made in the code in order to eliminate compiling errors.
But those changes should not be necessary.

Where did you get 2.0.3 sources from? If you have not already done so, I would suggest installing Tortoise SVN then checking out either the latest Audacity SVN code or the 2.0.3 tagged release from http://audacityteam.org/community/developers#svn .
agrbalan wrote:I didn't play with anything about ASIO yet. I was just trying to build Audacity alone first.
In my experience if you want ASIO, it's best to build linking to ASIO from a separate Audacity tree.

If you want to go back to Audacity without ASIO, remove the ASIOSDK_DIR environment variable, reboot, checkout a fresh Audacity into completely new tree then build from that.

If you build Audacity, add or remove the ASIOSDK_DIR environment variable then build from the same tree, you can hit problems.
agrbalan wrote:If you think I can get a binary file of Audacity with Asio for window 7 from someone else, please let me know.
You cannot, because an ASIO-enabled build is only for personal use and cannot be distributed to anyone else.

But if you can compile the development code without ASIO (and there is no reason you can't) but you cannot compile with ASIO, the current development code now supports JACK for Windows . In turn, JACK supports ASIO.

So if you add a JACKSDK_DIR environment variable and set that variable to the path where you have JACK installed, Audacity will be compiled with JACK support. Configure JACK to use ASIO (see farther down http://jackaudio.org/jack_on_windows ) then start JACK. Then set the Audacity "Host" choice in Device Toolbar to JACK and you will have ASIO support in Audacity with (almost) no more latency than native ASIO support.

Note that because JACK is a way to get ASIO support in Audacity, it has not been decided if we'll be releasing Audacity with JACK support. So as yet, please don't distribute your JACK-enabled Audacity build to anyone else.


Gale

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Fri Mar 15, 2013 3:00 am
by agrbalan
Dear Gale, finally I managed to build Audacity!

First, I realized that I was not actually using SKD 7.1 since I had only installed it but not registered for VS2008. I was actually using SKD 6.0a that comes with VS2008.

Well, first I configured SDK 7.1 to work with VS2008 (tricky.... it took me a long time...)

Then, I rebuilt wxWidgets (only Dll Unicode Release).

Then I tried to rebuild Audacity from a fresh SVN checkout (HEAD version), but... I got again the "MAX_PATH undeclared" error...
I was really about to give up. But I tried once again...

I looked for the definition of "MAX_PATH". I found out that another macro was defined: PLATFORM_MAX_PATH = 260 in Audacity.h
But PLATFORM_MAX_PATH was being set again to MAX_PATH since __WXMSW__ was defined. Well, I removed MAX_PATH and put 260 directly (Audacity.h ln 103). Then I cleaned the project and rebuilt. Worked like a charm (lot of warnings, by the way)...

Concluding, I had to change one line of the code... I browsed the internet and found other few people struglling with the same problem. Isn't it worth modifying the souce code in SVN?

Well, thanks for your help. I really like Audacity and I'm happy that a managed to build it (but it was not easy at all). Now, I'm going to try building with ASIO support.

Best regards
André
São Paulo, Brazil

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Fri Mar 15, 2013 4:45 am
by agrbalan
Very good. Now I have Audacity with ASIO. Very easy now :-)

Thanks

Re: Can not build audacity 2.0.3 with wxWidgets 2.8.12

Posted: Fri Mar 15, 2013 9:51 am
by Gale Andrews
Thanks for the update and thanks for looking for the solution.

Really, you could have done the one build with ASIO unless you really wanted one build with ASIO and one without.
agrbalan wrote:I tried to rebuild Audacity from a fresh SVN checkout (HEAD version), but... I got again the "MAX_PATH undeclared" error...
I was really about to give up. But I tried once again...

I looked for the definition of "MAX_PATH". I found out that another macro was defined: PLATFORM_MAX_PATH = 260 in Audacity.h
But PLATFORM_MAX_PATH was being set again to MAX_PATH since __WXMSW__ was defined. Well, I removed MAX_PATH and put 260 directly (Audacity.h ln 103). Then I cleaned the project and rebuilt. Worked like a charm (lot of warnings, by the way)...

Concluding, I had to change one line of the code... I browsed the internet and found other few people struglling with the same problem. Isn't it worth modifying the souce code in SVN?
You have only just now said exactly what the maxpath error was. Was it this:

Code: Select all

SimpleBlockFile.cpp
......srcblockfileSimpleBlockFile.cpp(504) : error C2065:
'MAX_PATH' : undeclared identifier 
If so, then we do know about this problem, but only one of our developers experiences it ( see http://audacity.238276.n2.nabble.com/Ti ... l#a7557180 if you have not already found that page).

Among the many solutions, this seems to be the best:

Code: Select all

Index: src/blockfile/SimpleBlockFile.cpp
===================================================================
--- SimpleBlockFile.cpp	(revision 12257)
+++ SimpleBlockFile.cpp	(working copy)
@@ -57,6 +57,7 @@
 
 *//*******************************************************************/
 
+#include <wx/wx.h>
 #include <wx/filefn.h>
 #include <wx/ffile.h>
 #include <wx/utils.h>
Does it work for you?


Gale