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

Version 0.6.4 cannot find pgkconf and ft2build.h #35

Open
stumbles opened this issue Jun 24, 2023 · 5 comments
Open

Version 0.6.4 cannot find pgkconf and ft2build.h #35

stumbles opened this issue Jun 24, 2023 · 5 comments

Comments

@stumbles
Copy link

/usr/bin/pkgconf is present, why it's not found by which isn't clear to me. Running which pkgconf from cli and the correct path is returned.

The more puzzling part is c-test-2 and why /usr/include/cairo/cairo-ft.h says it cannot find ft2build.h. That file is present in /usr/include/freetype2/. AFAICT all the pathing is correct. As a check, I looked into for example grub2 and it finds ft2build.h with no problems.

pkgconf --cflags /usr/lib/pkgconfig/cairo-ft.pc returns;
-I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1

pkgconf --libs /usr/lib/pkgconfig/cairo-ft.pc returns;
-lcairo -lfreetype

pkgconf --cflags /usr/lib/pkgconfig/cairo-fc.pc returns;
-I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1

pkgconf --libs /usr/lib/pkgconfig/cairo-fc.pc returns;
-lcairo -lfontconfig -lfreetype

Running; dune build -p cairo2

File "src/dune", line 12, characters 0-132:
12 | (rule
13 | (targets c_flags.sexp c_library_flags.sexp cairo_ocaml.h)
14 | (deps cairo_ocaml.h.p)
15 | (action (run ../config/discover.exe)))
(cd _build/default/src && ../config/discover.exe)
which: /usr/bin/pkgconf
-> not found
compiling c program:
| #include <stdio.h>
| #include <cairo.h>
|
|
| #define DUNE_ABS(x) ((x >= 0)? x: -(x))
| #define DUNE_D0(x) ('0'+(DUNE_ABS(x)/1 )%10)
| #define DUNE_D1(x) ('0'+(DUNE_ABS(x)/10 )%10), DUNE_D0(x)
| #define DUNE_D2(x) ('0'+(DUNE_ABS(x)/100 )%10), DUNE_D1(x)
| #define DUNE_D3(x) ('0'+(DUNE_ABS(x)/1000 )%10), DUNE_D2(x)
| #define DUNE_D4(x) ('0'+(DUNE_ABS(x)/10000 )%10), DUNE_D3(x)
| #define DUNE_D5(x) ('0'+(DUNE_ABS(x)/100000 )%10), DUNE_D4(x)
| #define DUNE_D6(x) ('0'+(DUNE_ABS(x)/1000000 )%10), DUNE_D5(x)
| #define DUNE_D7(x) ('0'+(DUNE_ABS(x)/10000000 )%10), DUNE_D6(x)
| #define DUNE_D8(x) ('0'+(DUNE_ABS(x)/100000000 )%10), DUNE_D7(x)
| #define DUNE_D9(x) ('0'+(DUNE_ABS(x)/1000000000)%10), DUNE_D8(x)
| #define DUNE_SIGN(x) ((x >= 0)? '0': '-')
|
|
| const char s0[] = {
| 'B', 'E', 'G', 'I', 'N', '-', '0', '-',
| DUNE_SIGN((CAIRO_VERSION_MAJOR)),
| DUNE_D9((CAIRO_VERSION_MAJOR)),
| '-', 'E', 'N', 'D'
| };
|
|
| const char s1[] = {
| 'B', 'E', 'G', 'I', 'N', '-', '1', '-',
| DUNE_SIGN((CAIRO_VERSION_MINOR)),
| DUNE_D9((CAIRO_VERSION_MINOR)),
| '-', 'E', 'N', 'D'
| };
|
run: gcc -O2 -fno-strict-aliasing -fwrapv -pthread -g -fno-omit-frame-pointer -fPIC -O2 -march=native -pipe -Wp,-D_FORTIFY_SOURCE=2 -I/usr/include/cairo -I /usr/lib/ocaml -o /tmp/build_cf88f1_dune/ocaml-configuratord1e6f8/c-test-0/test.o -c /tmp/build_cf88f1_dune/ocaml-configuratord1e6f8/c-test-0/test.c -lm -lpthread
-> process exited with code 0
-> stdout:
-> stderr:
compiling c program:
| #include <stdio.h>
| #include <cairo-ft.h>
|
|
| #ifdef CAIRO_HAS_FT_FONT
| const char *s0 = "BEGIN-0-true-END";
| #else
| const char *s0 = "BEGIN-0-false-END";
| #endif
|
|
| #ifdef CAIRO_HAS_FC_FONT
| const char *s1 = "BEGIN-1-true-END";
| #else
| const char *s1 = "BEGIN-1-false-END";
| #endif
|
run: gcc -O2 -fno-strict-aliasing -fwrapv -pthread -g -fno-omit-frame-pointer -fPIC -O2 -march=native -pipe -Wp,-D_FORTIFY_SOURCE=2 -I/usr/include/cairo -I /usr/lib/ocaml -o /tmp/build_cf88f1_dune/ocaml-configuratord1e6f8/c-test-2/test.o -c /tmp/build_cf88f1_dune/ocaml-configuratord1e6f8/c-test-2/test.c -lm -lpthread
-> process exited with code 1
-> stdout:
-> stderr:
| In file included from /tmp/build_cf88f1_dune/ocaml-configuratord1e6f8/c-test-2/test.c:2:
| /usr/include/cairo/cairo-ft.h:46:10: fatal error: ft2build.h: No such file or directory
| 46 | #include <ft2build.h>
| | ^~~~~~~~~~~~
| compilation terminated.
Error: failed to compile program

@maroneze
Copy link

maroneze commented Jul 6, 2023

I'm having a very similar problem, but on Cygwin. I even tried installing older versions of cairo2 (down to 0.6), but I got the same error everytime.

In my Fedora, I have no issues with the installation, but when I try it on Cygwin I get the same error, but with a different command line:

 x86_64-w64-mingw32-gcc -O2 -fno-strict-aliasing -fwrapv -mms-bitfields   -I/usr/include/cairo 
  -I C:/OCaml64/home/user/.opam/4.14.0+mingw64c/lib/ocaml
  -o C:\OCaml64\tmp\build_b20be0_dune\ocaml-configurator26b3b6\c-test-2\test.o 
  -c C:\OCaml64\tmp\build_b20be0_dune\ocaml-configurator26b3b6\c-test-2\test.c -lws2_32 -lversion
-> process exited with code 1
-> stdout:
-> stderr:
 | In file included from C:\OCaml64\tmp\build_b20be0_dune\ocaml-configurator26b3b6\c-test-2\test.c:2:
 | /usr/include/cairo/cairo-ft.h:46:10: fatal error: ft2build.h: No such file or directory
 |    46 | #include <ft2build.h>
 |       |          ^~~~~~~~~~~~
 | compilation terminated.

I did manage to install cairo2 on previous Cygwin setups, so I don't know if my Cygwin changed versions, or if I had different installed packages.

Actually, the beginning of the compilation message hints to pkg-config not being found:

$ (cd _build/default/src && ../config/discover.exe)
which: pkg-config
-> not found
compiling c program:
...

But it is there in my Cygwin (in /usr/bin, which is C:\OCaml64\bin). I suspect some environment issue when the discover.exe executable is launched, but when I had some similar issues with other packages, setting my PATH variable was enough to make it work. Not in this case...

Anyway, I'm adding this in case this helps tracking down the cause. Even if it is possible that the cause of my issue is unrelated to @stumbles' (with the same symptoms).

I found this open issue related to dune-configurator which seems suspiciously similar, but it seems limited to Windows builds, so probably unrelated to @stumbles' actual issue.

@stumbles
Copy link
Author

stumbles commented Jul 6, 2023

@maroneze, same here about not finding pkgconf even though the pathing is correct, else I would have seen tons of other apps failing to compile.

@maroneze
Copy link

Ok, after seeing this for the first time, I tried checking my C:\OCaml64\bin folder (mapped to /usr/bin in Cygwin), and I noticed the pkg-config file inside it was a symlink to pkgconf.exe. Since I already had several issues with symlinks in Cygwin/MinGW, I erased it and copied pkgconf.exe as pkg-config.exe. Then re-running opam install cairo worked.

I didn't need this in the past (I was able to compile cairo2 without issues), but for some reason now I do.

@maroneze
Copy link

For future reference (for me and others): something is still not 100% right in my Cygwin+MinGW setting, because even if I could install cairo2, I then had issues with lablgtk3. I finally managed to get it working by running:

(export PKG_CONFIG_PATH="C:\OCaml64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\pkgconfig" && opam install lablgtk3)

But the fact that I had to manually set my PKG_CONFIG_PATH (besides having installed Cygwin's mingw-based gtk3 packages) indicates that maybe something is not entirely right in my solution.

@stumbles
Copy link
Author

stumbles commented Dec 2, 2023

On a side note, here is my current pkgconf pathing;

PKG_CONFIG_PATH=/usr/lib/qt6/pkgconfig:/usr/lib/qt5/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:
PKG_CONFIG=/usr/bin/pkgconf

Also here are the cairo related package configs installed by cairo on my system;

/usr/lib/pkgconfig/cairo-fc.pc
/usr/lib/pkgconfig/cairo-ft.pc
/usr/lib/pkgconfig/cairo-gobject.pc
/usr/lib/pkgconfig/cairo.pc
/usr/lib/pkgconfig/cairo-pdf.pc
/usr/lib/pkgconfig/cairo-png.pc
/usr/lib/pkgconfig/cairo-ps.pc
/usr/lib/pkgconfig/cairo-script-interpreter.pc
/usr/lib/pkgconfig/cairo-script.pc
/usr/lib/pkgconfig/cairo-svg.pc
/usr/lib/pkgconfig/cairo-tee.pc
/usr/lib/pkgconfig/cairo-xcb.pc
/usr/lib/pkgconfig/cairo-xcb-shm.pc
/usr/lib/pkgconfig/cairo-xlib.pc
/usr/lib/pkgconfig/cairo-xlib-xcb.pc
/usr/lib/pkgconfig/cairo-xlib-xrender.pc

Is there some subtle bug in discover.ml I'm tripping over?

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

No branches or pull requests

2 participants