Help with JPEG and WebP Support on MilkV Duo

Hello,

I’m working with the MilkV Duo256M module and when I try to open a JPEG file in Python, I encounter the following error:

OSError: decoder jpeg not available

How can I resolve this issue? Do I need to install an additional library?

Also, when trying to work with C, I noticed that the libwebp library is not available in the duo-sdk. How can I add WebP support to the duo-sdk? What steps should I follow to handle both JPEG and WebP formats in a C project on MilkV?

I appreciate any suggestions or help.

Thank you!

Hello everyone,

I was able to resolve the issue of JPEG decoding and WebP support on the MilkV Duo256M module. Here’s the process I followed to get both JPEG and WebP libraries working properly:

1. Cross-compiling libjpeg and libwebp:

Since the MilkV Duo SDK didn’t include these libraries, I had to cross-compile them for the RISC-V architecture. Here are the steps I followed:

A. libjpeg-turbo Cross-compilation:

  1. Download the source code for libjpeg-turbo.
  2. Use the SDK’s toolchain to compile for the RISC-V architecture. I created a custom toolchain file for CMake and then compiled the library like this:
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../path-to-your-toolchain-file.cmake -DCMAKE_INSTALL_PREFIX=/path-to-sdk/rootfs/usr ..
make
make install

B. libwebp Cross-compilation:

  1. Similarly, I cross-compiled libwebp by downloading its source code.
  2. I configured it to enable libsharpyuv (a dependency of libwebp), compiled it with the SDK’s toolchain, and installed it into the SDK’s root filesystem:
./configure --enable-sharpyuv --host=riscv64-unknown-linux-musl --prefix=/path-to-sdk/rootfs/usr
make
make install

2. Copying the Compiled Libraries:

After cross-compiling, I copied the following files to the MilkV Duo’s /usr/lib/ directory:

  • libjpeg.so
  • libwebp.so
  • libsharpyuv.so

I hope this helps anyone facing similar issues with missing libraries on MilkV Duo. Feel free to ask if you have any questions!

1 Like