xiph / opus

Modern audio compression for the internet.
https://opus-codec.org/
Other
2.29k stars 607 forks source link

Opus codec build instructions only support Linux and not Windows #275

Open Ori248 opened 1 year ago

Ori248 commented 1 year ago

Hello. I am a Windows user trying to compile the Opus codec in order to execute specific functions from a Python script. I've used the Windows Subsystem for Linux (WSL) to build the Opus source code using the instructions given here, and I succeeded, but the final resulting libraries are .so files, which work for Linux but not Windows. I would like to ask for help in enabling the creation of DLLs instead of .so files, in order to enable building Opus on Windows and using is as a DLL. Any help is welcomed. Thanks in advance!

xnorpx commented 1 year ago

Install Visual studio 2022 Install CMake

Start a x64 Native Tools Command Prompt for VS 2022 (important don't ignore this step) You can find it in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2022\Visual Studio Tools\VC

git clone https://github.com/xiph/opus cd opus mkdir build cd build cmake .. -DOPUS_BUILD_SHARED_LIBRARY=ON cmake --build . -j 8 --config Release

Ori248 commented 1 year ago

I'll try that, thanks!

Ori248 commented 1 year ago

I'm actually struggling with this. When trying to execute this line from your answer: cmake .. -DOPUS_BUILD_SHARED_LIBRARY=ON, I get the following error: CMake Error at CMakeLists.txt:7 (project): No CMAKE_C_COMPILER could be found. What does it mean? How can I resolve it?

rillian commented 1 year ago

It means cmake couldn't find a working C compiler. Make sure you have Microsoft Visual Studio installed, with support for the C/C++ languages and the current Windows SDK. Make sure you're running cmake from a command shell with the appropriate environment, e.g. "x64 Native Tools Command Prompt for VS 2022".

This post has a few other strategies to try.