curv3d / curv

a language for making art using mathematics
Apache License 2.0
1.14k stars 73 forks source link

Link errors with gcc 7.2.0 #16

Closed bluecube closed 6 years ago

bluecube commented 6 years ago

Clean clone, Gentoo's media-gfx/openvdb-4.0.2. This failure doesn't happen when I force using g++-6.4.0 as a compiler (but I'm getting stuck on #17).

cube@gecko /tmp/curv (master) $ make
mkdir -p release
cd release; cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "3.6.1") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/curv/release
cd release; make
make[1]: Entering directory '/tmp/curv/release'
make[2]: Entering directory '/tmp/curv/release'
make[3]: Entering directory '/tmp/curv/release'
Scanning dependencies of target libcurv
make[3]: Leaving directory '/tmp/curv/release'
make[3]: Entering directory '/tmp/curv/release'
[  2%] Building CXX object CMakeFiles/libcurv.dir/curv/analyser.cc.o
[  4%] Building CXX object CMakeFiles/libcurv.dir/curv/arg.cc.o
[  6%] Building CXX object CMakeFiles/libcurv.dir/curv/builtin.cc.o
[  8%] Building CXX object CMakeFiles/libcurv.dir/curv/context.cc.o
[ 10%] Building CXX object CMakeFiles/libcurv.dir/curv/definition.cc.o
[ 12%] Building CXX object CMakeFiles/libcurv.dir/curv/die.cc.o
[ 14%] Building CXX object CMakeFiles/libcurv.dir/curv/dtostr.cc.o
[ 16%] Building CXX object CMakeFiles/libcurv.dir/curv/evaluator.cc.o
[ 18%] Building CXX object CMakeFiles/libcurv.dir/curv/exception.cc.o
[ 20%] Building CXX object CMakeFiles/libcurv.dir/curv/file.cc.o
[ 22%] Building CXX object CMakeFiles/libcurv.dir/curv/function.cc.o
[ 24%] Building CXX object CMakeFiles/libcurv.dir/curv/gl_compiler.cc.o
[ 26%] Building CXX object CMakeFiles/libcurv.dir/curv/gl_context.cc.o
[ 28%] Building CXX object CMakeFiles/libcurv.dir/curv/list.cc.o
[ 30%] Building CXX object CMakeFiles/libcurv.dir/curv/location.cc.o
[ 32%] Building CXX object CMakeFiles/libcurv.dir/curv/math.cc.o
[ 34%] Building CXX object CMakeFiles/libcurv.dir/curv/module.cc.o
[ 36%] Building CXX object CMakeFiles/libcurv.dir/curv/parser.cc.o
[ 38%] Building CXX object CMakeFiles/libcurv.dir/curv/pattern.cc.o
[ 40%] Building CXX object CMakeFiles/libcurv.dir/curv/program.cc.o
[ 42%] Building CXX object CMakeFiles/libcurv.dir/curv/range.cc.o
[ 44%] Building CXX object CMakeFiles/libcurv.dir/curv/record.cc.o
[ 46%] Building CXX object CMakeFiles/libcurv.dir/curv/scanner.cc.o
[ 48%] Building CXX object CMakeFiles/libcurv.dir/curv/shape.cc.o
[ 50%] Building CXX object CMakeFiles/libcurv.dir/curv/string.cc.o
[ 52%] Building CXX object CMakeFiles/libcurv.dir/curv/structure.cc.o
[ 54%] Building CXX object CMakeFiles/libcurv.dir/curv/system.cc.o
[ 56%] Building CXX object CMakeFiles/libcurv.dir/curv/value.cc.o
[ 58%] Building CXX object CMakeFiles/libcurv.dir/curv/version.cc.o
[ 60%] Linking CXX static library libcurv.a
make[3]: Leaving directory '/tmp/curv/release'
[ 60%] Built target libcurv
make[3]: Entering directory '/tmp/curv/release'
Scanning dependencies of target curv
make[3]: Leaving directory '/tmp/curv/release'
make[3]: Entering directory '/tmp/curv/release'
[ 62%] Building C object CMakeFiles/curv.dir/cmd/readlinex.c.o
[ 64%] Building CXX object CMakeFiles/curv.dir/cmd/curv.cc.o
[ 66%] Building CXX object CMakeFiles/curv.dir/cmd/export.cc.o
[ 68%] Building CXX object CMakeFiles/curv.dir/cmd/export_mesh.cc.o
[ 70%] Building CXX object CMakeFiles/curv.dir/cmd/progdir.cc.o
[ 72%] Linking CXX executable curv
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::math::AffineMap::postRotate(double, openvdb::v4_0_2::math::Axis) const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24math9AffineMap10postRotateEdNS1_4AxisE[_ZNK7openvdb6v4_0_24math9AffineMap10postRotateEdNS1_4AxisE]+0x66): undefined reference to `openvdb::v4_0_2::math::simplify(std::shared_ptr<openvdb::v4_0_2::math::AffineMap>)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::math::ScaleTranslateMap::postRotate(double, openvdb::v4_0_2::math::Axis) const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24math17ScaleTranslateMap10postRotateEdNS1_4AxisE[_ZNK7openvdb6v4_0_24math17ScaleTranslateMap10postRotateEdNS1_4AxisE]+0x66): undefined reference to `openvdb::v4_0_2::math::simplify(std::shared_ptr<openvdb::v4_0_2::math::AffineMap>)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::math::TranslationMap::postRotate(double, openvdb::v4_0_2::math::Axis) const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24math14TranslationMap10postRotateEdNS1_4AxisE[_ZNK7openvdb6v4_0_24math14TranslationMap10postRotateEdNS1_4AxisE]+0x66): undefined reference to `openvdb::v4_0_2::math::simplify(std::shared_ptr<openvdb::v4_0_2::math::AffineMap>)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::math::ScaleMap::postRotate(double, openvdb::v4_0_2::math::Axis) const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24math8ScaleMap10postRotateEdNS1_4AxisE[_ZNK7openvdb6v4_0_24math8ScaleMap10postRotateEdNS1_4AxisE]+0x66): undefined reference to `openvdb::v4_0_2::math::simplify(std::shared_ptr<openvdb::v4_0_2::math::AffineMap>)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::math::AffineMap::preShear(double, openvdb::v4_0_2::math::Axis, openvdb::v4_0_2::math::Axis) const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24math9AffineMap8preShearEdNS1_4AxisES3_[_ZNK7openvdb6v4_0_24math9AffineMap8preShearEdNS1_4AxisES3_]+0xb4): undefined reference to `openvdb::v4_0_2::math::simplify(std::shared_ptr<openvdb::v4_0_2::math::AffineMap>)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o:export_mesh.cc:(.text._ZNK7openvdb6v4_0_24math17ScaleTranslateMap8preShearEdNS1_4AxisES3_[_ZNK7openvdb6v4_0_24math17ScaleTranslateMap8preShearEdNS1_4AxisES3_]+0xb4): more undefined references to `openvdb::v4_0_2::math::simplify(std::shared_ptr<openvdb::v4_0_2::math::AffineMap>)' follow
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::GridBase::GridBase(openvdb::v4_0_2::GridBase const&)':
export_mesh.cc:(.text._ZN7openvdb6v4_0_28GridBaseC2ERKS1_[_ZN7openvdb6v4_0_28GridBaseC5ERKS1_]+0x51): undefined reference to `openvdb::v4_0_2::math::Transform::Transform(std::shared_ptr<openvdb::v4_0_2::math::MapBase> const&)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::tree::LeafBuffer<float, 3u>::doLoad() const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24tree10LeafBufferIfLj3EE6doLoadEv[_ZNK7openvdb6v4_0_24tree10LeafBufferIfLj3EE6doLoadEv]+0x13a): undefined reference to `openvdb::v4_0_2::io::setStreamMetadataPtr(std::ios_base&, std::shared_ptr<openvdb::v4_0_2::io::StreamMetadata>&, bool)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::tree::LeafBuffer<unsigned int, 3u>::doLoad() const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24tree10LeafBufferIjLj3EE6doLoadEv[_ZNK7openvdb6v4_0_24tree10LeafBufferIjLj3EE6doLoadEv]+0x13a): undefined reference to `openvdb::v4_0_2::io::setStreamMetadataPtr(std::ios_base&, std::shared_ptr<openvdb::v4_0_2::io::StreamMetadata>&, bool)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::tree::LeafBuffer<short, 3u>::doLoad() const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24tree10LeafBufferIsLj3EE6doLoadEv[_ZNK7openvdb6v4_0_24tree10LeafBufferIsLj3EE6doLoadEv]+0x13a): undefined reference to `openvdb::v4_0_2::io::setStreamMetadataPtr(std::ios_base&, std::shared_ptr<openvdb::v4_0_2::io::StreamMetadata>&, bool)'
CMakeFiles/curv.dir/cmd/export_mesh.cc.o: In function `openvdb::v4_0_2::tree::LeafBuffer<openvdb::v4_0_2::math::Vec3<float>, 3u>::doLoad() const':
export_mesh.cc:(.text._ZNK7openvdb6v4_0_24tree10LeafBufferINS0_4math4Vec3IfEELj3EE6doLoadEv[_ZNK7openvdb6v4_0_24tree10LeafBufferINS0_4math4Vec3IfEELj3EE6doLoadEv]+0x13a): undefined reference to `openvdb::v4_0_2::io::setStreamMetadataPtr(std::ios_base&, std::shared_ptr<openvdb::v4_0_2::io::StreamMetadata>&, bool)'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/curv.dir/build.make:200: curv] Error 1
make[3]: Leaving directory '/tmp/curv/release'
make[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/curv.dir/all] Error 2
make[2]: Leaving directory '/tmp/curv/release'
make[1]: *** [Makefile:130: all] Error 2
make[1]: Leaving directory '/tmp/curv/release'
make: *** [Makefile:4: release] Error 2
bluecube commented 6 years ago

Now that I've tried it with g++ 6.4.0 properly, the error is there as well

doug-moen commented 6 years ago

I googled the error messages. As far as I can tell, Gentoo is using a special build of openvdb 4 that has been modified to use the openvdb 3 ABI, for binary compatibility with Houdini. On this build, I need to compile with -DOPENVDB_3_ABI_COMPATIBLE. Next step: figure out how to make my Cmake script do the right thing automatically.

doug-moen commented 6 years ago

Fixed this by adding openvdb as a submodule, and compiling the openvdb sources as part of the Curv build. See the last 3 commits, ending at https://github.com/doug-moen/curv/commit/c73ed21615730e772d938e3a56db79f769f6abb5