For some reason my linker keeps trying to link against the static version of libc instead of the dynamic version when building from source. I also tried setting the cmake flag BUILD_SHARED_LIBRARIES to OFF but this led to other problems. Full error below.
Linking CXX shared library ../../lib/libopencv_videoio.so /usr/bin/ld: /usr/local/lib/libc.a(lib_a-mallocr.o): relocation R_X86_64_32S against `__malloc_av_' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libc.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[2]: * [lib/libopencv_videoio.so.3.0.0] Error 1 make[1]: [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 make: ** [all] Error 2