Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Cross-compiling error

73 views
Skip to first unread message

clark zheng

unread,
Mar 12, 2025, 4:45:24 PMMar 12
to WebP Discussion
Hi,
so I'm trying to compile libwebp but it would tell me 
 ERROR: unsafe header/library path used in cross-compilation: '-L/usr/lib' 
is there any way to fix this?

Thanks

James Zern

unread,
Mar 12, 2025, 6:41:46 PMMar 12
to webp-d...@webmproject.org
Hi,

Can you provide a command line for how you're cross compiling?
Using autoconf the following will work for cross compiling aarch64 on x86-64 linux assuming the presence of an aarch64-linux-gnu toolchain (aarch64-linux-gnu-gcc, etc.):
  configure --host aarch64-linux-gnu --build x86_64-pc-linux-gnu
--build can be supplied by config.guess.

clark zheng

unread,
Mar 12, 2025, 7:05:53 PMMar 12
to WebP Discussion, James Zern
Hi, thanks for the response

I'm just using

PKG_CONFIG_PATH="${TARGET_DESTDIR}/lib/pkgconfig:$SYSroot/usr/lib/pkgconfig" \
CFLAGS=-I${TARGET_DESTDIR}/include \
CPPFLAGS=-I${TARGET_DESTDIR}/include \
LDFLAGS='-L${TARGET_DESTDIR}/lib ' \
./configure --host=${HOST_TARGET} --disable-tiff

and the env variables should be correct since it works for all other libraries... and the error is usually related to /usr/local/lib or /usr/lib being used 

Thanks

James Zern

unread,
Mar 12, 2025, 7:45:59 PMMar 12
to WebP Discussion
On Wed, Mar 12, 2025 at 4:02 PM clark zheng <clarkz...@gmail.com> wrote:
Hi, thanks for the response

I'm just using

PKG_CONFIG_PATH="${TARGET_DESTDIR}/lib/pkgconfig:$SYSroot/usr/lib/pkgconfig" \
CFLAGS=-I${TARGET_DESTDIR}/include \
CPPFLAGS=-I${TARGET_DESTDIR}/include \
LDFLAGS='-L${TARGET_DESTDIR}/lib ' \
./configure --host=${HOST_TARGET} --disable-tiff

and the env variables should be correct since it works for all other libraries... and the error is usually related to /usr/local/lib or /usr/lib being used 

What are TARGET_DESTDIR and HOST_TARGET in this case? libwebp's configure indirectly adds paths via pkg-config (or more precisely libpng-config* and sdl2-config), so you may be picking up the path from one of those tools in your PATH.
I'm a little surprised this is an error and not a warning. Can you show the full command line with `make V=1` with one of the executable targets like cwebp? Also add the full output of the configure run.
Reply all
Reply to author
Forward
0 new messages