dreamworksanimation / openmoonray

MoonRay is DreamWorks’ open-source, award-winning, state-of-the-art production MCRT renderer.
https://openmoonray.org/
Apache License 2.0
4.32k stars 254 forks source link

Linking errors when building in Ubuntu container #108

Open fantomid opened 1 year ago

fantomid commented 1 year ago

I created image to build MoonRay in Ubuntu's containers (Ubuntu versions 22.04 and 20.04). The first tool that doesn't link is denoise: [35%] Linking CXX executable denoise /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference to vtable for moonray::pbr::ProjectiveCamera' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference tomoonray::pbr::PerspectiveCamera::PerspectiveCamera(scene_rdl2::rdl2::Camera const)' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference to moonray::pbr::ImageDistribution::~ImageDistribution()' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference tomoonray::pbr::Camera::update(scene_rdl2::math::Mat4<scene_rdl2::math::Vec4 > const&)' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference to `moonray::pbr::PerspectiveCamera::computeFrustumImpl(moonray::mcrt_common::Frustum, float, bool) const' collect2: error: ld returned 1 exit status make[2]: *** [moonray/moonray/cmd/denoise_cmd/CMakeFiles/denoise.dir/build.make:149: moonray/moonray/cmd/denoise_cmd/denoise] Error 1

The other one are in the test directory. I got the same linking's errors for moonray_rendering_rt_tests. I got this error for moonray_rendering_pbr_tests. /usr/bin/ld: ../../../../lib/rendering/pbr/librendering_pbr.so: undefined reference to `isRenderCanceled'

If I made these libraries static (rndr, pbr, rt), the linking's errors disappeared. Could someone explain ? With CLang, I got errors too.

rgwilson68 commented 1 year ago

I haven't seen this issue before...

PerspectiveCamera should be in librendering_pbr.so. If you run the build with the --verbose option, it should show the linker command line being run for denoise : -lrendering_pbr should be listed.

You can check if moonray::pbr::PerspectiveCamera::PerspectiveCamera(scene_rdl2::rdl2::Camera const*) actually is defined in librendering_pbr.so using nm:

nm librendering_pbr.so | fgrep PerspectiveCamera ... T _ZN7moonray3pbr17PerspectiveCameraC1EPKN10scene_rdl24rdl26CameraE ... c++filt _ZN7moonray3pbr17PerspectiveCameraC1EPKN10scene_rdl24rdl26CameraE moonray::pbr::PerspectiveCamera::PerspectiveCamera(scene_rdl2::rdl2::Camera const*)

fantomid commented 1 year ago

Sorry for the delay, holidays :) I already did the checking with nm and c++filt before reporting the linking issues. Could gnu c++17 option be responsible of these errors ?

I will give you the linker command with verbose option at the beginning of august.

fantomid commented 1 year ago

@rgwilson68 the command line of the linker: [ 35%] Linking CXX executable denoise cd /build_dir/build-release/openmoonray/moonray/moonray/cmd/denoise_cmd && /opt/cmake-3.23.1-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/denoise.dir/link.txt --verbose=1 /usr/bin/c++ -O3 -DNDEBUG -Wl,--enable-new-dtags CMakeFiles/denoise.dir/main.cc.o -o denoise -Wl,-rpath,/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/rndr:/build_dir/build-release/openmoonray/moonray/mcrt_denoise/lib/denoiser:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/displayfilter:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/pbr:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/lpe:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/rt:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/geom:/install_dir/lib:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/shading:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/bvh/shading:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/bvh/shading/ispc:/build_dir/build-release/openmoonray/moonray/moonray/lib/common/file_resource:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/shading/ispc:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/texturing/sampler:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/grid_util:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/rec_time:/build_dir/build-release/openmoonray/moonray/moonray/lib/rendering/mcrt_common:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/scene/rdl2:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/fb_util:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/fb_util/ispc:/build_dir/build-release/openmoonray/moonray/moonray/lib/common/mcrt_util:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/render/util:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/math:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/math/ispc:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/common/platform:/build_dir/build-release/openmoonray/moonray/moonray/lib/deepfile:/build_dir/build-release/openmoonray/moonray/moonray/lib/statistics:/build_dir/build-release/openmoonray/moonray/scene_rdl2/lib/render/logging: ../../lib/rendering/rndr/librendering_rndr.so ../../../mcrt_denoise/lib/denoiser/libdenoiser.so ../../lib/rendering/displayfilter/librendering_displayfilter.so ../../lib/rendering/pbr/librendering_pbr.so ../../lib/rendering/lpe/librendering_lpe.so ../../lib/rendering/rt/librendering_rt.so ../../lib/rendering/geom/librendering_geom.so /install_dir/lib/libosdGPU.so /install_dir/lib/libosdCPU.so ../../lib/rendering/shading/librendering_shading.so ../../lib/rendering/bvh/shading/librendering_bvh_shading.so ../../lib/rendering/bvh/shading/ispc/libbvh_shading_ispc.so ../../lib/common/file_resource/libcommon_file_resource.so ../../lib/rendering/shading/ispc/libshading_ispc.so ../../lib/rendering/shading/ispc/libshading_eval_ispc.so /lib/x86_64-linux-gnu/libcudart.so ../../lib/rendering/texturing/sampler/libtexturing_sampler.so /install_dir/lib/libOpenImageIO.so.2.2.15 /install_dir/lib/libImath-3_0.a ../../../scene_rdl2/lib/common/grid_util/libcommon_grid_util.so ../../../scene_rdl2/lib/common/rec_time/libcommon_rec_time.so /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libcrypto.so ../../lib/rendering/mcrt_common/librendering_mcrt_common.so ../../../scene_rdl2/lib/scene/rdl2/libscene_rdl2.so ../../../scene_rdl2/lib/common/fb_util/libcommon_fb_util.so ../../../scene_rdl2/lib/common/fb_util/ispc/libfb_util_ispc.so ../../lib/common/mcrt_util/libcommon_mcrt_util.so ../../../scene_rdl2/lib/render/util/librender_util.so ../../../scene_rdl2/lib/common/math/libcommon_math.so ../../../scene_rdl2/lib/common/math/ispc/libmath_ispc.so /usr/lib/x86_64-linux-gnu/libjsoncpp.so /usr/lib/x86_64-linux-gnu/liblua5.3.so ../../../scene_rdl2/lib/common/platform/libcommon_platform.so ../../lib/deepfile/libdeepfile.so /install_dir/lib/libIlmImfUtil-2_5.a /install_dir/lib/libIlmImf-2_5.a /install_dir/lib/libImath-2_5.a /install_dir/lib/libIexMath-2_5.a /install_dir/lib/libHalf-2_5.a /install_dir/lib/libIlmThread-2_5.a /install_dir/lib/libIex-2_5.a -lpthread /usr/lib/x86_64-linux-gnu/libz.so ../../lib/statistics/libstatistics.so /usr/lib/x86_64-linux-gnu/libjpeg.so /install_dir/lib/libopenvdb.so -ltbb -latomic /install_dir/lib/libembree3.so.3.12.1 ../../../scene_rdl2/lib/render/logging/librender_logging.so /usr/lib/x86_64-linux-gnu/liblog4cplus.so /install_dir/lib/libOpenImageDenoise.so.1.4.3 /lib/x86_64-linux-gnu/libcudart.so /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference to vtable for moonray::pbr::ProjectiveCamera' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference tomoonray::pbr::PerspectiveCamera::PerspectiveCamera(scene_rdl2::rdl2::Camera const)' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference to moonray::pbr::ImageDistribution::~ImageDistribution()' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference tomoonray::pbr::Camera::update(scene_rdl2::math::Mat4<scene_rdl2::math::Vec4 > const&)' /usr/bin/ld: ../../lib/rendering/rt/librendering_rt.so: undefined reference to `moonray::pbr::PerspectiveCamera::computeFrustumImpl(moonray::mcrt_common::Frustum, float, bool) const' collect2: error: ld returned 1 exit status

nuclearpolygon commented 2 weeks ago

hello there! I'm building the Moonray in Ubuntu container (nvidia/cuda:11.8.0-devel-ubuntu22.04) and I'm stuck on denoiser building step

I've created a branch in case anybody wants to try help me to make it work finally! to start you only need to recursive clone and then put NVIDIA-OptiX-SDK-7.3.0-linux64-x86_64.sh into the root of repository and then docker build . Any advice is appreciated!

/openmoonray/moonray/mcrt_denoise/lib/denoiser/OptixDenoiserImpl.cc: In constructor 'moonray::denoiser::OptixDenoiserImpl::OptixDenoiserImpl(int, int, bool, bool, std::string*)':
/openmoonray/moonray/mcrt_denoise/lib/denoiser/OptixDenoiserImpl.cc:110:36: error: 'OPTIX_DENOISER_ALPHA_MODE_COPY' was not declared in this scope
  110 |     mDenoiserParams.denoiseAlpha = OPTIX_DENOISER_ALPHA_MODE_COPY; // don't denoise alpha
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [moonray/mcrt_denoise/lib/denoiser/CMakeFiles/denoiser.dir/build.make:104: moonray/mcrt_denoise/lib/denoiser/CMakeFiles/denoiser.dir/OptixDenoiserImpl.cc.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:11058: moonray/mcrt_denoise/lib/denoiser/CMakeFiles/denoiser.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....