QuickJS - FLTK, ffi - Hello World

Поділитися
Вставка
  • Опубліковано 16 вер 2024

КОМЕНТАРІ • 3

  • @KajiTetsushi
    @KajiTetsushi 2 роки тому

    11:09 C novice here. I had an additional host of issues compiling quickjs-ffi. I'm on macOS.
    1. Missing FFI header.
    fatal error: 'ffi.h' file not found
    To unblock myself here, I have to include another directory to any ffi.h in my machine.
    2. Missing GNU C Library (glibc) shared libraries header.
    fatal error: 'gnu/lib-names.h' file not found
    The official docs, Homebrew, StackOverflow, HackerNews, all lead to the conclusion that glibc needs Linux.
    From what I read, FLTK is cross-platform. It's QuickJS FFI that isn't. Guess I'll have to find other ways...

    • @MarkoTasic
      @MarkoTasic  2 роки тому

      1. It seams that you need libffi. I cannot help about macOS because I haven't tired it yet. I usually install only available packages on homebrew (brew) when I work on macOS.
      2. Try to install gcc using homebrew and then check if it compiles. Are you using clang or gcc?

    • @KajiTetsushi
      @KajiTetsushi 2 роки тому

      @@MarkoTasic Thanks for getting back to me.
      I'm gonna rubber-duck here.
      1. Yep, I did "brew install libffi" when I posted the initial comment. And it works.
      I forgot to mention that. I was simply writing out my thought process of how I got here. Truth be told, I could also use the ffi header that was shipped with Xcode if I didn't want to "brew install libffi". The compiler will still allow it. Where I get the ffi doesn't matter very much right now as long as the major version of ffi.h is 3.x.x.
      2. I used the Xcode built-in gcc first without realizing it was actually clang under the hood. I switched to a Homebrew-based install gcc-10 (then gcc-11) from brew and even tweaked the Makefile to use it. Unfortunately, it yields the same results.
      I believe the root cause of the issue goes back to "gnu/lib-names.h" (glibc) being *not* available on any other platform except Linux. Removing this include leads to the compiler throwing undefined LIBC_SO, LIBM_SO, RTLD_DEEPBIND from the quickjs-ffi.c code, which means that it has to come from somewhere (in this case, glibc).
      Is there a macOS equivalent, I wonder...