Building openMHA on PC - winsock error

Post Reply
shaikath
Posts: 22
Joined: Wed Oct 28, 2020 4:12 pm

Building openMHA on PC - winsock error

Post by shaikath » Fri Jan 08, 2021 12:56 am

I'm encountering a winsock error when trying to build openMHA on a windows 10 PC. This problem is detailed here:

https://stackoverflow.com/questions/290 ... y-included

Could you advise how to resolve this issue?
Attachments
winsock.png
winsock.png (42.32 KiB) Viewed 36249 times

tobiasherzke
Posts: 119
Joined: Mon Jun 24, 2019 12:51 pm

Re: Building openMHA on Windows - winsock error

Post by tobiasherzke » Fri Jan 08, 2021 10:07 am

For most users, there is no need to compile openMHA themselves - you can use our installer, see instructions in INSTALLATION.md.

If you still want to compile openMHA yourself, you can do so of course.

Your current problem is related to this https://github.com/HoerTech-gGmbH/openMHA/issues/45 and to this viewtopic.php?t=7&p=186#p186

The workaround for the compilation error is:
1) uninstall Jack with add/remove software
2) Reinstall an older version of Jack for windows (1.9.11)
3) Repeat the steps from the COMPILATION.md instructions to make Jack available to msys, replacing any existing copies from the previously installed jack.

shaikath
Posts: 22
Joined: Wed Oct 28, 2020 4:12 pm

Re: Building openMHA on PC - winsock error

Post by shaikath » Tue Jan 12, 2021 1:43 am

I followed the steps of installing the previous version of JACK. However, I now have an error where it cannot find ljack:

Code: Select all

g++ -shared -o $PWD/x86_64-MinGW-gcc-10/MHAIOJack.dll x86_64-MinGW-gcc-10/MHAIOJack.o x86_64-MinGW-gcc-10/MHAIOJack_mha_git_commit_hash.o x86_64-MinGW-gcc-10/mhajack.o -L/home/shaikath/openMHA/external_libs/x86_64-MinGW-gcc-10/lib -L../../libmha/x86_64-MinGW-gcc-10 -L../../../external_libs/x86_64-MinGW-gcc-10/lib -lopenmha -ljack
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljack
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../../../rules.mk:62: x86_64-MinGW-gcc-10/MHAIOJack.dll] Error 1
make[2]: Leaving directory '/home/shaikath/openMHA/mha/plugins/io'
make[1]: *** [../../rules.mk:105: io] Error 2
make[1]: Leaving directory '/home/shaikath/openMHA/mha/plugins'
make: *** [Makefile:49: mha/plugins] Error 2

tobiasherzke
Posts: 119
Joined: Mon Jun 24, 2019 12:51 pm

Re: Building openMHA on PC - winsock error

Post by tobiasherzke » Wed Jan 13, 2021 3:25 pm

cannot find -ljack
You may have overlooked this point from the COMPILATION.md instructions:
  • Copy libjack64.lib from the JACK installation (C:\Program Files (x86)\Jack\lib) to the lib sub-directory of your mingw64 directory and rename it to libjack.a afterwards. Windows may warn that the file may become unusable -- ignore this warning.
If you have installed msys2 in the default location, then by following the above step you ultimately create a file c:\msys64\mingw64\lib\libjack.a , and the linker should find it there.

shaikath
Posts: 22
Joined: Wed Oct 28, 2020 4:12 pm

Re: Building openMHA on PC - winsock error

Post by shaikath » Wed Jan 13, 2021 6:30 pm

Hmm I actually did do that step. I tried replacing the lib file once again but I receive the same error. I noticed I have folders for both Jack and Jack2 in my program files directory. Maybe theres a path issue? I ran ./configure and had to install pkg-config but I doubt that was related to this error.

tobiasherzke
Posts: 119
Joined: Mon Jun 24, 2019 12:51 pm

Re: Building openMHA on PC - winsock error

Post by tobiasherzke » Thu Jan 14, 2021 3:54 pm

Please verify from an msys2 terminal that your libjack.a copy in MinGW is the same as the file in the Jack 1.9.11 installation and the same as displayed here:

Code: Select all

$ ls -l /mingw64/lib/libjack.a /c/Progra*/Jack/lib/libjack64.lib
-rw-r--r-- 1 ... ... 41990 Mar 21  2016 '/c/Program Files (x86)/Jack/lib/libjack64.lib'
-rw-r--r-- 1 ... ... 41990 Mar 21  2016  /mingw64/lib/libjack.a

$ md5sum /mingw64/lib/libjack.a /c/Progra*/Jack/lib/libjack64.lib
44091d4bb1d4d0dd4246235bd6e4caa1 */mingw64/lib/libjack.a
44091d4bb1d4d0dd4246235bd6e4caa1 */c/Program Files (x86)/Jack/lib/libjack64.lib
If these are the same, and the same as on my computer, then check if your compiler can link against it with a simple test program: Place this code in a file linkjack.c

Code: Select all

extern void jack_get_version(int*,int*,int*,int*);
int main() {int i; jack_get_version(&i,&i,&i,&i);}
And invoke the compiler 3 times from an msys2 mingw64 terminal like this: First invocation should fail, last two invocations should succeed equally:

Code: Select all

$ gcc linkjack.c
$ gcc linkjack.c -ljack
$ gcc linkjack.c /mingw64/lib/libjack.a
Please report what your results are.

If you do not need Jack on windows for openMHA, you could also compile openMHA without Jack support: after invoking ./configure, delete the line WITH_JACK=yes from file config.mk

shaikath
Posts: 22
Joined: Wed Oct 28, 2020 4:12 pm

Re: Building openMHA on PC - winsock error

Post by shaikath » Thu Jan 14, 2021 6:55 pm

Thank you for the suggested steps. I realized that I had renamed to libjack64.a and not libjack.a. Changing it resolved my issues.

shaikath
Posts: 22
Joined: Wed Oct 28, 2020 4:12 pm

Re: Building openMHA on PC - winsock error

Post by shaikath » Fri Jan 15, 2021 1:09 am

I suppose a follow up question which is worth asking is whether you might recommend a given IDE to use with openMHA if we were interested in utilizing breakpoints? I have found that Code Blocks can be configured to use mingw:

https://stackoverflow.com/questions/369 ... codeblocks

I haven't seen much online about using an IDE for openMHA development.

tobiasherzke
Posts: 119
Joined: Mon Jun 24, 2019 12:51 pm

Re: Building openMHA on PC - winsock error

Post by tobiasherzke » Fri Jan 15, 2021 8:55 am

We in the openMHA core team do not use IDEs. Most use emacs for code editing, and for debugging we use the command line.

Apart from CodeBlocks, I think also CLion, eclipse, QtCreator support the MinGW compiler. It may be difficult to configure them to actually do something useful with the openMHA source tree, because we use plain Makefiles as build system, and I know that at least CLion and QtCreator insist on using CMake, therefore I would not really consider them. Another alternative may be to use a smart editor like visual studio code, which you should be able to configure so that it compiles with Makefiles through msys2/mingw64, and I think there are tutorials for how to debug C++ code with visual studio code.

Of course, there is also the alternative to use gdb on the command line.

Post Reply