```bash
uv pip install iio==29
```
```
Using Python 3.14.4 environment at: .venv_x86-64
Resolved 1 package in 5ms
× Failed to build `iio==29`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

[stdout]
running bdist_wheel
running build
running build_py
running build_ext
building 'libiio' extension
cc -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3
-Wall -O3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -fPIC -Iiio
-I/usr/local/include -I/lustre/work/pdl16831/udlc74081/.cache/uv/builds-v0/.tmpqrsSUx/include
-I/lustre/work/pdl16831/udlc74081/.local/share/uv/python/cpython-3.14.4-linux-x86_64-gnu/include/python3.14 -c iio/iio.c -o
build/temp.linux-x86_64-cpython-314/iio/iio.o -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -O3
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -DI_CAN_HAS_LIBWEBP

[stderr]
<string>:55: SyntaxWarning: "\." is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\."? A
raw string is also an option.
iio/iio.c:241:12: fatal error: png.h: No such file or directory
241 | # include <png.h>
| ^~~~~~~
compilation terminated.
error: command '/usr/bin/cc' failed with exit code 1

hint: This error likely indicates that you need to install a library that provides "png.h" for `iio@29`
```

How can I avoid above error thanks to existing `~/rpm/x86_64/usr/include/libpng12/png.h`?
Jun 5, 12:50pm

The error occurs because the compiler cannot find the png.h header file, which is required to build the iio package. You already have the header file at ~/rpm/x86_64/usr/include/libpng12/png.h, but the compiler is not looking in that directory.

Solution

You need to explicitly tell the compiler where to find the png.h header file by setting the CFLAGS environment variable to include the path to the directory containing png.h.

Steps:

  1. Set the CFLAGS environment variable to include the path to the directory containing png.h:

    bash
    export CFLAGS="-I~/rpm/x86_64/usr/include/libpng12"
  2. Re-run the installation command:

    bash
    uv pip install iio==29

Alternative (Permanent Solution)

If you want to make this change permanent, add the export line to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile):

bash
echo 'export CFLAGS="-I~/rpm/x86_64/usr/include/libpng12"' >> ~/.bashrc
source ~/.bashrc

Then retry the installation.


Why This Works

  • The -I flag in CFLAGS tells the compiler to look in the specified directory for header files.
  • By setting CFLAGS, you ensure the compiler can find png.h during the build process.
Jun 5, 12:50pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more