Somehow, from one build to another, FreeImage.h is lost?

I am building my project for the most of the day from the command line (make Debug), and it was building fine (Ubuntu Linux). Then I tried adding some define variables to config.make, it didn’t quite turn out as I wanted (although it did build), so I restored files from git. And now, suddenly, I cannot compile anymore:

/path/to/openFrameworks/libs/openFrameworks/graphics/ofImage.cpp:5:23: fatal error: FreeImage.h: No such file or directory

However, file is there:

$ find openFrameworks/ -name FreeImage.h

I can see that openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/ has:


… which means it should be excluded? But, that file is like that, untouched?

What could have possibly happened?

EDIT: Now I can’t even compile via:

cd openFrameworks/scripts/linux/

… with the same error - and usually that was the first thing that worked?

What the hell happened…

I think I figured out what happened - I had my openFrameworks folder in the same location for both my Ubuntu 32-bit, and for my Ubuntu 64-bit. The Ubuntu 32-bit probably had sudo apt-get install libfreeimage-dev installed, while the 64-bit didn’t, and so generated the above message - once I installed libfreeimage-dev, the file could compile - but it is probably better to build freeimage via apothecary, as noted here: Building the FreeImage lib for PIE and armv7 … except there’s no linux64 target in the apothecary formula:

apothecary$ ./apothecary -t linux64 FreeImage
 Missing lib build target (maybe you wanted "core"). See help: 'apothecary -h'.

… however, it looks like the library will download with this hack in the formula:

--- formulas/FreeImage/    2017-09-28 20:04:34.795745288 +0200
+++ formulas/FreeImage/    2017-09-28 19:55:12.325557715 +0200
@@ -7,7 +7,7 @@
 # Makefile build system, 
 # some Makefiles are out of date so patching/modification may be required
-FORMULA_TYPES=( "osx" "vs" "win_cb" "ios" "android" "emscripten")
+FORMULA_TYPES=( "osx" "vs" "win_cb" "ios" "android" "emscripten" "linux64")
 # define the version
 VER=3170 # 3.16.0
@@ -335,6 +335,8 @@
         mv libfreeimage.a $BUILD_DIR/FreeImage/Dist/
         cd $BUILD_DIR/FreeImage
         #rm -rf $BUILD_DIR/FreeImagePatched
+    elif [ "$TYPE" == "linux64" ] ; then
+    make -j${PARALLEL_MAKE} -f Makefile.gnu
@@ -387,6 +389,11 @@
         mkdir -p $1/lib/$TYPE
         cp -rv Dist/libfreeimage.a $1/lib/$TYPE/
+    elif [ "$TYPE" == "linux64" ] ; then
+      cp -v Dist/*.h $1/include
+      mkdir -p $1/lib/$TYPE
+      cp -v Dist/libfreeimage.a $1/lib/$TYPE/
+      #~ cp -v Dist/libfreeimage*.so $1/lib/$TYPE/
     # copy license files

… and stuff seems to compile with this - but it won’t link… EDIT: actually, the linux64 build does not link, if I repeat the build process for Android, then it links - I think the reason is that in for an android build, in the link step, the static library openFrameworks/libs/FreeImage/lib/android/armeabi-v7a/libfreeimage.a is included directly - while for the linux64 build, we have -lfreeimage, which would require a shared object library to be present on the system. I think that might be due to the entry in openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/


… and for instance openFrameworks/libs/openFrameworksCompiled/project/ios/CoreOF.xcconfig has:

LIB_FREEIMAGE = "$(OF_PATH)/libs/FreeImage/lib/ios/freeimage.a"

… while I think the relevant for Android is in openFrameworks/libs/openFrameworksCompiled/project/android/.cproject:

<option id="" name="Libraries (-l)" superClass="" valueType="libs">
  ... <listOptionValue builtIn="false" value="freeimage"/>

… and so, if I hack the file like this (note, commenting PLATFORM_CORE_EXCLUSIONS is important, otherwise the correct include specifications are not generated):

--- openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/    2017-09-28 20:39:51.905910340 +0200
+++ openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/    2017-09-28 22:05:20.288516465 +0200
@@ -248,7 +248,7 @@
@@ -311,7 +311,7 @@
     PLATFORM_LIBRARIES += pthread
 PLATFORM_LIBRARIES += boost_filesystem
 PLATFORM_LIBRARIES += boost_system
@@ -328,6 +328,7 @@
 # shared libraries 

… then finally also the linux64 builds fine, and uses the previously apothecary-build static library.