Skip to content

Instantly share code, notes, and snippets.

@nicnilov
Last active May 14, 2022 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicnilov/3b8b9834110e490244ac7f22fca2bfbf to your computer and use it in GitHub Desktop.
Save nicnilov/3b8b9834110e490244ac7f22fca2bfbf to your computer and use it in GitHub Desktop.
Compile DCamProf under macOS Big Sur

Prerequisites

  1. DCamProf source (1.0.6 is the latest)
  2. Clang compiler with openmp support
  3. little-cms2
  4. libtiff

Under macOS with XCode installed typically the compiler picked up is the one shipped with XCode. It does not support openmp:

$ make

gcc -o dcamprof.o -c -I. -Wall -std=c99 -g -O2 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -fopenmp  -DDCAMPROF_VERSION=\"1.0.6\" dcamprof.c
clang: error: unsupported option '-fopenmp'
make: *** [dcamprof.o] Error 1

Use a brew-installed gcc. Figure out which version is installed:

$ brew list gcc

...
/usr/local/Cellar/gcc/11.3.0/bin/gcc-11
...

Open the DCamProf Makefile and modify the CC variable:

CC= gcc-11

Install LittleCMS 2 if not installed yet, figure out its location:

$ brew info little-cms2

...
/usr/local/Cellar/little-cms2/2.13.1 (21 files, 1.3MB) *
...

Similarly, make sure libtiff is installed, figure out its location:

$ brew info libtiff

...
/usr/local/Cellar/libtiff/4.3.0 (249 files, 4.4MB) *
...

Update DCamProf Makefile to point out to the Include and Lib paths of either:

...
INCLUDE = -I. -I/usr/local/Cellar/little-cms2/2.13.1/include -I/usr/local/Cellar/libtiff/4.3.0/include
...
$(CC) -o $@ $(LDFLAGS) $(DCAMPROF_OBJS) -L /usr/local/Cellar/little-cms2/2.13.1/lib -llcms2 -L/usr/local/Cellar/libtiff/4.3.0/lib -ltiff -lm
...

Compile DCamProf:

$ make

Run DCamProf:

$ ./dcamprof -v

Program version: 1.0.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment