Cloudef / orbment

Modular Wayland compositor
Other
246 stars 16 forks source link

compile error 'xkbcommon/xkbcommon-keysyms.h' not found #94

Closed renegart closed 9 years ago

renegart commented 9 years ago

On a non-standard installation the xkbcommon include files are not found, because you don't search for the pkgconfig file of xkbcommon package to configure the include/lib path correctly.

Cloudef commented 9 years ago

https://github.com/Cloudef/orbment/blob/master/CMake/FindXKBCommon.cmake Seems to use pkgconfig module for search path hints.

Earnestly commented 9 years ago

Where is your xkbcommon-keysyms.h and what does pkg-config --libs xkbcommon report?

renegart commented 9 years ago

I've a side-by-side installation of Wayland in my home directory to test the newest version without break my system. I'm using cmake 3.2 because older versions can't handle custom 'PKG_CONFIG_PATH' variable correctly.

I run cmake with following command: 'cmake -DCMAKE_INSTALL_PREFIX=$WLD -DCMAKE_INSTALL_PREFIX:PATH=$WLD ../'

$WLD is the installation path of the custom Wayland installation.

I don't see any message 'xkbcommon' will be searched and found by cmake. When run 'make' I get the compile error.

'pkg-config --libs xkbcommon' put's out _-L/home/barco/waylandinstall/lib -lxkbcommon which is the correct information of the xkbcommon package. xkbcommon-keysyms.h is installed at _/home/barco/waylandinstall/include/xkbcommon

Cloudef commented 9 years ago

I'm more interested in pkg-config --cflags xkbcommon, as that is what prints out the include paths. Or the PCXKBCOMMON* variables in CMakeCache.txt

Earnestly commented 9 years ago

pkg-config --cflags xkbcommon seems to print nothing, hmm.

renegart commented 9 years ago

pkg-config --cflags xkbcommon print out following: _-I/home/barco/waylandinstall/include

Could it be something is missing in plugins/layout component?

Cloudef commented 9 years ago

Probably missing the correct include path somewhere, can I get full compile output?

renegart commented 9 years ago

You can find the dump here: https://bpaste.net/show/489bae6dbcba

Cloudef commented 9 years ago

Right, you are on right track. Can you add ${XKBCOMMON_INCLUDE_DIR} to the include_directories list in plugins/CMakeLists.txtand see if it compiles.

renegart commented 9 years ago

yes, this seems to fix this issue. Now I get another error: /home/barco/wayland_build/orbment/plugins/compressor/compressor-png.c:12:1: error: conflicting types for ‘write’ write(png_structp p, png_bytep data, png_size_t length) ^ In file included from /usr/include/x86_64-linux-gnu/zconf.h:452:0, from /usr/include/zlib.h:34, from /usr/include/png.h:536, from /home/barco/wayland_build/orbment/plugins/compressor/compressor-png.c:6: /usr/include/unistd.h:366:16: note: previous declaration of ‘write’ was here extern ssize_t write (int fd, const void ___buf, size_t n) __wur; ^ /home/barco/wayland_build/orbment/plugins/compressor/compressor-png.c:21:1: error: conflicting types for ‘compress’ compress(const struct wlc_size size, uint8_t rgba, size_t out_size) ^ In file included from /usr/include/png.h:536:0, from /home/barco/wayland_build/orbment/plugins/compressor/compressor-png.c:6: /usr/include/zlib.h:1160:21: note: previous declaration of ‘compress’ was here ZEXTERN int ZEXPORT compress OF((Bytef dest, uLongf destLen, ^ plugins/compressor/CMakeFiles/orbment-plugin-compressor-png.dir/build.make:54: recipe for target 'plugins/compressor/CMakeFiles/orbment-plugin-compressor-png.dir/compressor-png.c.o' failed make[2]: _* [plugins/compressor/CMakeFiles/orbment-plugin-compressor-png.dir/compressor-png.c.o] Error 1 CMakeFiles/Makefile2:1466: recipe for target 'plugins/compressor/CMakeFiles/orbment-plugin-compressor-png.dir/all' failed make[1]: * [plugins/compressor/CMakeFiles/orbment-plugin-compressor-png.dir/all] Error 2 Makefile:116: recipe for target 'all' failed make: * [all] Error 2

Could be an issue on my system...

Cloudef commented 9 years ago

Nah, I should rename those functions they seem to cause quite a conflict.

Cloudef commented 9 years ago

Can you try this patch

From 7dbe3c8e139e7095772eedbb1fb0de9c943b456b Mon Sep 17 00:00:00 2001
From: Jari Vetoniemi <mailroxas@gmail.com>
Date: Mon, 20 Apr 2015 14:55:53 +0300
Subject: [PATCH] Avoid using common system header function names

Namely write and compress functions (unistd and zlib)
---
 plugins/compressor/compressor-png.c | 8 ++++----
 plugins/compressor/compressor-ppm.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/plugins/compressor/compressor-png.c b/plugins/compressor/compressor-png.c
index 8f5ea77..f30a0bb 100644
--- a/plugins/compressor/compressor-png.c
+++ b/plugins/compressor/compressor-png.c
@@ -9,7 +9,7 @@
 static bool (*add_compressor)(plugin_h, const char *type, const char *name, const char *ext, const struct function*);

 static void
-write(png_structp p, png_bytep data, png_size_t length)
+write_png(png_structp p, png_bytep data, png_size_t length)
 {
    assert(p);
    struct chck_buffer *buf = (struct chck_buffer*)png_get_io_ptr(p);
@@ -18,7 +18,7 @@ write(png_structp p, png_bytep data, png_size_t length)
 }

 static uint8_t*
-compress(const struct wlc_size *size, uint8_t *rgba, size_t *out_size)
+compress_png(const struct wlc_size *size, uint8_t *rgba, size_t *out_size)
 {
    if (out_size)
       *out_size = 0;
@@ -54,7 +54,7 @@ compress(const struct wlc_size *size, uint8_t *rgba, size_t *out_size)
       rows[y] = rgba + ((size->h - 1) - y) * size->w * 4;

    png_set_rows(p, info, rows);
-   png_set_write_fn(p, &buf, write, NULL);
+   png_set_write_fn(p, &buf, write_png, NULL);
    png_write_png(p, info, PNG_TRANSFORM_IDENTITY, NULL);
    free(rows);
    png_destroy_info_struct(p, &info);
@@ -88,7 +88,7 @@ plugin_init(plugin_h self)
    if (!(add_compressor = import_method(self, compressor, "add_compressor", "b(h,c[],c[],c[],fun)|1")))
       return false;

-   return add_compressor(self, "image", "png", "png", FUN(compress, "u8[](p,u8[],sz*)|1"));
+   return add_compressor(self, "image", "png", "png", FUN(compress_png, "u8[](p,u8[],sz*)|1"));
 }

 const struct plugin_info*
diff --git a/plugins/compressor/compressor-ppm.c b/plugins/compressor/compressor-ppm.c
index 53fca96..8a3334a 100644
--- a/plugins/compressor/compressor-ppm.c
+++ b/plugins/compressor/compressor-ppm.c
@@ -8,7 +8,7 @@
 static bool (*add_compressor)(plugin_h, const char *type, const char *name, const char *ext, const struct function*);

 static uint8_t*
-compress(const struct wlc_size *size, uint8_t *rgba, size_t *out_size)
+compress_ppm(const struct wlc_size *size, uint8_t *rgba, size_t *out_size)
 {
    if (out_size)
       *out_size = 0;
@@ -66,7 +66,7 @@ plugin_init(plugin_h self)
    if (!(add_compressor = import_method(self, compressor, "add_compressor", "b(h,c[],c[],c[],fun)|1")))
       return false;

-   return add_compressor(self, "image", "ppm", "ppm", FUN(compress, "u8[](p,u8[],sz*)|1"));
+   return add_compressor(self, "image", "ppm", "ppm", FUN(compress_ppm, "u8[](p,u8[],sz*)|1"));
 }

 const struct plugin_info*
-- 
2.3.2 (Apple Git-55)
renegart commented 9 years ago

yes, now it builds :)

Cloudef commented 9 years ago

All right, I commit the fixes.

Cloudef commented 9 years ago

Should be fixed now, reopen if this is not the case.