Can't compile examples on ubuntu 18.04

Hi there.

Not new to programming but starting my oF journey through my degree at uni.
But I’ve hit a a roadblock.
After following the install instructions for linux, when I go to try and compile one of the example projects (have tried multiple) I get a very infuriating and nondescript error (pasted below).
I have tried with multiple gcc/g++ versions 4,5,6 and 7 (7.3, being the one currently included with ubuntu) each with the corresponding download versions, each installing the dependencies freshly each time and now on two entirely different machines!
Out of desperation I also tried the master and patched branch on Github.
Same Error.
I also get this error when compiling the ProjectGenerator.
What am I doing wrong? Tis strange because it seems others have successfully compiled on 18.04.

ERROR:

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 libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123 
with PKG_CONFIG_LIBDIR=
Compiling OF library for Release
make[1]: Entering directory '/home/bevis/.local/bin/oF/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 libcurl glfw3 rtaudio 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 libcurl glfw3 rtaudio 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 libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123 
with PKG_CONFIG_LIBDIR=
Done!
make[1]: Leaving directory '/home/bevis/.local/bin/oF/libs/openFrameworksCompiled/project'


Compiling polygonExample for Release
make[1]: Entering directory '/home/bevis/.local/bin/oF/examples/graphics/polygonExample'
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 libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123 
with PKG_CONFIG_LIBDIR=
Linking bin/polygonExample for linux64
g++ -o bin/polygonExample    /home/bevis/.local/bin/oF/libs/openFrameworksCompiled/lib/linux64/libopenFrameworks.a   -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -fuse-ld=gold    -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -lfreetype -lsndfile -lopenal -lcurl -lglfw -lrtaudio -lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGL -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lmpg123 -lglut -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage -lboost_filesystem -lboost_system -lpugixml -luriparser -lXinerama
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
/home/bevis/.local/bin/oF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:403: recipe for target 'bin/polygonExample' failed
make[1]: *** [bin/polygonExample] Error 1
make[1]: Leaving directory '/home/bevis/.local/bin/oF/examples/graphics/polygonExample'
/home/bevis/.local/bin/oF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:124: recipe for target 'Release' failed
make: *** [Release] Error 2

Did you run the install_dependencies script? I am on Ubuntu 18.04 and it works

I know this will not help but I am using ubuntu 18.04 right now and it works. I just finished running an example a minute ago… I suggest to double check the installation instructions.

ciao
Davide

Works for me too on 18.04 and GCC 7.3, installed just two days ago. I followed the instructions at


but skipped the “Get the Project Generator” part because I use QtCreator instead (which has its own scripts to generate projects) and also skipped the Compile all examples part.

I can reproduce this issue with a Docker file:

FROM ubuntu:18.04

RUN apt update && \
    apt install -y --no-install-recommends wget && \
    wget --no-check-certificate https://openframeworks.cc/versions/v0.10.1/of_v0.10.1_linux64gcc6_release.tar.gz && \
    tar -xzvf of_v0.10.1_linux64gcc6_release.tar.gz && \
    mv of_v0.10.1_linux64gcc6_release /openFrameworks

RUN cd /openFrameworks/scripts/linux/ubuntu/ && \
        apt update && \
        apt install -y --no-install-recommends apt-utils && \
        ./install_dependencies.sh -y && \
        ./install_codecs.sh -y && \
    cd /openFrameworks/scripts/linux/ && \
        ./compileOF.sh -j$(nproc) && \
    rm -rf /var/lib/apt/lists/* 

It looks like the Ubuntu build on Travis is using a 5-year old version (14.04).

Update: I get the same error when I use a different version, including 14.04. So I’m not sure what’s wrong here. As far as I can tell the dependencies script would need to be modified because it seems to reference an incorrect version of gcc?

Can you try using the nightly builds?

Same problem. For reproducibility, here is the Dockerfile I used for testing (also tested 18.04):

FROM ubuntu:14.04

RUN apt update && \
    apt install -y --no-install-recommends wget && \
    wget --no-check-certificate \
        -O openFrameworks.tar.gz \
        https://openframeworks.cc/ci_server/versions/nightly/of_v20190923_linux64gcc6_nightly.tar.gz && \
    tar -xzvf openFrameworks.tar.gz && \
    rm openFrameworks.tar.gz && \
    mv of_* /openFrameworks

RUN cd /openFrameworks/scripts/linux/ubuntu/ && \
        apt update && \
        apt install -y --no-install-recommends apt-utils && \
        ./install_dependencies.sh -y && \
        ./install_codecs.sh -y && \
    cd /openFrameworks/scripts/linux/ && \
        ./compileOF.sh -j$(nproc) && \
    rm -rf /var/lib/apt/lists/*

have you also tried on an normal ubuntu install or only on docker?

I had the same issue on Ubuntu 18.04 … compile_OF.sh would pass, but examples failed.

There seemed to be 2 issues for my setup:

  • My NVIDIA driver put GL in an unexpected spot (see fix here)
  • Running install_dependencies.sh, dependencies for gstreamer1.0-libav weren’t automatically installed. I went back and installed gstreamer-related libs manually, and then the examples built and ran.