[Freeswitch-dev] Command-line windows build?

Dmitry Gromov gromovd at gmail.com
Thu Nov 5 23:17:19 PST 2009


Hi.

That's funny you asking... I just finished test builds of the FreeSwitch
snapshot using Msbuild and nothing more than Platform SDK.
And I haven't seen your email until after I had Debug build succeed. Release
build took a bit more tweaking.

If anyone interested - Platform SDK, starting with version 6.1 (or may be
even 6.0, so not remember) includes non-optimizing C++ compiler, msbuild and
most other tools (but not all) needed to build projects.
Builds Freeswitch.2008.express.sln with PlatformSDK only needs some tweaking
to project files. If you have VS2008 Express or full version, it should be
even easier - just correct one typo and one tweak (I think that should be
enough).

So, except obvious fixes, there are two limitations to PlatformSDK build
environments:
- bscmake.exe tool is not included, so it is not possible to build .bsc
files - this is just debug info and can be easily turned off
- there is one project which has a requirement for optimization to be turned
on when building in Release mode, so it will be compatible with default
compiler switch (/GS- BufferSecurityCheck), but that can be turned off as
well

Below are the tweaks I did to project files in order too build with
PlatformSDK. As I said - you may need less tweaking if you have VS
installed.
Disclamer - I haven't tried running Freeswitch executables I built, the
results based on successful build results with PlatformSDK 6.1 only.

Also - once I test this and verify all tweaks, I plan to post the info on
the wiki (if there are no objections, of course).

Let's go over the tweaks:

\libs\win32\Download sphinxmodel.2008.vcproj
This file has a typo, preventing build to succeed in release mode,
Look for section
        <Configuration
            Name="Release|Win32"
...
                <Tool
                    Name="VCCustomBuildTool"
...
and remove line break (join two lines) like this:
            GetUnzip
http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz&quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"

Original file has CrLf in the middle of the URL, preventing file download.

\libs\win32\util.vbs
This is not a big issue for most of the people, but it was for me - file
tries to download several files from
http://files.freeswitch.org/downloads/win32/
And there are at least 3 .exe files it needs. I tried this build from my
work and, obviously, downloading .exe files is blocked on the proxy. And
that's ok - I have no problem, just a recommendation - why not to zip all
those exe files and keep them in the archive? The single file which needs to
be downloaded unpacked is 7za.exe - but it can be kept with some innocent
extension instead and renamed after successful download.
So, I had to download those files manually and place them... where? util.vbs
does not tell where it tries to download files, it only tells the source
url. So I added the following line after the one, which prints source URL:
    Wscript.echo("Downloading: " & URL)
    Wscript.echo("Destination folder: " & DestFolder)
(This needs to be done in two places in that file).

\libs\win32\curl\curllib.2008.vcproj
\libs\win32\sofia\libsofia_sip_ua_static.2008.vcproj
Both this files try to generate .bsc files. In order to disable that, edit
those files, find all occurrences of BrowseInformation attribute and set it
to "0" if it is set to "1"
(You may want to edit only section which will be used for the target you
need - Debug/Release and appropriate platform)

\w32\Library\FreeSwitchCore.2008.vcproj
\libs\srtp\libsrtp.2008.vcproj
This is only needed for building using PlatformSDK only Release build.
We need to reset setting to treate all warnings as errors to "false"
Look for section:
        <Configuration
            Name="Release|Win32"
...
            <Tool
                Name="VCCLCompilerTool"
...
find:
                WarnAsError="true"
change to:
                WarnAsError="false"


\src\mod\languages\mod_spidermonkey\mod_spidermonkey.2008.vcproj
Here, mod_spidermonke.dll is generated, as well as export .exp and Import
.lib
The thing is that MSBuild creates a copy of original ..vcproj file in order
o use file references instead of component references. This does not affect
DLL, but .exp and .lib files are generated with funky names.
And as the result - .lib file can not be found on the later stage of the
build (it actulally should have worked - it is probably referenced
incorrectly on the dependent project).
To avoid this, we can set attribute to request specific name of the Import
library:
Find config sections you are targeting:
        <Configuration
            Name="Release|Win32"
or
        <Configuration
            Name="Debug|Win32"
then in section
            <Tool
                Name="VCLinkerTool"
add this line:

ImportLibrary="$(PlatformName)\$(ConfigurationName)/$(ProjectName).lib"

That should do it.

Remember - if you are fixing the above gradually, building project as you go
- you have to be careful and may have to delete obj/lib/etc files which were
built with incorrect settings (especially for WarnAsError changes).

Oh, and to kick-off the build - open CMD shell for SDK - shortcut is
provided in PlatformSDK programs group, navigate to the folder where
Freeswitch.2008.express.sln  is located and run something like this:

msbuild Freeswitch.2008.express.sln /v:d /p:Configuration=Release
/l:FileLogger,Microsoft.Build.Engine;logfile=Freeswitch.2008.express.log

(You can replace Release with Debug to build debug target).

This will create detailed Freeswitch.2008.express.log in case you need to
troubleshoot build further.

Thanks,
Dmitry

On Tue, Nov 3, 2009 at 18:00, Josh Rivers <josh at radianttiger.com> wrote:

> I've spent a couple of nights trying to get FS to build on Win32 using
> msbuild against the .sln file. Debug builds seem to fail in spidermonkey,
> and release builds fail in util.vbs. Everything builds fine if I do it in
> Studio, it just doesn't build from the command line.
>
> Is anybody doing an automated build of FS on windows? If so, are you using
> any tricks to get it compile or am I missing something obvious?
>
> Thanks,
> Josh
>
> ps. I see a binary build reference in the Wiki. Is the code to build /
> package that checked in somewhere?
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
DG
NJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20091106/231b6109/attachment-0001.html 


More information about the FreeSWITCH-dev mailing list