[Bug 274978] emulators/qemu-devel: conflict with sysutils/dtc (libftd, ftd.h)

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 09 Nov 2023 12:00:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274978

--- Comment #1 from John Hein <jcfyecrayz@liamekaens.com> ---
@bofh,

Why in ports e6a3abc3c8260427f41eb4e50d57cc1bceb891f7, do you escape the " in
CONFIGURE_ARGS (like: --extra-ldflags=-L\"${LOCALBASE}/lib\" )?  It seems to
get passed to meson, and ultimately to cc, and the quotes actually are
interpreted as part of the path string.

I made a change to test --enable-fdt=system, and got this error from meson (in
build/meson-logs/meson-log.txt):

===========
Command line: `/usr/bin/cc -m64 -mcx16 '-L"/usr/lib"' '-L"/usr/local/lib"'
-I/z1/local/users/jhein/.nobak/wd/usr/ports/emulators/qemu-devel/work/qemu-6c9ae1ce82b65faa3f266fd103729878cf11e07e
-I/usr/local/include -I/usr/local/include/capstone
/z1/local/users/jhein/.nobak/wd/usr/ports/emulators/qemu-devel/work/qemu-6c9ae1ce82b65faa3f266fd103729878cf11e07e/build/meson-private/tmpdriw8mlm/testfile.c
-o
/z1/local/users/jhein/.nobak/wd/usr/ports/emulators/qemu-devel/work/qemu-6c9ae1ce82b65faa3f266fd103729878cf11e07e/build/meson-private/tmpdriw8mlm/output.exe
-O2 -pipe -fstack-protector-strong -fno-strict-aliasing
'-DPREFIX=\""/usr/local\""' -D_FILE_OFFSET_BITS=64 -O0
-Werror=implicit-function-declaration -Wl,--start-group -lfdt -Wl,--end-group
-Wl,--allow-shlib-undefined -Wl,-rpath=/usr/local/lib` -> 1
stderr:
ld: error: unable to find library -lfdt
cc: error: linker command failed with exit code 1 (use -v to see invocation)
===========

Notice that there are literal " marks in -L"/usr/lib" and -L"/usr/local/lib" in
the meson log.  That is causing the search for libfdt to fail since the quote
characters are literally included in the path name.

When I remove the \ (i.e., change \" to just ") in
emulators/qemu-devel/Makefile, then the -L/usr/local/lib search works (and cc
can find -lfdt).

I'm just wondering what was the reason behind adding the backslash escaped
quoting in -L\"/usr/local/lib\" (and -L\"/usr/lib\" as well).  It is a bit
unusual to see that, so there must have been something specific that drove the
addition of the backslash escapes.  Maybe it is to address potential spaces in
LOCALBASE (admittedly that would be tricky to support and get the right quoting
passed through all the layers in play here: the Makefile, configure shell
script, and meson python), but that would not explain the quoting around the
literal /usr/lib.

-- 
You are receiving this mail because:
You are the assignee for the bug.