OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

oiio compile with field3d v1.7.3 have some error

Open jacklin012345 opened this issue 4 years ago • 20 comments

[ 81%] Linking CXX executable ../../bin/idiff ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::MatrixFieldMapping::setLocalToWorld(Imath_2_3::Matrix44<double> const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to openvdb::v7_1::io::GridDescriptor::nameAsString(std::string const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::Header::setType(std::string const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_3::Vec3 >::loadBlock(int)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to bool Field3D::v1_7::Field3DOutputFile::writeLayer<Imath_2_3::Vec3<double> >(std::string const&, std::string const&, Field3D::v1_7::Field<Imath_2_3::Vec3<double> >::Ptr)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::TypedAttributestd::string::readValueFrom(Imf_2_3::IStream&, int, int)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3<double> >::ms_singleton' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_3::Vec3 >::openFile()' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3<half> >::ms_creationMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::TypedAttribute<std::vector<std::string, std::allocatorstd::string > >::staticTypeName()' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to openvdb::v7_1::io::File::File(std::string const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldMapping::setExtents(Imath_2_3::Box<Imath_2_3::Vec3 > const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3<double> >::ms_creationMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_3::Vec3 >::loadBlock(int)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::TypedAttribute<std::vector<std::string, std::allocator<std::string> > >::writeValueTo(Imf_2_3::OStream&, int) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::TypedAttributestd::string::staticTypeName()' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3<float> >::ms_singleton' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_3::Vec3 >::openFile()' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to bool Field3D::v1_7::Field3DOutputFile::writeLayer<Imath_2_3::Vec3<float> >(std::string const&, std::string const&, Field3D::v1_7::Field<Imath_2_3::Vec3<float> >::Ptr)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field<Imath_2_3::Vec3 >::Vec Field3D::v1_7::Field3DInputFile::readLayers<Imath_2_3::Vec3 >(std::string const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::TypedAttribute<std::vector<std::string, std::allocator<std::string> > >::readValueFrom(Imf_2_3::IStream&, int, int)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3 >::ms_singleton' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to openvdb::v7_1::io::File::readGrid(std::string const&, openvdb::v7_1::math::BBox<openvdb::v7_1::math::Vec3<double> > const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::Header::name() const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to openvdb::v7_1::GridBase::getName() const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to bool Field3D::v1_7::Field3DOutputFile::writeLayer<Imath_2_3::Vec3 >(std::string const&, std::string const&, Field3D::v1_7::Field<Imath_2_3::Vec3 >::Ptr)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3<float> >::ms_creationMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_3::Vec3 >::loadBlock(int)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field<Imath_2_3::Vec3<half> >::Vec Field3D::v1_7::Field3DInputFile::readLayers<Imath_2_3::Vec3<half> >(std::string const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3 >::ms_accessMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldMetadata::setVecIntMetadata(std::string const&, Imath_2_3::Vec3<int> const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::Header::type() const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldMetadata::setVecFloatMetadata(std::string const&, Imath_2_3::Vec3<float> const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Imf_2_3::TypedAttributestd::string::writeValueTo(Imf_2_3::OStream&, int) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to openvdb::v7_1::io::File::open(bool, std::function<void (std::string)> const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3 >::ms_accessMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_3::Vec3<double> >::ms_accessMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field<Imath_2_3::Vec3 >::Vec Field3D::v1_7::Field3DInputFile::readLayers<Imath_2_3::Vec3 >(std::string const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Ptex::v2_2::PtexTexture::open(char const*, std::string&, bool)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_3::Vec3 >::openFile()' collect2: error: ld returned 1 exit status make[2]: *** [bin/idiff] Error 1 make[1]: *** [src/idiff/CMakeFiles/idiff.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

jacklin012345 avatar Sep 04 '20 08:09 jacklin012345

First thing's first: do you really need Field3D support? If you aren't needing to read Field3D files as volumetric images, the easiest way out of this is just to build with -DUSE_FIELD3D=0 and disable it.

lgritz avatar Sep 12 '20 18:09 lgritz

First thing's first: do you really need Field3D support? If you aren't needing to read Field3D files as volumetric images, the easiest way out of this is just to build with -DUSE_FIELD3D=0 and disable it.

yes,I need Field3D support,how to fix?thanks for looking!

jacklin012345 avatar Sep 15 '20 07:09 jacklin012345

The first thing I would think of is, maybe you have two different Field3D installations, and it's somehow using the headers from one version but trying to link the other one, so the version numbers (in the versioned v1_7 inner namespace) aren't matching?

Though you ALSO appear to be missing symbols from IlmImf, which is OpenEXR. So something is going wrong there, too.

Could you try with the current release, 2.2, do this:

make nuke
make VERBOSE=1 | tee build.log

and then paste the full log here?

lgritz avatar Sep 15 '20 15:09 lgritz

../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_2::Vec3<float> >::ms_singleton' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to bool Field3D::v1_7::Field3DOutputFile::writeLayer(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, Field3D::v1_7::Field::Ptr)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FileHDF5::Partition::vectorLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to bool Field3D::v1_7::Field3DOutputFile::writeLayer(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, Field3D::v1_7::Field::Ptr)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field3DFileBase::getPartitionNames(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field3DFileHDF5Base::intPartitionName(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, boost::intrusive_ptrField3D::v1_7::FieldRes)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldMapping::setExtents(Imath_2_2::Box<Imath_2_2::Vec3<int> > const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::ClassFactory::createFieldIO(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field3DFileHDF5Base::getIntVectorLayerNames(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::SparseFile::Reference<Imath_2_2::Vec3 >::openFile()' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field3DFileHDF5Base::partition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_2::Vec3 >::ms_creationMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_2::Vec3<double> >::ms_creationMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldMetadata::setStrMetadata(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field3DFileHDF5Base::partition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache<Imath_2_2::Vec3 >::ms_accessMutex' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to `Field3D::v1_7::FileHDF5::Partition::scalarLayer(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) const'

jacklin012345 avatar Sep 27 '20 02:09 jacklin012345

Hi, can you send the full log, not just a clip of the error messages?

Also, what platform and compiler?

lgritz avatar Sep 27 '20 02:09 lgritz

build.log

I didn't load fied3d,it can be compiled.

jacklin012345 avatar Sep 27 '20 08:09 jacklin012345

Hi, please try this to get the whole log, including the config step:

# from the main oiio directory:
make nuke all VERBOSE=1 | tee build.log

lgritz avatar Sep 27 '20 16:09 lgritz

I can't help but notice that in the first example of error messages, you were expecting Field3D 1.7 which had clearly been built against OpenEXR 2.3 and using std::string parameters:

../../lib/libOpenImageIO.so.2.1.17: undefined reference to bool Field3D::v1_7::Field3DOutputFile::writeLayer< Imath_2_3 ::Vec3 >( std::string const&, std::string const&, Field3D::v1_7::Field<Imath_2_3::Vec3 >::Ptr)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field<Imath_2_3::Vec3 >::Vec Field3D::v1_7::Field3DInputFile::readLayers<Imath_2_3::Vec3 >(std::string const&) const'

But then in the later example, it appeared to be looking for a FIeld3D that used OpenEXR 2.2 and the new ABI __cxx11::basic_string:

../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::Field3DFileHDF5Base::partition( std::__cxx11::basic_string <char, std::char_traits, std::allocator > const&)' ../../lib/libOpenImageIO.so.2.1.17: undefined reference to Field3D::v1_7::FieldCache< Imath_2_2 ::Vec3 >::ms_accessMutex'

So I think what is happening is that you are having trouble building OIIO and its set of dependencies that all are consistently using the same mutual dependencies and important compiler build flags that control the ABI.

lgritz avatar Sep 27 '20 16:09 lgritz

I think you're trying to link against a Field3D that was build with a different OpenEXR and maybe also a different C++ ABI compatibility (not using the same string type).

lgritz avatar Sep 27 '20 16:09 lgritz

Hi, please try this to get the whole log, including the config step:

# from the main oiio directory:
make nuke all VERBOSE=1 | tee build.log

it doesn't execute,show as: make *** No rule to make target ‘nuke’. Stop.

OS : CentOS 7.2 python ; 2.7.5 gcc : 6.5 cmake : 3.15 cmake -DOPENEXR_ROOT=/usr/local/openexr-2_2 -DQt5_ROOT=/usr/local/qt-5_13_2 -DOpenColorIO_ROOT=/usr/local/OpenColorIO -DOpenCV_ROOT=/usr/local/opencv -DJPEGTurbo_ROOT=/usr/local/libjpeg-turbo-2_0_5 -DLibheif_ROOT=/usr/local/libheif-1_6 -DGIF_ROOT=/usr/local/giflib -DILMBASE_ROOT=/usr/local/ilmbase-2_2 -DFFmpeg_ROOT=/usr/local/FFmpeg -DLibRaw_ROOT=/usr/local/libraw/ -DPTex_ROOT=/usr/local/ptex -DWebp_ROOT=/usr/local/libwebp -DUSE_R3DSDK=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/oiio -DField3D_ROOT=/usr/local/field3d -DOpenVDB_ROOT=/usr/local/openvdb -DTIFF_ROOT=/usr/local/tiff-4_1 -DTBB_ROOT=/usr/local/tbb-2019 -DBOOST_ROOT=/usr/local/boost-1_69 -DOpenJpeg_ROOT=/usr/local/openjpeg -DDCMTK_ROOT=/usr/local/dcmtk -DLibsquish_ROOT=/usr/local/libsquish -DPybind11_ROOT=/usr/local/pybind11 ..

jacklin012345 avatar Sep 28 '20 02:09 jacklin012345

This is very hard to debug remotely, but I reiterate that I believe the problem is that your Field3D is not compiled with the same OpenEXR/Imath, or maybe not with the same C++ standard and ABI, as you used when building OIIO itself, so you're getting a link time conflict.

lgritz avatar Sep 29 '20 05:09 lgritz

Hi, please try this to get the whole log, including the config step:

# from the main oiio directory:
make nuke all VERBOSE=1 | tee build.log

it doesn't execute,show as: make *** No rule to make target ‘nuke’. Stop.

OS : CentOS 7.2 python ; 2.7.5 gcc : 6.5 cmake : 3.15 cmake -DOPENEXR_ROOT=/usr/local/openexr-2_2 -DQt5_ROOT=/usr/local/qt-5_13_2 -DOpenColorIO_ROOT=/usr/local/OpenColorIO -DOpenCV_ROOT=/usr/local/opencv -DJPEGTurbo_ROOT=/usr/local/libjpeg-turbo-2_0_5 -DLibheif_ROOT=/usr/local/libheif-1_6 -DGIF_ROOT=/usr/local/giflib -DILMBASE_ROOT=/usr/local/ilmbase-2_2 -DFFmpeg_ROOT=/usr/local/FFmpeg -DLibRaw_ROOT=/usr/local/libraw/ -DPTex_ROOT=/usr/local/ptex -DWebp_ROOT=/usr/local/libwebp -DUSE_R3DSDK=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/oiio -DField3D_ROOT=/usr/local/field3d -DOpenVDB_ROOT=/usr/local/openvdb -DTIFF_ROOT=/usr/local/tiff-4_1 -DTBB_ROOT=/usr/local/tbb-2019 -DBOOST_ROOT=/usr/local/boost-1_69 -DOpenJpeg_ROOT=/usr/local/openjpeg -DDCMTK_ROOT=/usr/local/dcmtk -DLibsquish_ROOT=/usr/local/libsquish -DPybind11_ROOT=/usr/local/pybind11 ..

Note that this bug also happen on Fedora Rawhide. On Fedora Field3D is buildt without OpenEXR but with ilmbase, however OpenImageIO is built with OpenEXR and ilmbase.

eclipseo avatar Jan 29 '21 19:01 eclipseo

I'm not sure why you say that on Fedora Field3D is built without OpenEXR since it appears to be: https://kojipkgs.fedoraproject.org//packages/Field3D/1.7.3/8.fc34/data/logs/x86_64/root.log

However, it looks like Field3D is defaulting to c++17 (gcc default) while OIIO is intentionally being set to c++11. @lgritz are you saying that if I tell OIIO to build at c++17 it might work? This is an area I have very little expertise.

hobbes1069 avatar Jan 29 '21 19:01 hobbes1069

I have no idea, but it's worth a try. Depends on what you want to impose on users as the minimum required standard when they are using the library.

lgritz avatar Jan 29 '21 20:01 lgritz

I'm not sure why you say that on Fedora Field3D is built without OpenEXR since it appears to be: https://kojipkgs.fedoraproject.org//packages/Field3D/1.7.3/8.fc34/data/logs/x86_64/root.log.

My bad, I only looked at the BR.

eclipseo avatar Jan 29 '21 20:01 eclipseo

I didn't see how to change the C++ standard in INSTALL.md. What is the right way to set it? cmake -DCXX_STANDARD=17

or something like that?

hobbes1069 avatar Jan 29 '21 20:01 hobbes1069

Interesting... I tried that but it ended up with -std=c++14 not 17. Either case, same errors.

hobbes1069 avatar Jan 29 '21 20:01 hobbes1069

Interesting... I tried that but it ended up with -std=c++14 not 17. Either case, same errors.

I rebuilt it in my COPR with no issue: https://copr.fedorainfracloud.org/coprs/eclipseo/gotests/build/1925193/

I think the issue comes from: https://koji.fedoraproject.org/koji/buildinfo?buildID=1672657 If you check the log it was built without EXR due to a broken dep. During the mass rebuild OpenImageIO was maybe built against that Field3D and it failed.If you rebuild both, it might work again like in my COPR.

eclipseo avatar Jan 29 '21 21:01 eclipseo

@hobbes1069 -DCMAKE_CXX_STANDARD=17

lgritz avatar Jan 29 '21 21:01 lgritz

That indeed appears to be the problem. 4 arches have completed building after rebuilding Field3D with openexr.

hobbes1069 avatar Jan 30 '21 01:01 hobbes1069

We don't support field3d any more. Closing.

lgritz avatar Sep 27 '23 06:09 lgritz