cross-posted from: https://lemmy.ml/post/17545833

im new to system programming, idk if thats the issuse. but according gcc, it can not find dbus/dbus-arch-deps.h and thats all i know. any idea about this issue?

 program
[I] tomri@artix ~ [1]> cat main.c
#include <dbus-1.0/dbus/dbus.h>

int main(void) { return 0; }
# error
[I] tomri@artix ~> gcc main.c
In file included from main.c:1:
/usr/include/dbus-1.0/dbus/dbus.h:29:10: fatal error: dbus/dbus-arch-deps.h: No such file or directory
   29 | #include <dbus/dbus-arch-deps.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[I] tomri@artix ~> ls -la /usr/include/dbus-1.0/dbus/
total 216
drwxr-xr-x 2 root root  4096 Jul  2 20:26 ./
drwxr-xr-x 3 root root  4096 Jun 15 21:36 ../
-rw-r--r-- 1 root root  2809 Jan 14 06:17 dbus-address.h
-rw-r--r-- 1 root root  3470 Jan 14 06:17 dbus-bus.h
-rw-r--r-- 1 root root 27018 Jan 14 06:17 dbus-connection.h
-rw-r--r-- 1 root root  2909 Jan 14 06:17 dbus-errors.h
-rw-r--r-- 1 root root 22076 Jun  8  2023 dbus-glib-bindings.h
-rw-r--r-- 1 root root  2575 Jun  8  2023 dbus-glib-lowlevel.h
-rw-r--r-- 1 root root 14766 Jun  8  2023 dbus-glib.h
-rw-r--r-- 1 root root  8969 Jun  8  2023 dbus-gtype-specialized.h
-rw-r--r-- 1 root root  1464 Jun  8  2023 dbus-gvalue-parse-variant.h
-rw-r--r-- 1 root root  7246 Jan 14 06:17 dbus-macros.h
-rw-r--r-- 1 root root  1961 Jan 14 06:17 dbus-memory.h
-rw-r--r-- 1 root root 15259 Jan 14 06:17 dbus-message.h
-rw-r--r-- 1 root root  1810 Jan 14 06:17 dbus-misc.h
-rw-r--r-- 1 root root  3809 Jan 14 06:17 dbus-pending-call.h
-rw-r--r-- 1 root root 23956 Jan 14 06:17 dbus-protocol.h
-rw-r--r-- 1 root root  5412 Jan 14 06:17 dbus-server.h
-rw-r--r-- 1 root root  5392 Jan 14 06:17 dbus-shared.h
-rw-r--r-- 1 root root  3047 Jan 14 06:17 dbus-signature.h
-rw-r--r-- 1 root root  2359 Jan 14 06:17 dbus-syntax.h
-rw-r--r-- 1 root root  8505 Jan 14 06:17 dbus-threads.h
-rw-r--r-- 1 root root  4143 Jan 14 06:17 dbus-types.h
-rw-r--r-- 1 root root  3961 Jan 14 06:17 dbus.h
[I] tomri@artix ~> 
# my system
[I] tomri@artix ~> uname --all
Linux artix 6.9.7-artix1-1 #1 SMP PREEMPT_DYNAMIC Fri, 28 Jun 2024 18:11:28 +0000 x86_64 GNU/Linux
  • BB_C@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    2 days ago
    % pkg-config --cflags dbus-1
    -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
    % pkg-config  --libs dbus-1
    -ldbus-1
    
    gcc main.c `pkg-config --cflags --libs dbus-1`
    

    You don’t need to link against the library yet, but you will.

    Linking might become a separate step when you have multiple files, not just main.

    • t0mri@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      pkg-config --cflags --libs dbus-1

      thanks! this allows me compile my program with no error. why gcc couldnt do this automatically? i mean its supposed to do this right? and another important issue that clang ls (language server) showed the same error? i thought fixing this would fix that too, but that isnt the case here. without clang ls running i wont get any auto completions. thanks again