opusfile icon indicating copy to clipboard operation
opusfile copied to clipboard

Issues regarding Windows OS compilation

Open dotBlueShoes opened this issue 8 months ago • 15 comments

I just stumbled upon this software and since yesterday I've been trying to compile a .lib and .dll file to use in a simple OpenAL, WinAPI application. I find it impossible to do so. I do not use msys2/mingw on a daily basis. Please. I don't recall any other situation I had to compile 'makedepend' as MSYS2 does not provide it. I would be thankful if someone could provide me said .dll .lib or maybe to even be 100% sure the dependent libs and dlls.

That being said, It's likely I missed or misread something as I am not even sure if compiling this source code from Windows is even possible, and I'd gladly welcome an answer.

I am not sure if the error below is anyhow useful, as it is one of many I have stumbled. (It's cropped, as the whole log takes so many lines I do not wish to count them.) It appears for some reason it looks for a 32-bit MinGW toolchain when in fact I believe I'm running a 64-bit toolchain.

make[2]: Leaving directory '/home/Admin/opusfile/mingw/openssl-1.0.2u/test'
making depend in tools...
make[2]: Entering directory '/home/Admin/opusfile/mingw/openssl-1.0.2u/tools'
make[2]: Nothing to be done for 'depend'.
make[2]: Leaving directory '/home/Admin/opusfile/mingw/openssl-1.0.2u/tools'
make[1]: Leaving directory '/home/Admin/opusfile/mingw/openssl-1.0.2u'
make -C openssl-1.0.2u
make[1]: Entering directory '/home/Admin/opusfile/mingw/openssl-1.0.2u'
making all in crypto...
make[2]: Entering directory '/home/Admin/opusfile/mingw/openssl-1.0.2u/crypto'
/usr/bin/perl.exe ../util/mkbuildinf.pl "i686-w64-mingw32-gcc -I. -I.. -I../include  -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM" "mingw" >buildinf.h
i686-w64-mingw32-gcc -I. -I.. -I../include  -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM   -c -o cryptlib.o cryptlib.c
make[2]: i686-w64-mingw32-gcc: No such file or directory
make[2]: *** [<builtin>: cryptlib.o] Error 127
make[2]: Leaving directory '/home/Admin/opusfile/mingw/openssl-1.0.2u/crypto'
make[1]: *** [Makefile:288: build_crypto] Error 1
make[1]: Leaving directory '/home/Admin/opusfile/mingw/openssl-1.0.2u'
make: *** [Makefile:84: ssl_BUILD] Error 2

dotBlueShoes avatar Apr 23 '25 11:04 dotBlueShoes

Hello.

I am in the same ship.

I did try to compile opusfile.dll using cmake and VS2015.

After hard fight and lot of white nights I finally get a opusfile.dll but only for x86, all try to build a library for x64 failed.

Also, sadly, the opusfile.dll x86 does not have any exported methods, so unusable.

I have used a old libopusfile.dll downloaded from a dll-download site and it is working like charm but only on Windows 7. On Windows 10/11 sadly, for dealing with opus web-streams, I get a exception when trying to op_test_callbacks(), that is working perfectly with Linux and Windows 7. All other methods work, like op_fopen to play opus files but op_test_callbacks() resists.

So the questions: is opusfile working on Windows 10/11 and did the core devs try opusfile.dll on Windows 10/11 compiled for x86/x64?

fredvs avatar Apr 23 '25 12:04 fredvs

On Windows 10/11 sadly, for dealing with opus web-streams, I get a exception when trying to op_test_callbacks(), that is working perfectly with Linux and Windows 7. All other methods work, like op_fopen to play opus files but op_test_callbacks() resists.

OK, fixed. Strangely, this method and op_open_callbacks() require the stdcall calling convention on Windows 10/11, all other methods accept cdecl.

And only these methods require stdcall; for example, registering the read, seek, tell and close callbacks requires cdecl on Windows; using stdcall crashes the program.

I'm glad the door is open to Windows 10/11 for opus web streaming, it works perfectly with the old opus.dll (with the stdcall fix).

The challenge now is to compile the latest opusfile commits, preferably with VS to reduce dependencies, for both x86 and x64, and especially to obtain a dynamic opusfile.dll file (and not just opusfile.lib).

Thanks for this great project, which deserves to be accessible on Windows 10/11 as well (PS: I'm not a Windows user).

Have good days and courage, hold on, opus/opusfile is a nice project.

fredvs avatar Apr 23 '25 21:04 fredvs

And so I too have successfully compiled the library. My problem still remains. There is no information about said process. I have constructed the following note on how to compile opusfile as a Static Library .lib hope someone finds it useful :) Compiling OPUSFILE on Windows

dotBlueShoes avatar Apr 24 '25 14:04 dotBlueShoes

Hello. Here too with cmake + VS2015, the static lib opusfile.lib is created but I get no chance to create opusfile.dll dynamic lib.

fredvs avatar Apr 24 '25 14:04 fredvs

Hello. Here too with cmake + VS2015, the static lib opusfile.lib is created but I get no chance to create opusfile.dll dynamic lib.

For now I am satisfied with just the .lib file build. However I did tried to produce the dynamic library today and the funny thing is I managed to produce a .dll but now I am unable to generate an import library .lib to support the .dll. I suspect the .dll generated file is then corrupted.

dotBlueShoes avatar Apr 25 '25 12:04 dotBlueShoes

Hello. Here too with cmake + VS2015, the static lib opusfile.lib is created but I get no chance to create opusfile.dll dynamic lib.

For now I am satisfied with just the .lib file build. However I did tried to produce the dynamic library today and the funny thing is I managed to produce a .dll but now I am unable to generate an import library .lib to support the .dll. I suspect the .dll generated file is then corrupted.

What i did is:

  • build https://github.com/openssl/openssl/releases/tag/OpenSSL_1_0_2a as static lib
  • build https://github.com/xiph/opus.git as static lib
  • build https://github.com/xiph/ogg.git as static lib
  • In the solution properties of opusfile I changed the settings to generate a Dynamic Library (chatgpt tells nicely what settings those are)
  • and linked the following libraries:
    • ws2_32.lib
    • Crypt32.lib
    • C:\OpenSSL_1_0_2\lib\libeay32.lib
    • C:\OpenSSL_1_0_2\lib\ssleay32.lib
    • C:\Projects\temp\ogg\build\Release\ogg.lib
    • C:\Projects\temp\opus\build\Release\opus.lib

dotBlueShoes avatar Apr 25 '25 12:04 dotBlueShoes

Hello. Here too with cmake + VS2015, the static lib opusfile.lib is created but I get no chance to create opusfile.dll dynamic lib.

For now I am satisfied with just the .lib file build. However I did tried to produce the dynamic library today and the funny thing is I managed to produce a .dll but now I am unable to generate an import library .lib to support the .dll. I suspect the .dll generated file is then corrupted.

What i did is:

* build https://github.com/openssl/openssl/releases/tag/OpenSSL_1_0_2a as `static lib`

* build https://github.com/xiph/opus.git as `static lib`

* build https://github.com/xiph/ogg.git as `static lib`

* In the solution properties of `opusfile` I changed the settings to generate a `Dynamic Library` (chatgpt tells nicely what settings those are)

* and linked the following libraries:
  
  * ws2_32.lib
  * Crypt32.lib
  * C:\OpenSSL_1_0_2\lib\libeay32.lib
  * C:\OpenSSL_1_0_2\lib\ssleay32.lib
  * C:\Projects\temp\ogg\build\Release\ogg.lib
  * C:\Projects\temp\opus\build\Release\opus.lib

Wow, many thanks, I will try it.

Hum, could it be possible to give here, as attachment the opusfile.dll you get, and are you able to compile for x64?

fredvs avatar Apr 25 '25 12:04 fredvs

In the solution properties of opusfile I changed the settings to generate a Dynamic Library (chatgpt tells nicely what settings those are)

Is it in cmake or in visual studio to change the settings?

fredvs avatar Apr 25 '25 12:04 fredvs

In the solution properties of opusfile I changed the settings to generate a Dynamic Library (chatgpt tells nicely what settings those are)

Is it in cmake or in visual studio to change the settings?

Visual Studio -> I Used the following pre existing solution file: https://github.com/xiph/opusfile/tree/master/win32/VS2015

dotBlueShoes avatar Apr 25 '25 13:04 dotBlueShoes

Ha, ok, I will try, thanks, but strange that you get this site, here there is no win32/vs2015 page:

Image

fredvs avatar Apr 25 '25 13:04 fredvs

OK, you used the "master" branch, I used the default "main" branch.

If I may, I dont find this opusfile project much friendly to use for developers (or maybe it is the goal...).

fredvs avatar Apr 25 '25 13:04 fredvs

Wow, many thanks, I will try it.

Hum, could it be possible to give here, as attachment the opusfile.dll you get, and are you able to compile for x64?

I am really sorry i missed that message.

Here are the dll's I have created https://wormhole.app/vbnLAM#fSOrxJp0J6oZGsr0oBmodA

Also I have no further interest in making the .dll's my complaint stays. It is the same as yours there is no documentation on that topic. GL to you and others :)

dotBlueShoes avatar Apr 25 '25 13:04 dotBlueShoes

Wow, many thanks, I will try it. Hum, could it be possible to give here, as attachment the opusfile.dll you get, and are you able to compile for x64?

I am really sorry i missed that message.

Here are the dll's I have created https://wormhole.app/vbnLAM#fSOrxJp0J6oZGsr0oBmodA

Also I have no further interest in making the .dll's my complaint stays. It is the same as yours there is no documentation on that topic. GL to you and others :)

Many, many thanks, I will test those gems asap.

Have a perfect day.

Fre;D

fredvs avatar Apr 25 '25 14:04 fredvs

Ok, unzip in Linux dont like the " " in the file name:

unzip Wormhole vbnLAM.zip = not happy :( unzip Wormhole_vbnLAM.zip = very happy :)

So sorry for the noise and thanks for the dll's. I will try those dll asap once I find a Windows 10/11 machine.

fredvs avatar Apr 25 '25 16:04 fredvs

Seems like people were able to help each other here. Feel free to open a more specific issue if you're still having problems.

rillian avatar Aug 09 '25 15:08 rillian