Compiling Libraw with RawSpeed

I'm trying to have libraw with rawspeed support (ubuntu 22.04), but I can not manage to make it work.

Here's what I'm doing so far,
I have folder parent/ where I put Libraw-0.20.0 and 'rawpseed-master' renamed to 'RawSpeed'. (I have two folders, parent/LibRaw-0.20.0 and parent/RawSpeed).

For RawSpeed :
-copy/paste the patches from parent/LibRaw-0.20.0/RawSpeed/ to parent/RawSpeed/RawSpeed,

-execute commands :"patch < rawspeed.cpucount-unix.patch", "patch < rawspeed.qmake-pro-files.patch" and then "qmake -makefile rawspeed-lib.pro"

-A makefile is created, I just have to modify the libxml2 include file from "/usr/local/include/libxml2" to "/usr/include/libxml2" before running "make". The make command works without errors. so far I think things are done correctly.

Then, for Libraw:
-Modify the "Makefile.dist" by uncommenting the 2 lines after #RawSpeed support (and modifying "/usr/local/include/libxml2" to "/usr/include/libxml2" in my case)

-Run "make -f Makefile.dist". Files are getting compiled without any errors.

Then the README.RawSpeed.txt file does not give hints next, so I just do "sudo make -f Makefile.dist install" and I try to use it with my program but I get an error (CmakeLists.txt pkg_search_module cannot find 'libraw').

I also tried to compile Libraw without Rawspeed to make sure it was working in the first place (running autoreconf, configure and make) and it works properly.

Any idea what I'm doing wrong here? I'm not really familar with makefile stuff.

Forums: 

Makefile.dist does not

Makefile.dist does not contain any reference to CMake/CMakeLists.txt so I do not know what the problem source is, sorry.

-- Alex Tutubalin @LibRaw LLC

once I "make -f makefile.dist

once I "make -f makefile.dist", how am I supposed to use the libraw/rawspeed compiled code with my code?

I made a small test code

I made a small test code sample which is simply reading a .cr2 image using libraw. When doing make -f makefile.dist and then compiling my code with "-lraw" I get this error message. https://pastebin.com/rjcuut1d

Although your code is in "C"

Although your code is in "C" and you're (most probably) using LibRaw C-API, LibRaw itself is created in C++ so it needs C++ standard library to be linked with.

-- Alex Tutubalin @LibRaw LLC

Also, you need to add

Also, you need to add librawspeed.a to linker input.

-- Alex Tutubalin @LibRaw LLC

Yes I'm using C code only. I

Yes I'm using C code only. I understand why I won't work the way I do, however I'm not familiar at all with this.

Do you mind explaining me in more details the steps? Thanks.