Dependencies missing on Arch [emergency fix works]

That is certainly one way of going about it. However, I don’t know how easy or hard that would be - I think there have been some substantial refactoring/changes to the rawspeed codebase since…

…surprisingly so the merge was more or less no problem (very few conflicts in irrelevant places). i think all the testing/fuzzing is left broken, but switching that off during cmake at least seems to build fine [edit: maybe i spoke too soon, there seem to be build problems still]. will fix/test a bit and might push.

2 Likes

@kmilos do you have any intuition whether the CR3 pull request is something that would be merged upstream at some point? i didn’t follow the discussion closely but remember it to be somewhat controversial, i don’t want to restart the github discussion if there is no interest for this. also i don’t think i will be able to maintain a fork with the merge for long (had no time to try and fix things yet).

Can’t really comment on this, sorry.

“emergency fix” by just simply updating to vanilla rawspeed (without CR3), if you have to:

git clone --recursive https://github.com/hanatos/vkdt.git
git checkout rawspeed-upstream
git submodule sync
git submodule update --force

and then run a regular build like make or cd bin/ and then make.

1 Like

Thanks. That indeed makes the rawspeed submodule build w/ more recent Clang.

Next, on Windows MSYS2 CLANG64, I’m seeing this:

clang -Wall -pipe -I. -D_GNU_SOURCE -std=c11 -DVK_ENABLE_BETA_EXTENSIONS -fPIC -Wall -pipe -O3 -march=native -DNDEBUG   -c cli/main.c -o cli/main.o
In file included from cli/main.c:1:
In file included from ./qvk/qvk.h:20:
./core/core.h:28:13: error: call to undeclared library function 'aligned_alloc' with type 'void
      *(unsigned long long, unsigned long long)'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  void *n = aligned_alloc(32, nsize);
            ^
./core/core.h:28:13: note: include the header <stdlib.h> or explicitly provide a declaration for
      'aligned_alloc'
1 error generated.
make[1]: *** [Makefile:83: cli/main.o] Error 1

I guess on this platform only _aligned_malloc() is available, and would need to detect this and handle it in code.

wait you’re trying to build a windows version or cross compiling for linux on windows? i would forsee more trouble in the first case :slight_smile:

anyhow core.h does include <stdlib.h> (in line 3). is this one of the intricacies of the windows header set? in this case it’s probably necessary to ifdef our way around it. this is the only occurrence.

(beware of force pushes to this hotfix branch, sorry for my bad dev practices)

Yep, as mentioned, it’s a platform specific thing. Just for kicks, I’m trying out a native Windows build using MSYS2 CLANG64 (which also pretty straightforward to add to your CI).

1 Like

great. let me know how this goes and if i can help. i think there was something about dirent/posix stuff that needed working around, and something about windows filesystems and symlinks (needed for tags).

there is also the occasional getenv("HOME") that i don’t know what it does on windows. overall the core functionality should be platform independent though.

Next one: :wink:

clang -Wall -pipe -I. -D_GNU_SOURCE -std=c11 -DVK_ENABLE_BETA_EXTENSIONS -fPIC -Wall -pipe -O3 -march=native -DNDEBUG  -c core/threads.c -o core/threads.o
core/threads.c:7:10: fatal error: 'sys/syscall.h' file not found
#include <sys/syscall.h>
         ^~~~~~~~~~~~~~~
1 error generated.

Unfortunately I’m not actively going to send patches because of time restrictions (and not comfortable w/ the barebones Makefiles build system anyway*), can only test occasionally like this and provide feedback. So you might want to just add TODO/FIXME comments straight in the code for these in the meantime…

* I think CMake or Meson would be an advantage here as they could handle a lot of the platform specific macros and compiler/linker options for you.

hm maybe i actually removed the syscall in the meantime? i think it compiles without this header.

/me takes notes.

Without it, the next one:

clang -Wall -pipe -I. -D_GNU_SOURCE -std=c11 -DVK_ENABLE_BETA_EXTENSIONS -fPIC -Wall -pipe -O3 -march=native -DNDEBUG  -c core/threads.c -o core/threads.o
core/threads.c:231:21: error: call to undeclared function 'sysconf'; ISO C99 and later do not
      support implicit function declarations [-Wimplicit-function-declaration]
  thr.num_threads = sysconf(_SC_NPROCESSORS_ONLN);
                    ^
core/threads.c:231:29: error: use of undeclared identifier '_SC_NPROCESSORS_ONLN'
  thr.num_threads = sysconf(_SC_NPROCESSORS_ONLN);
                            ^
2 errors generated.

I guess MinGW’s unistd.h doesn’t have those, and a Windows system call is to be used.

thanks for the pointer, pushed.

Ensuite:

clang -Wall -pipe -I. -D_GNU_SOURCE -std=c11 -DVK_ENABLE_BETA_EXTENSIONS -fPIC -Wall -pipe -O3 -march=native -DNDEBUG   -c pipe/global.c -o pipe/global.o
In file included from pipe/global.c:6:
./core/fs.h:2:10: fatal error: 'dlfcn.h' file not found
#include <dlfcn.h>
         ^~~~~~~~~
1 error generated.

dlfcn doesn’t exist on Windows. For loadable modules, see e.g. how libheif did it (plugins_unix and plugins_windows) without depending on e.g. glib. (Or look at GitHub - dlfcn-win32/dlfcn-win32: Official dlfcn-win32 repo)

I think that’s it for me for now, I’m attaching my git diff so far:
vkdt_windows1.zip (1006 Bytes)

W/ dlfcn-win32 installed, the next one (seems filesystem related as you suspected):

clang -Wall -pipe -I. -D_GNU_SOURCE -std=c11 -DVK_ENABLE_BETA_EXTENSIONS -fPIC -Wall -pipe -O3 -march=native -DNDEBUG   -c pipe/global.c -o pipe/global.o
In file included from pipe/global.c:6:
./core/fs.h:3:10: fatal error: 'link.h' file not found
#include <link.h>
         ^~~~~~~~
1 error generated.

@Claes Apologies for hijacking this for a bit, I’ll let you carry on w/ building on Arch now. :wink:

1 Like

great, thanks so far!

1 Like

Thank you!
Your emergency fix™ works fine. Now I can compile error-free on Arch.

If anyone is having trouble getting this to compile… when switching to a branch with a different rawspeed commit it’s not sufficient to only run “make clean” in vkdt/bin before compiling. You also need to delete the contents of vkdt/built so that it gets recreated.

2 Likes