opus icon indicating copy to clipboard operation
opus copied to clipboard

Opus codec build instructions only support Linux and not Windows

Open Ori248 opened this issue 2 years ago • 4 comments

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!

Ori248 avatar Apr 23 '23 22:04 Ori248

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

xnorpx avatar Apr 23 '23 22:04 xnorpx

I'll try that, thanks!

Ori248 avatar Apr 23 '23 22:04 Ori248

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?

Ori248 avatar Apr 24 '23 08:04 Ori248

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.

rillian avatar May 05 '23 16:05 rillian