LibRaw on RPi

Hello,

Can LibRaw be installed on a Raspberry Pi (running Raspbian or some other Linux flavor)? My apologies if this is a simple question - I had a look here (https://www.libraw.org/docs/Install-LibRaw-eng.html), but am a bit inexperienced with compiling and installing packages from source, and am not sure if the RPi hardware/OS is compatible (especially re. its processor architecture). Thank you!

Mike

Forums: 

The easy way to install is:

The easy way to install is:

> sudo apt update
> sudo apt upgrade
> sudo apt install libraw-dev

To compile, install git, and after that:

> git clone https://github.com/LibRaw/LibRaw.git
> cd LibRaw/
> make -f Makefile.dist

To check,

> bin/dcraw_emu

--
Iliah Borg

Just to clarify

Thank you for the helpful information! So it seems LibRaw can be installed on an RPi - this is great!

Just to clarify, in the case where both options are available (apt install or compiling), is there a reason why I would choose one over the other (e.g. will the compiling option give me a newer version)?

Additionally, re. compiling, I found these instructions on rawpy's website (a package I'm hoping to use), which look similar to the instructions you provided above, but there are some differences - will either set of instructions work?

git clone https://github.com/LibRaw/LibRaw.git libraw
git clone https://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cd libraw
git checkout 0.20.0
cp -R ../libraw-cmake/* .
cmake .
sudo make install

> it seems LibRaw can be

> it seems LibRaw can be installed on an RPi

Why "seems", I checked with my RPi before posting.

Which method of installation to use depends on your needs.

Generally if you want a package (rawpy in your case), it's a good idea to follow the instructions accompanying the package, especially when those instructions refer to a particular (not the latest) version of a library. You will need to install git and cmake,

> sudo apt update
> sudo apt upgrade
> sudo apt install git
> sudo apt install cmake

After LibRaw is installed the way rawpi instructions suggest, check

> echo $LD_LIBRARY_PATH

If it's empty, and you want to use LibRaw independently / check the installation:

> LD_LIBRARY_PATH=/usr/local/lib
> export LD_LIBRARY_PATH

--
Iliah Borg

Apologies and thank you!

My apologies re. "seems" - I did not intend to cast doubt on your reply. Thank you very much for all the helpful information, and for checking these installation instructions on your own RPi - that is greatly appreciated! I am looking forward to using LibRaw.

Re "seems" - I was half

Re "seems" - I was half-joking, I got your meaning, but wanted to make it clear to readers that I checked the things.
Good luck!

--
Iliah Borg

No problem! One additional question ...

Yep, no problem! One final question about all this for my own edification - my initial confusion about whether LibRaw could be installed on an RPi stemmed from here, which states "LibRaw has been tested on 32- and 64-bit Unix systems working on x86- (and AMD64-) compatible processors.". I am admittedly inexperienced with this, but I believe the RPi is ARM-based, so I wasn't sure if it was included on that list of tested systems. Please let me know if I've misunderstood. Thank you!

RPi is indeed ARM-based, and

RPi is indeed ARM-based, and we never performed extensive LibRaw testing on RPi. Based on my quick test, based on the fact that LibRaw is among Raspberry Pi libs packages (can be installed using apt), and based on experience of many RPi users, it does work.

--
Iliah Borg

Confirming install was correct

Hi - I just wanted to confirm I installed from source correctly. Below is the terminal output resulting from my cmake command. As you'll note, it indicates a few files were not found. Additionally, can I remove the ~/Desktop/libraw folder I created to clone the libraw repo?

cmake .
-- CMake version: 3.18.4
-- LibRaw string version: 0.20.0
-- LibRaw ID version: 0x0200
-- LibRaw SO version: 20.0.0
-- The CXX compiler identification is GNU 10.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for LCMS2 availability...
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'lcms2'
-- No package 'lcms2' found
-- lcms2 NOT found
-- Check for LCMS availability instead LCMS2...
-- Checking for module 'lcms'
-- No package 'lcms' found
-- Could NOT find LCMS (missing: LCMS_LIBRARIES LCMS_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.11")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES)
--
-- ----------------------------------------------------------------------------------
-- Libraw 0.20.0 configuration
--
-- Libraw will be compiled with OpenMP support .................. YES
-- Libraw will be compiled with LCMS support .................... NO
-- Libraw will be compiled with example command-line programs ... YES
-- Libraw will be compiled with RedCine codec support ........... NO
-- Libraw will be compiled with DNG deflate codec support ....... YES
-- Libraw will be compiled with DNG lossy codec support ......... NO
-- Libraw will be compiled with RawSpeed support ................ NO
-- Libraw will be compiled with debug message from dcraw ........ NO
-- Libraw will be compiled with Foveon X3F support .............. NO
-- Libraw will be compiled with Raspberry Pi RAW support ........ NO
-- Libraw will be compiled as a shared library
-- ----------------------------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/Desktop/libraw/libraw

We dropped Cmake support in

We dropped Cmake support in LibRaw in 2014, so we do not know what cmake scripts you use and what they do and whether it is correct or not.

Supported build methods are ./configure && make and also just make -f Makefile.dist

-- Alex Tutubalin @LibRaw LLC

Thank you for the reply. I

Thank you for the reply. I followed the instructions (below) provided by rawpy (which uses LibRaw), as suggested by Iliah Borg (see further up for this discussion). Should I instead follow the LibRaw provided instructions?

git clone https://github.com/LibRaw/LibRaw.git libraw
git clone https://github.com/LibRaw/LibRaw-cmake.git libraw-cmake
cd libraw
git checkout 0.20.0
cp -R ../libraw-cmake/* .
cmake .
sudo make install

> it indicates a few files

> it indicates a few files were not found.

No, it indicates that you haven't installed some optional libraries before running cmake, and haven't selected some options. You can ask at rawpy if they use those options.

--
Iliah Borg

Thanks - the rawpy folks

Thanks - the rawpy folks mentioned the terminal output all looks fine, but that perhaps I should try again and enable the RPi RAW support. When compiling LibRaw I made the folder ~/Desktop/libraw into which I cloned the LibRaw repo.

- Can I remove that folder and try compiling again, or were LibRaw files installed elsewhere that need to be removed?
- In the future, what folder do you recommend I clone the LibRaw repo into?

Dear Sir:

Dear Sir:

Since your goal is to make rawpy work, please follow suggestions from rawpy folks.

RPi raw support is for Raspberry cameras only.

--
Iliah Borg