jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.21k stars 376 forks source link

Issue in Compiling jack 1.9.12 code on windows. #488

Open ayushkumar024 opened 5 years ago

ayushkumar024 commented 5 years ago

I am trying to compile Jack 1.9.12 code on my system. System configuration:

Can anyone help me out like what are the steps required to setup environment to compile the source code of jack2. Help will be appreciated.

falkTX commented 5 years ago

Please try with latest git instead of 1.9.12 tarball.

Currently JACK devs are focused on Linux, Windows builds are kinda left on the side for now.

ayushkumar024 commented 5 years ago

I tried with the latest git, jack 1.9.12, 1.9.1. But i am getting system dependency error with all the versions.

Errors like:

error: '_putenv_s' was not declared in this scope

Release64\libjacknet\common\JackLibSampleRateResampler.o:JackLibSampleRateResampler.cpp|| undefined reference to `src_process'

Did i skip something?

kmatheussen commented 5 years ago

On Mon, Aug 12, 2019 at 4:52 PM ayushkumar024 notifications@github.com wrote:

I tried with the latest git, jack 1.9.12, 1.9.1. But i am getting system dependency error with all the versions.

Errors like:

error: '_putenv_s' was not declared in this scope

Release64\libjacknet\common\JackLibSampleRateResampler.o:JackLibSampleRateResampler.cpp|| undefined reference to `src_process'

Did i skip something?

Hi, the version of mingw (and so forth) you are using are probably a little different from what we have been using. I also don't know if anyone has been using mingw on windows to compile jack, and there's probably an even smaller chance of anyone using Codeblocks. Using mingw under linux or msys will probably work better, but you still need to be prepared to edit the source a little bit when using mingw.

Regarding your errors, missing _putenv_s sounds familiar, but I don't remember the solution. You need to google it. And the src_process error means that you're not linking with libsamplerate.

ayushkumar024 commented 5 years ago

Thank you for responding. Can you tell me, what mingW version you are using?

kmatheussen commented 5 years ago

On Mon, Aug 12, 2019 at 7:33 PM ayushkumar024 notifications@github.com wrote:

Thank you for responding. Can you tell me, what mingW version you are using?

I don't have that computer available right now, but I'm using mingw provided by mxe (mxe.cc) and a gcc > 5.0.

ayushkumar024 commented 5 years ago

I tried with MingW_64. Now, there is no system dependency error. Thank you

ayushkumar024 commented 5 years ago

This is the only error i am getting.

Release64\bin\libportaudio_x86_64.a(pa_asio.o):pa_asio.cpp:(.data$_ZTISt9exception[_ZTISt9exception]+0x0): multiple definition of `typeinfo for std::exception' Release64\portaudio\JackPortAudioDriver.o:JackPortAudioDriver.cpp:(.rdata$_ZTISt9exception[_ZTISt9exception]+0x0): first defined here collect2.exe: error: ld returned 1 exit status

I didn't find any solution for this. Can anyone help me out.

kmatheussen commented 5 years ago

On Mon, Aug 19, 2019 at 3:04 PM ayushkumar024 notifications@github.com wrote:

This is the only error i am getting.

Release64\bin\libportaudio_x86_64.a(pa_asio.o):pa_asio.cpp:(.data$_ZTISt9exception[_ZTISt9exception]+0x0): multiple definition of `typeinfo for std::exception' Release64\portaudio\JackPortAudioDriver.o:JackPortAudioDriver.cpp:(.rdata$_ZTISt9exception[_ZTISt9exception]+0x0): first defined here collect2.exe: error: ld returned 1 exit status

I didn't find any solution for this. Can anyone help me out.

Looks like you are linking with Release64\bin\libportaudio_x86_64.a, which is included in the repository and is 8 years old. That file should probably be deleted. It'll probably work if you use a more updated version portaudio, preferably compiled by yourself to avoid errors like this.

lucianoiam commented 5 years ago

I am working on updating the build scripts to target modern MSYS2/MinGW toolchains and avoid linking against old static libraries. Everything is working except ASIO and metadata, all testing and suggestions are welcomed. Fork at https://github.com/iamluciano/jack2/tree/target-mingw . Guide for building at https://github.com/iamluciano/jack2/blob/target-mingw/windows/README_MINGW

ghost commented 4 years ago

I have also attempted to build from a git clone, but with Code::Blocks and TDM-GCC MinGW. Like earlier commentors, I tried this approach because it is the approach suggested in the existing README in the Windows directory.

Now I've worked through various issue numbers and PRs on github I realise build has been failing with this toolchain for several versions back, so I'd like to suggest an update to the README to prevent further repeat mistakes.

@lucianoiam - are you happy to have a mention in the updated documentation - the existing links in the README for "more information" are all dead links...

I will also do some testing of the changes you made, but with CodeBlocks, and comment over on your fork. Since most of the problems I have found so far were easily fixed by using the appropriate compilier flags I would guess we can put together a PR for those which would help with any gcc-on-Windows toolchain. I need to have a look at your changes and compare with my list.

lucianoiam commented 4 years ago

@coffeeandspaceships please note I am neither an experienced user or programmer on the Windows platform. I wrote the guide because I needed to share some work with a friend who is a Windows user and had some issues with a binary JACK distribution. I cannot exactly recall the issues but I think it was related to some Python client failing to connect to that prebuilt JACK.

The guide feels closer to a user perspective rather than a programmer’s, something like a quick recipe to get a binary of latest JACK. It does not really innovate and may contain some statements pulled out from thin air, like this one: "Asynchronous mode is unusable with low latencies”. I honestly do not know that is caused by following the steps on my guide or just the expected behavior on Windows/MinGW. Revisiting things like that or the compiler with SJLJ exceptions requirement would be great achievements towards modernized Windows build documentation.

Probably most important I haven’t seriously tested the result; it appears to work but cannot comment on reliability. Instructions on how to package the result for distribution are also missing, which could be important for Windows users expecting an install wizard.

Having a solution that builds with any gcc sounds great and I totally agree about preventing future mistakes by updating documentation. Feel free to reuse and suggest, I am fine about being mentioned.

On a side note I didn’t go the CodeBlocks way because I felt that building on Windows should not be an exception compared to other platforms, whether is waf or any upcoming system. But I recall having success with CB at first, and requiring less setup steps compared to the guide.

ghost commented 4 years ago

Thanks for the reply. I've spent a bit more time on this now and it's beginning to make more sense... For the CodeBlocks issue in particular and the current misleading documentation, see my comment on issue #371 .

I've also made myself a list of other fix activity that's going on (including yours) and when I've figured out the complete task list across those issues and PRs, I'll post the list somewhere appropriate. We need to try and break fixes down into self-contained smaller PRs and tackle them one-by-one I think, to make it easy for the maintainers who are not focused on Windows. Others have already put a lot of work into that so this may not be too difficult to get over the line.

Side note: I suspect the async issue is related to the use of SJLJ and the whole thing probably needs a massive refactor to work properly on Windows...

lucianoiam commented 4 years ago

Had a look at #371 and I recall having to create a missing compiler profile to get the project built. Removing <Option compiler="mingw_64" /> from the CBPs should avoid an unnecessary step in the build process, great finding.

symdeb commented 4 years ago

This problem is the same for the 1.9.14 Windows tarball repository from the jack site, this github repository and this repo https://github.com/lucianoiam/jack2/tree/target-mingw as well.

Using code blocks 10.05 and (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0 Tried to build with waf and MSYS had a lot of issues and had to give up, the README in the windows folder provides two options VS6 (too old) and CodeBlocks, so tried that.

The link provided here for the include "config.h" does not work anymore and config.h is not in the repo either. Somehow I found a config.h file as attached and put it in common/jack. That solved the incldue error. config.zip Next got the regex error, and added the "tre" files (was moved to github) under /windows and renamed the folder from tre-master to tre-0.8.0. . Now, libjacknet and some other projects (not all) build but libjack and jackserver do not. Errors are from shm.c . Attached is the build log with the errors. errors.zip

ghost commented 4 years ago

There is a specific issue at the intersection of config.h, Windows WAF, and the jack2 Windows build instructions at the time of writing:

Commit https://github.com/jackaudio/jack2/commit/b5bd3afb285944fe0c2651c4fe33a7f88d8e631f "Add conditional includes for config.h, for use with waf" should have given WAF complete control over config.h. It did not, because there are some explicit includes of config.h BELOW the conditional includes, in some source files. This is a cross-platform issue which is an easy change to make in the source tree, but I guess requires some extensive regression testing to address, in the case that any other logic is relying on inclusion of config.h on a platform where waf does not define HAS_CONFIG_H.

Then on Windows build specifically, some of the documentation recommends including the TRE source code directly in the jack source tree. TRE also includes a config.h and that must be included explicitly to have TRE build correctly using this method. (This then causes ANOTHER problem with snprintf support which requires a manual edit to fix.)

So either TRE needs to be pulled into the tree properly and a patch created to allow the integrated build; or the documentation should be changed to recommend that TRE is built or installed seperately. Seems like most recent successful attempts to build on Windows have just grabbed TRE binaries seperately and linked them.

The first config.h issue seems like technical debt outside of Windows and could probably be addressed in a seperate fix first, if there is appetite for the regression impact?

ghost commented 4 years ago

I have successfully built jack2 with ASIO support this evening using

I have created a PR https://github.com/jackaudio/jack2/pull/550 which includes the Code::Blocks specifics but does not include a whole lot of other local changes I had to make to achieve full build from source. The intention of this PR is to at least update Code::Blocks so it only has the same problems as a waf build. :-)

I did this by:

I then made multiple minor code changes to fix remaining build errors - I will put together a different PR covering those - it should be possible to merge the C::B fix PR independently and without regression so please review it. I think there are actually fixes for most of the remaining errors in the other two pending PRs for Windows builds anyway.

Note: I built PortAudio using MSYS2 and configure, NOT C::B.