Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: compile error on NetBSD when building without CUPS #1774

Closed
rdmark opened this issue Nov 23, 2024 · 6 comments · Fixed by #1790
Closed

meson: compile error on NetBSD when building without CUPS #1774

rdmark opened this issue Nov 23, 2024 · 6 comments · Fixed by #1790
Assignees
Milestone

Comments

@rdmark
Copy link
Member

rdmark commented Nov 23, 2024

Building with appletalk support but without CUPS reportedly fails on NetBSD.

@rdmark
Copy link
Member Author

rdmark commented Nov 23, 2024

@hfath I wasn't able to reproduce what you saw. In my NetBSD 10.0 setup, with no cups libs installed, doing meson setup with -Dwith-appletalk=true I get in the setup log...

cups-config found: NO
Run-time dependency cups found: NO (tried pkgconfig, config-tool and cmake)
Program cups-config found: NO
meson.build:957: WARNING: CUPS not found, you might need to specify the path to cups-config

Afterwards, I can still compile the code without error.

Would you mind sharing your meson-log for a failed build?

@rdmark rdmark changed the title meson: building without CUPS meson: compile error on NetBSD when building without CUPS Nov 23, 2024
@hfath
Copy link

hfath commented Nov 25, 2024

I guess the problem is that meson manages to detect an installed cups past the buildlink mechanism that tries to hide it...

    Features:
      ACL                      : YES
      AFP stats via D-Bus      : NO
      AppleTalk                : YES
      Cracklib                 : YES
      CUPS                     : YES

and then

[225/309] Compiling C object etc/papd/papd.p/print_cups.c.o
FAILED: etc/papd/papd.p/print_cups.c.o 
gcc -Ietc/papd/papd.p -Ietc/papd -I../etc/papd -I. -I.. -Iinclude -I../include -Isys -I../sys -Ietc/afpd -I../etc/afpd -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/db5 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=c11 -DHAVE_CONFIG_H '-D_U_=__attribute__((unused))' -Wno-pedantic -Wno-extra -Wno-all -Wno-deprecated-declarations -O2 -DNO_STATIC_MODULES '-D_PATH_PAPDCONF="/etc/pkg/netatalk/papd.conf"' '-D_PATH_PAPDUAMPATH="/usr/pkg/lib/netatalk/"' '-DSPOOLDIR="/var/spool/netatalk/"' '-DVERSION="4.0.7"' -MD -MQ etc/papd/papd.p/print_cups.c.o -MF etc/papd/papd.p/print_cups.c.o.d -o etc/papd/papd.p/print_cups.c.o -c ../etc/papd/print_cups.c
../etc/papd/print_cups.c:38:10: fatal error: cups/ipp.h: No such file or directory
   38 | #include <cups/ipp.h>
      |          ^~~~~~~~~~~~
compilation terminated.

From the meson log

Determining dependency 'cups' with pkg-config executable '/var/obj/pkgsrc/net/netatalk4/work/.tools/bin/pkg-config'
env[PKG_SYSCONFDIR]: /etc/pkg/netatalk
env[PKG_CONFIG]: /var/obj/pkgsrc/net/netatalk4/work/.tools/bin/pkg-config
env[PKG_CONFIG_LIBDIR]: /var/obj/pkgsrc/net/netatalk4/work/.buildlink/lib/pkgconfig:/var/obj/pkgsrc/net/netatalk4/work/.buildlink/share/pkgconfig
env[PKG_CONFIG_LOG]: /var/obj/pkgsrc/net/netatalk4/work/.pkg-config.log
env[PKG_CONFIG_PATH]: 
-----------
Called: `/var/obj/pkgsrc/net/netatalk4/work/.tools/bin/pkg-config --modversion cups` -> 1
stderr:
Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
Package 'cups' not found
-----------
cups-config binary missing from cross or native file, or env var undefined.
Trying a default cups-config fallback at cups-config
cups-config found: YES (/usr/pkg/bin/cups-config) 2.4.11
-----------
Called: `/usr/pkg/bin/cups-config --cflags` -> 0
stdout:
-I/usr/pkg/include
-----------

I wonder how that can be averted for pkgsrc builds.

@hfath
Copy link

hfath commented Nov 25, 2024

For a bit of background: pkgsrc comes with a mechanism that restricts a package build to the declared dependencies (destdir, elsewhere called fakeroot). Toolchain wrappers point include and library paths to directories with symlink farms, and PATH is re-directed likewise.

Since this is not a full-blown chroot, looking for a tool with absolute path (like /usr/pkg/bin/cups-config above) will get you the tool, breaking the abstraction. That could be avoided by just looking for the tool, relying on PATH which pkgsrc then can manipulate.

@hfath
Copy link

hfath commented Nov 25, 2024

Alternatively, if meson is just being too smart for its own good, a with-cups option might be what the doctor prescribes.

@rdmark
Copy link
Member Author

rdmark commented Nov 25, 2024

Interesting, this gives me a better idea what's going on. We're using the built-in Meson find_program() wrapper to detect cups and cups-config, which is where the absolute paths come from. So right now this smells like a Meson bug / lack of understanding of the NetBSD destdir model to me.

We have a with-cups option declared but not implemented. I think we forgot to port the option from 2.x to 4.0. Let me get that implemented in the next version!

@rdmark rdmark self-assigned this Nov 25, 2024
@rdmark rdmark added this to the release-4.0 milestone Nov 25, 2024
@rdmark rdmark linked a pull request Nov 25, 2024 that will close this issue
@NJRoadfan
Copy link
Contributor

FWIW, CUPS detection is changing with libcups3. They are moving to a standard pkg-config setup vs. using a dedicated program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants