Can't Compile emptyExample From oF Github

Hi, so I’m getting into the oF distribution from Github finally as I want to target multiple platforms. I got some help installing it. Installed dependencies, codecs, and ran download_libs.sh. Compiled it and everything went fine. However when trying to compile an example it errors out. It’s the Android part of oF that’s having the problem. I just upgraded my NDK because I had an older version, but that still didn’t help. It can’t find the jni.h file but I searched and it’s there in the NDK directory.

Edit: I’m on Linux 64-bit, BTW.

It seems like there are many Android related changes coming up: https://github.com/openframeworks/openFrameworks/pull/5461

Have you seen those? The changes include documentation improvements.

@hamoid Hi there. I’m so ready for 1.0.0! I haven’t seen that. Looks really cool, right up my alley. While I’m trying to target Android, I’m just trying to compile a desktop example with oF github currently.

:slight_smile:

What’s exactly the error you want help with?

Sorry, are you saying oF github is broken because of the new changes?

And sorry about the wording of my last post.

I mean eventually I’ll be targeting Android, but right now I just want to get an example compiled for desktop. I guess it’s broken?

The error is that I can’t compile. It can’t find jni.h in the ndk but I’ve set the correct directory for it.

Edit: @hamoid Indeed it would seem that Android is broken in master. Again, sorry, I’m new to github. Thank you so much!

I got a bit confused, because you don’t need ndk or jni for the desktop, I think that’s only for Android. I don’t know why you get that kind of error.

This link describes how to run the GitHub version: https://github.com/openframeworks/openFrameworks/blob/master/INSTALL_FROM_GITHUB.md

Hey hamold. I did all those steps except the projectGenerator, no problem. oF compiled without any flaws, but I still can’t compile any example. From my understanding the github master includes all platforms, including Android.

Hi Daniel, what’s your IDE? Could you post the exact error message?

I’m just using make right now with it. Here’s what happens when I try to compile.

daniel@daniel-Aspire-V3-572G:~/Development/openFrameworks/apps/devApps/emptyExample$ make -j4HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libcurl glfw3 libpulse-simple alsa gl glu glew gtk±3.0 libmpg123
with PKG_CONFIG_LIBDIR=
Compiling OF library for Release
make[1]: Entering directory ‘/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project’
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libcurl glfw3 libpulse-simple alsa gl glu glew gtk±3.0 libmpg123
with PKG_CONFIG_LIBDIR=
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libcurl glfw3 libpulse-simple alsa gl glu glew gtk±3.0 libmpg123
with PKG_CONFIG_LIBDIR=
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libcurl glfw3 libpulse-simple alsa gl glu glew gtk±3.0 libmpg123
with PKG_CONFIG_LIBDIR=
Done!
make[1]: Leaving directory ‘/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project’

Compiling emptyExample for Release
make[1]: Entering directory ‘/home/daniel/Development/openFrameworks/apps/devApps/emptyExample’
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libcurl glfw3 libpulse-simple alsa gl glu glew gtk±3.0 libmpg123
with PKG_CONFIG_LIBDIR=
Compiling /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/ofApp.cpp
g++ -c -O3 -march=native -mtune=native -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/alsa -I/usr/include/GL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/daniel/Development/openFrameworks/libs/fmodex/include -I/home/daniel/Development/openFrameworks/libs/glm/include -I/home/daniel/Development/openFrameworks/libs/glm/include/glm -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/detail -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtc -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtx -I/home/daniel/Development/openFrameworks/libs/json/include -I/home/daniel/Development/openFrameworks/libs/kiss/include -I/home/daniel/Development/openFrameworks/libs/tess2/include -I/home/daniel/Development/openFrameworks/libs/utf8/include -I/home/daniel/Development/openFrameworks/libs/utf8/include/utf8 -I/home/daniel/Development/openFrameworks/libs/openFrameworks -I/home/daniel/Development/openFrameworks/libs/openFrameworks/events -I/home/daniel/Development/openFrameworks/libs/openFrameworks/video -I/home/daniel/Development/openFrameworks/libs/openFrameworks/utils -I/home/daniel/Development/openFrameworks/libs/openFrameworks/sound -I/home/daniel/Development/openFrameworks/libs/openFrameworks/types -I/home/daniel/Development/openFrameworks/libs/openFrameworks/math -I/home/daniel/Development/openFrameworks/libs/openFrameworks/app -I/home/daniel/Development/openFrameworks/libs/openFrameworks/3d -I/home/daniel/Development/openFrameworks/libs/openFrameworks/gl -I/home/daniel/Development/openFrameworks/libs/openFrameworks/communication -I/home/daniel/Development/openFrameworks/libs/openFrameworks/graphics -I/home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src -I/home/daniel/Development/openFrameworks/addons/ofxAndroid/src -MMD -MP -MF obj/linux64/Release/src/ofApp.d -MT obj/linux64/Release/src/ofApp.o -o obj/linux64/Release/src/ofApp.o -c /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/ofApp.cpp
Compiling /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/main.cpp
g++ -c -O3 -march=native -mtune=native -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/alsa -I/usr/include/GL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/daniel/Development/openFrameworks/libs/fmodex/include -I/home/daniel/Development/openFrameworks/libs/glm/include -I/home/daniel/Development/openFrameworks/libs/glm/include/glm -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/detail -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtc -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtx -I/home/daniel/Development/openFrameworks/libs/json/include -I/home/daniel/Development/openFrameworks/libs/kiss/include -I/home/daniel/Development/openFrameworks/libs/tess2/include -I/home/daniel/Development/openFrameworks/libs/utf8/include -I/home/daniel/Development/openFrameworks/libs/utf8/include/utf8 -I/home/daniel/Development/openFrameworks/libs/openFrameworks -I/home/daniel/Development/openFrameworks/libs/openFrameworks/events -I/home/daniel/Development/openFrameworks/libs/openFrameworks/video -I/home/daniel/Development/openFrameworks/libs/openFrameworks/utils -I/home/daniel/Development/openFrameworks/libs/openFrameworks/sound -I/home/daniel/Development/openFrameworks/libs/openFrameworks/types -I/home/daniel/Development/openFrameworks/libs/openFrameworks/math -I/home/daniel/Development/openFrameworks/libs/openFrameworks/app -I/home/daniel/Development/openFrameworks/libs/openFrameworks/3d -I/home/daniel/Development/openFrameworks/libs/openFrameworks/gl -I/home/daniel/Development/openFrameworks/libs/openFrameworks/communication -I/home/daniel/Development/openFrameworks/libs/openFrameworks/graphics -I/home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src -I/home/daniel/Development/openFrameworks/addons/ofxAndroid/src -MMD -MP -MF obj/linux64/Release/src/main.d -MT obj/linux64/Release/src/main.o -o obj/linux64/Release/src/main.o -c /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/main.cpp
Compiling /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidVideoGrabber.cpp
g++ -c -O3 -march=native -mtune=native -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/alsa -I/usr/include/GL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/daniel/Development/openFrameworks/libs/fmodex/include -I/home/daniel/Development/openFrameworks/libs/glm/include -I/home/daniel/Development/openFrameworks/libs/glm/include/glm -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/detail -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtc -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtx -I/home/daniel/Development/openFrameworks/libs/json/include -I/home/daniel/Development/openFrameworks/libs/kiss/include -I/home/daniel/Development/openFrameworks/libs/tess2/include -I/home/daniel/Development/openFrameworks/libs/utf8/include -I/home/daniel/Development/openFrameworks/libs/utf8/include/utf8 -I/home/daniel/Development/openFrameworks/libs/openFrameworks -I/home/daniel/Development/openFrameworks/libs/openFrameworks/events -I/home/daniel/Development/openFrameworks/libs/openFrameworks/video -I/home/daniel/Development/openFrameworks/libs/openFrameworks/utils -I/home/daniel/Development/openFrameworks/libs/openFrameworks/sound -I/home/daniel/Development/openFrameworks/libs/openFrameworks/types -I/home/daniel/Development/openFrameworks/libs/openFrameworks/math -I/home/daniel/Development/openFrameworks/libs/openFrameworks/app -I/home/daniel/Development/openFrameworks/libs/openFrameworks/3d -I/home/daniel/Development/openFrameworks/libs/openFrameworks/gl -I/home/daniel/Development/openFrameworks/libs/openFrameworks/communication -I/home/daniel/Development/openFrameworks/libs/openFrameworks/graphics -I/home/daniel/Development/openFrameworks/addons/ofxAndroid/src -MMD -MP -MF /home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidVideoGrabber.d -MT /home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidVideoGrabber.o -o /home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidVideoGrabber.o -c /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidVideoGrabber.cpp
Compiling /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidAccelerometer.cpp
g++ -c -O3 -march=native -mtune=native -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/alsa -I/usr/include/GL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/daniel/Development/openFrameworks/libs/fmodex/include -I/home/daniel/Development/openFrameworks/libs/glm/include -I/home/daniel/Development/openFrameworks/libs/glm/include/glm -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/detail -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtc -I/home/daniel/Development/openFrameworks/libs/glm/include/glm/gtx -I/home/daniel/Development/openFrameworks/libs/json/include -I/home/daniel/Development/openFrameworks/libs/kiss/include -I/home/daniel/Development/openFrameworks/libs/tess2/include -I/home/daniel/Development/openFrameworks/libs/utf8/include -I/home/daniel/Development/openFrameworks/libs/utf8/include/utf8 -I/home/daniel/Development/openFrameworks/libs/openFrameworks -I/home/daniel/Development/openFrameworks/libs/openFrameworks/events -I/home/daniel/Development/openFrameworks/libs/openFrameworks/video -I/home/daniel/Development/openFrameworks/libs/openFrameworks/utils -I/home/daniel/Development/openFrameworks/libs/openFrameworks/sound -I/home/daniel/Development/openFrameworks/libs/openFrameworks/types -I/home/daniel/Development/openFrameworks/libs/openFrameworks/math -I/home/daniel/Development/openFrameworks/libs/openFrameworks/app -I/home/daniel/Development/openFrameworks/libs/openFrameworks/3d -I/home/daniel/Development/openFrameworks/libs/openFrameworks/gl -I/home/daniel/Development/openFrameworks/libs/openFrameworks/communication -I/home/daniel/Development/openFrameworks/libs/openFrameworks/graphics -I/home/daniel/Development/openFrameworks/addons/ofxAndroid/src -MMD -MP -MF /home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidAccelerometer.d -MT /home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidAccelerometer.o -o /home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidAccelerometer.o -c /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidAccelerometer.cpp
/home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidAccelerometer.cpp:8:17: fatal error: jni.h: No such file or directory
compilation terminated.
/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target ‘/home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidAccelerometer.o’ failed
make[1]: *** [/home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidAccelerometer.o] Error 1
make[1]: *** Waiting for unfinished jobs…
In file included from /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidApp.h:13:0,
from /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroid.h:11,
from /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/ofApp.h:4,
from /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/main.cpp:2:
/home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidUtils.h:10:17: fatal error: jni.h: No such file or directory
compilation terminated.
/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:221: recipe for target ‘obj/linux64/Release/src/main.o’ failed
make[1]: *** [obj/linux64/Release/src/main.o] Error 1
In file included from /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidVideoGrabber.cpp:8:0:
/home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidVideoGrabber.h:15:17: fatal error: jni.h: No such file or directory
compilation terminated.
/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target ‘/home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidVideoGrabber.o’ failed
make[1]: *** [/home/daniel/Development/openFrameworks/addons/obj/linux64/Release/ofxAndroid/src/ofxAndroidVideoGrabber.o] Error 1
In file included from /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidApp.h:13:0,
from /home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroid.h:11,
from /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/ofApp.h:4,
from /home/daniel/Development/openFrameworks/apps/devApps/emptyExample/src/ofApp.cpp:1:
/home/daniel/Development/openFrameworks/addons/ofxAndroid/src/ofxAndroidUtils.h:10:17: fatal error: jni.h: No such file or directory
compilation terminated.
/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:221: recipe for target ‘obj/linux64/Release/src/ofApp.o’ failed
make[1]: *** [obj/linux64/Release/src/ofApp.o] Error 1
make[1]: *** wait: No child processes. Stop.
/home/daniel/Development/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:124: recipe for target ‘Release’ failed
make: *** [Release] Error 2
daniel@daniel-Aspire-V3-572G:~/Development/openFrameworks/apps/devApps/emptyExample$

I don’t see the apps/devApps/emptyExample folder in the OF repo. Did you create that? It seems like your example is using ofxAndroid. What if you run examples/3d/3DPrimitivesExample ?

Ps. I never touched the devApps folder…

I didn’t create it, no. Oh wow, now that you mention it, in the addons.make file I see ofxAndroid there. Odd.

3DPrimitivesExample compiled and linked successfully. Thanks.

But does this mean it’s broken for Android? My project relys on the Raspberry Pi and Android.

Edit: How does crossplatform development work in oF? Like can I create a project with the projectGenerator to target both Arm6 and Android? I noticed that there’s ofGetTargetPlatform() which returns an int based on what platform the app is running on. It feels like it would be intuitive to have platform specific code being determined and run based on that function.

Sorry if this is off-topic.

If the devApps folder doesn’t contain an emptyExample in GitHub and that folder hasn’t been touched in 6 months, I wonder how did that show up in yours…

Since it seems like you can compile examples in the examples folder, to keep things on topic, maybe it’s best to read threads in the forum about Android and Raspberry Pi and start new ones if necessary. I can’t help with those :slight_smile:

Ah, thanks hamold.