Browse Source

1.9.14 on MinGW/waf + build guide (#495)

* Add guide for compiling on MinGW using waf

* Update wscripts and guide for MinGW

* Fix README_MINGW typos

* Add instructions for ASIO support

* Update jackd example

* Patch for metadata support on Windows

* Update VS project for building JackRouter

* JackRouter/VS: add int redefinition fix to all build configurations

* VS: ignore Visual Studio build files and user settings

* Revise and extend README_MINGW

* Fix typos in README_MINGW

* Update MinGW build guide

* Replace MAX_PATH with PATH_MAX (win32)

* Include limits.h in JackMetadata.h

Co-authored-by: Schrödinger's Cat <6382400+Schroedingers-Cat@users.noreply.github.com>
tags/v1.9.15
Luciano Iam GitHub 4 years ago
parent
commit
cfb85b0143
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 633 additions and 9 deletions
  1. +7
    -0
      .gitignore
  2. +21
    -7
      common/JackMetadata.cpp
  3. +2
    -0
      common/JackMetadata.h
  4. +6
    -0
      common/wscript
  5. +25
    -0
      windows/JackRouter/JackRouter_MinGW_deps.sln
  6. +287
    -0
      windows/JackRouter/JackRouter_MinGW_deps.vcxproj
  7. +270
    -0
      windows/README_MINGW
  8. +15
    -2
      wscript

+ 7
- 0
.gitignore View File

@@ -6,3 +6,10 @@ __pycache__
android/.server/
android/.client/
codeBlocks

# Visual Studio files
*.vcxproj.user
windows/JackRouter/.vs
windows/JackRouter/Debug
windows/JackRouter/Release
windows/JackRouter/Release64

+ 21
- 7
common/JackMetadata.cpp View File

@@ -68,20 +68,20 @@ JackMetadata::~JackMetadata()
if (fIsEngine)
{
// cleanup after libdb, nasty!
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/metadata.db", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/metadata.db", fDBFilesDir);
remove (dbpath);

snprintf (dbpath, sizeof(dbpath), "%s/jack_db/__db.001", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/__db.001", fDBFilesDir);
remove (dbpath);

snprintf (dbpath, sizeof(dbpath), "%s/jack_db/__db.002", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/__db.002", fDBFilesDir);
remove (dbpath);

snprintf (dbpath, sizeof(dbpath), "%s/jack_db/__db.003", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/__db.003", fDBFilesDir);
remove (dbpath);

// remove our custom dir
snprintf (dbpath, sizeof(dbpath), "%s/jack_db", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db", fDBFilesDir);
rmdir (dbpath);
}
#endif
@@ -94,6 +94,16 @@ int JackMetadata::PropertyInit()
int ret;
char dbpath[PATH_MAX + 1];

#ifdef WIN32
ret = GetTempPathA (PATH_MAX, fDBFilesDir);
if ((ret > PATH_MAX) || (ret == 0)) {
jack_error ("cannot get path for temp files");
return -1;
}
#else
strncpy (fDBFilesDir, jack_server_dir, PATH_MAX);
#endif

/* idempotent */

if (fDBenv) {
@@ -105,8 +115,12 @@ int JackMetadata::PropertyInit()
return -1;
}

snprintf (dbpath, sizeof(dbpath), "%s/jack_db", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db", fDBFilesDir);
#ifdef WIN32
mkdir (dbpath);
#else
mkdir (dbpath, S_IRWXU | S_IRWXG);
#endif

if ((ret = fDBenv->open (fDBenv, dbpath, DB_CREATE | DB_INIT_LOCK | DB_INIT_MPOOL | DB_THREAD, 0)) != 0) {
jack_error ("cannot open DB environment: %s", db_strerror (ret));
@@ -118,7 +132,7 @@ int JackMetadata::PropertyInit()
return -1;
}

snprintf (dbpath, sizeof(dbpath), "%s/jack_db/metadata.db", jack_server_dir);
snprintf (dbpath, sizeof(dbpath), "%s/jack_db/metadata.db", fDBFilesDir);
if ((ret = fDB->open (fDB, NULL, dbpath, NULL, DB_HASH, DB_CREATE | DB_THREAD, 0666)) != 0) {
jack_error ("Cannot open metadata DB at %s: %s", dbpath, db_strerror (ret));
fDB->close (fDB, 0);


+ 2
- 0
common/JackMetadata.h View File

@@ -31,6 +31,7 @@
#endif

#include <stdint.h>
#include <limits.h>

#if HAVE_DB
#include <db.h>
@@ -88,6 +89,7 @@ class JackMetadata
DB* fDB;
DB_ENV* fDBenv;
const bool fIsEngine;
char fDBFilesDir[PATH_MAX + 1];
#endif

int PropertyInit();


+ 6
- 0
common/wscript View File

@@ -197,6 +197,12 @@ def build(bld):
if bld.env['IS_SUN']:
clientlib.env.append_value('LINKFLAGS', '-lnsl -lsocket')

if bld.env['IS_WINDOWS']:
# statically link libjack to libstdc++, some client apps like ardour come
# with a different version of libstdc++.dll that takes precedence and results
# in missing symbols during runtime
clientlib.env.append_value('LINKFLAGS', ['-static-libstdc++', '--disable-auto-import'])

if bld.variant:
# if there is variant defined, we expect it to be the 32bit client lib one
# we don't want to build other stuff in this variant


+ 25
- 0
windows/JackRouter/JackRouter_MinGW_deps.sln View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2018
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JackRouter_MinGW_deps", "JackRouter_MinGW_deps.vcxproj", "{08E8BE85-76F9-4070-B85E-0CA6A38BCBB4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{08E8BE85-76F9-4070-B85E-0CA6A38BCBB4}.Debug|x64.ActiveCfg = Debug|x64
{08E8BE85-76F9-4070-B85E-0CA6A38BCBB4}.Debug|x64.Build.0 = Debug|x64
{08E8BE85-76F9-4070-B85E-0CA6A38BCBB4}.Release|x64.ActiveCfg = Release|x64
{08E8BE85-76F9-4070-B85E-0CA6A38BCBB4}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {14794710-1A0E-40AE-99C4-98C59280F0C3}
EndGlobalSection
EndGlobal

+ 287
- 0
windows/JackRouter/JackRouter_MinGW_deps.vcxproj View File

@@ -0,0 +1,287 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<SccProjectName />
<SccLocalPath />
<ProjectGuid>{08E8BE85-76F9-4070-B85E-0CA6A38BCBB4}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>.\Debug\</OutDir>
<IntDir>.\Debug\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>.\Debug\</OutDir>
<IntDir>.\Debug\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\Release\</OutDir>
<IntDir>.\Release\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>.\Release64\</OutDir>
<IntDir>.\Release64\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<AdditionalIncludeDirectories>c:\msys64\opt\asiosdk\common;..\..\common;..\..\common\jack;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_STDINT_H;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Debug\JackRouter.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>.\Debug\</ObjectFileName>
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Debug\JackRouter.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\JackRouter.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OutputFile>Debug/JackRouter_debug.dll</OutputFile>
<ImportLibrary>.\Debug\JackRouter_debug.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\JackRouter.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>c:\msys64\opt\asiosdk\common;..\..\common;..\..\common\jack;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_STDINT_H;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Debug\JackRouter.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>.\Debug\</ObjectFileName>
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Debug\JackRouter.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\JackRouter.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OutputFile>Debug/JackRouter_debug.dll</OutputFile>
<ImportLibrary>.\Debug\JackRouter_debug.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\JackRouter.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MaxSpeed</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>c:\msys64\opt\asiosdk\common;..\..\common;..\..\common\jack;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_STDINT_H;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Release\JackRouter.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>.\Release\</ObjectFileName>
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Release\JackRouter.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release\JackRouter.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<SubSystem>Windows</SubSystem>
<OutputFile>.\Release\JackRouter.dll</OutputFile>
<ImportLibrary>.\Release\JackRouter.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\JackRouter.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MaxSpeed</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>c:\msys64\opt\asiosdk\common;..\..\common;..\..\common\jack;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_STDINT_H;WIN32;NDEBUG;_WINDOWS;PSAPI_VERSION=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Release\JackRouter.pch</PrecompiledHeaderOutputFile>
<ObjectFileName>.\Release\</ObjectFileName>
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
<ForcedIncludeFiles>stdint.h</ForcedIncludeFiles>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Release\JackRouter.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release\JackRouter64.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<SubSystem>Windows</SubSystem>
<OutputFile>.\Release64\JackRouter.dll</OutputFile>
<ImportLibrary>.\Release\JackRouter64.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\JackRouter.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="c:\msys64\opt\asiosdk\common\combase.cpp" />
<ClCompile Include="c:\msys64\opt\asiosdk\common\dllentry.cpp" />
<ClCompile Include="JackRouter.cpp" />
<ClCompile Include="profport.cpp" />
<ClCompile Include="c:\msys64\opt\asiosdk\common\register.cpp" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="JackRouter.def" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\common\asio.h" />
<ClInclude Include="..\..\Common\Asiodrvr.h" />
<ClInclude Include="..\asiosmpl.h" />
<ClInclude Include="..\..\..\common\asiosys.h" />
<ClInclude Include="..\..\..\common\combase.h" />
<ClInclude Include="..\..\..\common\iasiodrv.h" />
</ItemGroup>
<ItemGroup>
<Library Include="c:\msys64\opt\jack\bin\jack.dll.a" />
<Library Include="Psapi.Lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

+ 270
- 0
windows/README_MINGW View File

@@ -0,0 +1,270 @@
HOW TO COMPILE JACK USING WAF AND MINGW
=======================================

Rev. 1 - 2019-09-01 - First version
Rev. 2 - 2019-09-18 - Include contributions from @Schroedingers-Cat
Rev. 3 - 2019-12-14 - Include contributions from @Schroedingers-Cat



Introduction
------------

This guide contains detailed instructions for building JACK on a modern MinGW
installation. It was conceived as the starting point for unifying the JACK build
process across all platforms.

As this is work in progress, there are still a couple of caveats:

- Asynchronous mode is unusable with low latencies
- JackRouter still builds using a Visual Studio project
- Lots of real world testing is needed



Creating the development environment
------------------------------------

This guide uses MSYS2 as the toolchain, it can be found at https://www.msys2.org/
It comes as a handy installer called msys2-x86_64-{version}.exe. Once installed:

- Open "MSYS2 MinGW 64-bit terminal" from the MSYS2 start menu shortcuts

- Upgrade base MSYS2 packages

pacman -Suy

It is possible pacman ends with the following banner:

warning: terminate MSYS2 without returning to shell and check for updates again
warning: for example close your terminal window instead of calling exit

In such case close the MSYS2 window, re-open, and run pacman -Suy again.

- Install required packages

pacman -S mingw-w64-x86_64-toolchain patch autoconf make \
gettext-devel automake libtool pkgconfig p7zip unzip git python

- Replace the GCC compiler with a version configured for SJLJ exceptions, as
instructed by the original Windows build instructions (windows/README)

Prebuilt binaries can be found at
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/

Look for "x86_64-posix-sjlj" under "MinGW-W64 GCC-{version}", the file should be
called x86_64-{version}-release-posix-sjlj-rt_v6-rev0.7z

Or just download from a direct link (GCC 8.1.0):

wget https://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/sjlj/x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0.7z

Once downloaded:

p7zip -d x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0.7z

That will decompress to a folder called mingw64 in the working directory.
Now replace the files from the previous mingw-w64-x86_64-toolchain package
installation:

mv /mingw64 /mingw64.bak -> backup original
rm /mingw64 -> see explanation below
mv mingw64 / -> sjlj toolchain

The first step results in a new file called mingw64 file being created in /. The
file is not visible to the Windows File Explorer when inspecting C:\msys64, so
it is probably an artifact and safe to delete it in the second step. Otherwise
the last mv step will fail with:

mv: cannot overwrite non-directory '/mingw64' with directory 'mingw64'

An alternate solution consists in closing the MSYS2 window and replicating the
above procedure using the File Explorer. The following assumes the toolchain 7z
file was decompressed to the home directory:

Rename C:\msys64\mingw64 to C:\msys64\mingw64.bak
Move C:\msys64\home\{username}\mingw64 to C:\msys64

Make sure gcc runs and it is the expected version:

$ gcc --version
gcc.exe (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) {version}



Preparing JACK dependencies
---------------------------

There are prebuilt MinGW binaries for all the libraries that can be installed
using the pacman package manager, but since we are using a compiler that is not
the default version shipped by MinGW, it seems better idea to build from source
to avoid any linker and runtime issues. A good technical explanation and/or
evidence for this statement is currently missing from this guide.

Fortunately there are PKGBUILD files for doing so together with a nice guide at
https://github.com/msys2/MINGW-packages

git clone https://github.com/msys2/MINGW-packages.git

Before building libraries, adjust the includes path:

export C_INCLUDE_PATH=/mingw64/include

The basic procedure for building and installing libraries is:

cd MINGW-packages/mingw-w64-{libname}
MINGW_INSTALLS=mingw64 makepkg-mingw -sLf
pacman -U mingw-w64-{libname}-{suffix}.pkg.tar.xz

Repeat the procedure for each library listed below replacing {libname} with the
appropriate name and {suffix} with whatever the above process creates. Keep the
recommended build order, for example libsamplerate depends on libsndfile, and
libsystre depends on libtre-git. libsystre is a wrapper around libtre that
allows including <regex.h> later.

Some libraries like libsndfile and libsamplerate will ask for installing extra
dependencies, it is ok to do so.

For low latency audio it is recommended to build portaudio with ASIO support, so
the Steinberg ASIO SDK should be manually downloaded beforehand. It can be found
at https://www.steinberg.net/en/company/developers.html. The waf script will
later check if the SDK is present at /opt/asiosdk

wget https://www.steinberg.net/asiosdk -O /tmp/asiosdk.zip
unzip /tmp/asiosdk.zip -d /tmp
mkdir /opt <- MinGW does not create /opt during installation
mv /tmp/asiosdk_{version}_{date} /opt/asiosdk

The description file in portaudio (MINGW-packages/mingw-w64-portaudio/PKGBUILD)
needs to be patched so configure is called with the necessary flags for ASIO:

--with-asiodir=/opt/asiosdk <- new option
--with-winapi=wmme,directx,wasapi,vdmks,asio <- append 'asio' to existing

Both static and shared library versions of portaudio are built. To prevent
errors while building the shared version or recompiling static, also insert the
following lines in PKGBUILD after the first make call (around line 60) and after
second make (around line 70):

find /opt/asiosdk -name "*.lo" -type f -delete
find /opt/asiosdk -name "*.o" -type f -delete

Finally here is the list of libraries to build:

db
libsndfile
libsamplerate
libtre-git
libsystre
portaudio



Compiling JACK
--------------

- Clone repo

git clone https://github.com/jackaudio/jack2

- Build and install

cd jack2
./waf configure --prefix=/opt/jack && ./waf -p install

The resulting files can be found at /c/opt/jack/bin, or C:\msys64\opt\jack\bin



Compiling JackRouter
--------------------

Visual Studio with MFC support is needed to build the included JackRouter VS
project. The project was tested to successfully generate a 64bit version of
JackRouter.dll using Visual Studio 2017 and 2019. MFC support can be added from
the VS installer, by selecting Workloads/Visual C++ build tools/Visual C++ MFC
for x86 and x64 (valid for VS 2017). Once ready, just open and build the project

windows/JackRouter/JackRouter_MinGW_deps.vcxproj

Differences from the original JackRouter.vcxproj:

- Depends on the asiosdk files from the previous MinGW JACK installation (i.e.,
it points to absolute paths starting with C:\msys64\opt)
- Links to the jack.dll.a created by the previous build, instead of libjack.lib
This means JackRouter.dll will currently depend on libjack-0.dll
- Force includes stdint.h and defines _STDINT_H to avoid int8_t, int32_t and
uint32_t basic types redefinition during compilation



Running and distributing
------------------------

An automated installation process should copy files to two destinations. One for
the JACK server binary and standalone tools, and another for the client library.
The latter is needed by JACK enabled applications in order to be able to connect
to the server.

- Create a directory named C:\Program Files\Jack (can be anything else)
- Copy all files in C:\msys64\opt\jack\bin to C:\Program Files\Jack
- Copy the following DLLs from C:\msys64\mingw64\bin to C:\Program Files\Jack,
these are dependencies for the JACK server and tools:

libstdc++-6.dll
libdb-6.0.dll
libsndfile-1.dll
libsamplerate-0.dll
libportaudio-2.dll
libgcc_s_sjlj-1.dll
libwinpthread-1.dll
libtre-5.dll
libsystre-0.dll

- Copy and rename the following files from C:\msys64\opt\jack\bin to C:\Windows
to make libjack available to clients:

libjackserver-0.dll -> libjackserver64.dll
libjack-0.dll -> libjack64.dll

- Copy the following files from C:\msys64\mingw64\bin to C:\Windows, these are
dependencies for libjack. C:\Windows is the directory the current official JACK
1.9.11 binary installer targets, a better solution should be devised to avoid
cluttering the Windows directory:

libgcc_s_sjlj-1.dll
libwinpthread-1.dll
libtre-5.dll
libsystre-0.dll

- Copy JackRouter.dll from windows\JackRouter\Release64 to C:\Program Files\Jack
This allows non-JACK applications to connect to the server through a special
ASIO driver that routes audio to JACK instead of a physical audio device.
Also copy libjack-0.dll from C:\msys64\mingw64\bin to C:\Program Files\Jack
because JackRouter depends on libjack but will check for libjack-0.dll instead
of the system-wide libjack64.dll previously copied to C:\Windows. Once done,
JackRouter needs to be registered:

regsvr32 JackRouter.dll

Tested working clients:
Ardour
Bitwig Studio
QJackCtl
JackRouter

Example of starting the JACK server including MIDI support for a Focusrite USB
audio device using ASIO:
jackd -R -S -X winmme -d portaudio -p 32 -r 48000 -d "ASIO::Focusrite USB ASIO"



Development tools and links
---------------------------

http://www.dependencywalker.com/
https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags
https://blogs.msdn.microsoft.com/junfeng/2006/11/20/debugging-loadlibrary-failures/
https://stackoverflow.com/questions/15852677/static-and-dynamic-shared-linking-with-mingw
https://github.com/EddieRingle/portaudio/blob/master/src/hostapi/asio/ASIO-README.txt

+ 15
- 2
wscript View File

@@ -212,6 +212,14 @@ def configure(conf):
if conf.env['IS_WINDOWS']:
conf.env.append_unique('CCDEFINES', '_POSIX')
conf.env.append_unique('CXXDEFINES', '_POSIX')
if Options.options.platform == 'msys':
conf.env.append_value('INCLUDES', ['/mingw64/include'])
conf.check(
header_name='asio.h',
includes='/opt/asiosdk/common',
msg='Checking for ASIO SDK',
define_name='HAVE_ASIO',
mandatory=False)

conf.env.append_unique('CFLAGS', '-Wall')
conf.env.append_unique('CXXFLAGS', '-Wall')
@@ -369,8 +377,13 @@ def configure(conf):
# existing install paths that use ADDON_DIR rather than have to
# have special cases for windows each time.
conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
# don't define ADDON_DIR in config.h, use the default 'jack' defined in
# windows/JackPlatformPlug_os.h
if Options.options.platform == 'msys':
conf.define('ADDON_DIR', 'jack')
conf.define('__STDC_FORMAT_MACROS', 1) # for PRIu64
else:
# don't define ADDON_DIR in config.h, use the default 'jack' defined in
# windows/JackPlatformPlug_os.h
pass
else:
conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
conf.define('ADDON_DIR', conf.env['ADDON_DIR'])


Loading…
Cancel
Save