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
/path/to/openFrameworks/scripts/apothecary/ostype.sh
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 FreeImage.sh
formula:
--- formulas/FreeImage/FreeImage.sh.old 2017-09-28 20:04:34.795745288 +0200
+++ formulas/FreeImage/FreeImage.sh 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
fi
}
@@ -387,6 +389,11 @@
fi
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/
fi
# 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/config.linux.common.mk
:
PLATFORM_LIBRARIES += freeimage
… 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="gnu.cpp.link.option.libs.635402611" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
... <listOptionValue builtIn="false" value="freeimage"/>
… and so, if I hack the config.linux.common.mk
file like this (note, commenting PLATFORM_CORE_EXCLUSIONS
is important, otherwise the correct include specifications are not generated):
--- openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/config.linux.common.mk.orig 2017-09-28 20:39:51.905910340 +0200
+++ openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/config.linux.common.mk 2017-09-28 22:05:20.288516465 +0200
@@ -248,7 +248,7 @@
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/quicktime/%
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/videoInput/%
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/freetype/%
-PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/FreeImage/%
+#PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/FreeImage/%
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/assimp/%
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/glut/%
PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/rtAudio/%
@@ -311,7 +311,7 @@
PLATFORM_LIBRARIES += pthread
endif
-PLATFORM_LIBRARIES += freeimage
+#PLATFORM_LIBRARIES += freeimage
PLATFORM_LIBRARIES += rtaudio
PLATFORM_LIBRARIES += boost_filesystem
PLATFORM_LIBRARIES += boost_system
@@ -328,6 +328,7 @@
PLATFORM_STATIC_LIBRARIES += $(OF_LIBS_PATH)/poco/lib/$(ABI_LIB_SUBPATH)/libPocoJSON.a
PLATFORM_STATIC_LIBRARIES += $(OF_LIBS_PATH)/poco/lib/$(ABI_LIB_SUBPATH)/libPocoXML.a
PLATFORM_STATIC_LIBRARIES += $(OF_LIBS_PATH)/poco/lib/$(ABI_LIB_SUBPATH)/libPocoFoundation.a
+PLATFORM_STATIC_LIBRARIES += $(OF_LIBS_PATH)/FreeImage/lib/$(ABI_LIB_SUBPATH)/libfreeimage.a
# shared libraries
PLATFORM_SHARED_LIBRARIES =
… then finally also the linux64
builds fine, and uses the previously apothecary-build static library.