[PATCH] Fix compilation with meson

Tulio Magno Quites Machado Filho tuliom@ascii.art.br
Fri Jan 31 21:44:27 GMT 2025


From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>

After these changes, I'm able to complete a build using meson + ninja.
Changes are still needed in order to get a successful execution of the
tests.

--- 8< ---

1. Add a missing include directory.
2. Tell annocheck to use config.h.
3. Add 2 macros used by annocheck to gcc-plugin's config.h.
---
 annocheck/meson.build    | 4 ++++
 clang-plugin/meson.build | 1 +
 gcc-plugin/meson.build   | 3 +++
 llvm-plugin/meson.build  | 1 +
 4 files changed, 9 insertions(+)

diff --git a/annocheck/meson.build b/annocheck/meson.build
index 679649c..8ba2245 100644
--- a/annocheck/meson.build
+++ b/annocheck/meson.build
@@ -50,6 +50,9 @@ annocheck = executable(
     toplevel_incdir,
     gcc_plugin_incdir,
   ],
+  c_args: [
+    '-DHAVE_CONFIG_H',
+  ],
 )
 
 libannocheck = shared_library(
@@ -77,6 +80,7 @@ libannocheck = shared_library(
   ],
   c_args: [
     '-DLIBANNOCHECK=1',
+    '-DHAVE_CONFIG_H',
   ],
   include_directories: [
     toplevel_incdir,
diff --git a/clang-plugin/meson.build b/clang-plugin/meson.build
index 8f2b6f2..0c415db 100644
--- a/clang-plugin/meson.build
+++ b/clang-plugin/meson.build
@@ -15,6 +15,7 @@ clang_plugin = custom_target(
   command: [
     clang,
     '@INPUT@',
+    '-I' + join_paths(meson.current_source_dir(), '..'),
     '-I' + join_paths(meson.current_build_dir(), '..'),
     '-lLLVM',
     '-lclang-cpp', # TODO: Is this correct?
diff --git a/gcc-plugin/meson.build b/gcc-plugin/meson.build
index 04b8ddf..e0ee998 100644
--- a/gcc-plugin/meson.build
+++ b/gcc-plugin/meson.build
@@ -9,6 +9,7 @@ cdata.set_quoted('PACKAGE_TARNAME', 'annobin-plugin')
 
 headers = [
   'memory.h',
+  'limits.h',
   'stdint.h',
   'stdlib.h',
   'strings.h',
@@ -23,6 +24,7 @@ foreach header : headers
 endforeach
 
 cdata.set10('HAVE_DEBUGINFOD', have_debuginfod)
+cdata.set10('HAVE_LIBDEBUGINFOD', have_debuginfod)
 
 # Our config.h
 configure_file(output: 'config.h', configuration: cdata)
@@ -64,6 +66,7 @@ gcc_plugin = custom_target(
     '@INPUT@',
     '-g', '-fPIC', '-DPIC', '-shared', '-nostdlib',
     '-DHAVE_CONFIG_H',
+    '-I' + join_paths(meson.current_source_dir(), '..'),
     '-I' + join_paths(meson.current_build_dir(), '..'),
     '-I' + join_paths(plugin_dev_path, 'include'),
     '-o', '@OUTPUT@',
diff --git a/llvm-plugin/meson.build b/llvm-plugin/meson.build
index e4377a4..17930b3 100644
--- a/llvm-plugin/meson.build
+++ b/llvm-plugin/meson.build
@@ -15,6 +15,7 @@ llvm_plugin = custom_target(
   command: [
     clang,
     '@INPUT@',
+    '-I' + join_paths(meson.current_source_dir(), '..'),
     '-I' + join_paths(meson.current_build_dir(), '..'),
     '-lLLVM',
     '-o', '@OUTPUT@',
-- 
2.48.1



More information about the Annobin mailing list