BachiLi / lajolla_public

UCSD CSE 272 renderer
MIT License
71 stars 42 forks source link

Questions about building the project #1

Closed jalencato closed 2 years ago

jalencato commented 2 years ago

At first I clone the whole project, following the guide in the readme. My system is MacOS BigSur. Running

mkdir build

cmake ..

make -j8

There is a long error, the key part is

ld: warning: ignoring file ../embree/lib-linux/libembree3.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file ../embree/lib-linux/libembree3.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) Undefined symbols for architecture x86_64: "_rtcAttachGeometry", referenced from: register_embree_op::operator()(Sphere const&) const in liblajolla_lib.a(shape.cpp.o) register_embree_op::operator()(TriangleMesh const&) const in liblajolla_lib.a(shape.cpp.o) decltype(auto) std::1::variant_detail::visitation::base::dispatcher<0ul>::dispatch<std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&>(std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&) in liblajolla_lib.a(shape.cpp.o)

I thought it was the problem that the libembree.dylib is not included in the project, so I modified the original cmakelist.txt. CMakeLists.txt With this cmakelists, I can build the project successfully without running the tests on intersection. However, that is where embree makes effect. The error log is the same as above.

ld: warning: ignoring file ../embree/lib-linux/libembree3.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) ld: warning: ignoring file ../embree/lib-linux/libembree3.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ) Undefined symbols for architecture x86_64: "_rtcAttachGeometry", referenced from: register_embree_op::operator()(Sphere const&) const in liblajolla_lib.a(shape.cpp.o) register_embree_op::operator()(TriangleMesh const&) const in liblajolla_lib.a(shape.cpp.o) decltype(auto) std::1::variant_detail::visitation::base::dispatcher<0ul>::dispatch<std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&>(std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&) in liblajolla_lib.a(shape.cpp.o)

I thought it may be caused by search order. Following the guide in the discord, I swap the order between lib-linux and lib-macos in the FindEmbree.cmake, but nothing happens. I now even wonder what the real problem is.

BachiLi commented 2 years ago

what happens if you change the following lines

find_package(Embree REQUIRED)
set(EMBREE_INCLUDE_PATH embree/include)
include_directories(${EMBREE_INCLUDE_PATH})
link_libraries(${EMBREE_LIBRARY})

link_directories(embree/lib-macos)

to

set(EMBREE_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/embree/include)
set(EMBREE_LIBRARY ${CMAKE_SOURCE_DIR}/embree/lib-macos)
include_directories(${EMBREE_INCLUDE_PATH})
link_libraries(${EMBREE_LIBRARY})
jalencato commented 2 years ago

Nothing changes at all

BachiLi commented 2 years ago

if you do

make clean
make VERBOSE=1

what do you see?

jalencato commented 2 years ago

/usr/local/Cellar/cmake/3.22.1/bin/cmake -E cmake_link_script CMakeFiles/lajolla.dir/link.txt --verbose=1 /Library/Developer/CommandLineTools/usr/bin/c++ -O2 -g -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/lajolla.dir/src/main.cpp.o -o lajolla liblajolla_lib.a Undefined symbols for architecture x86_64: "_rtcAttachGeometry", referenced from: register_embree_op::operator()(Sphere const&) const in liblajolla_lib.a(shape.cpp.o) register_embree_op::operator()(TriangleMesh const&) const in liblajolla_lib.a(shape.cpp.o) decltype(auto) std::1::variant_detail::visitation::base::dispatcher<0ul>::dispatch<std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&>(std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&) in liblajolla_lib.a(shape.cpp.o) "_rtcCommitGeometry", referenced from: register_embree_op::operator()(Sphere const&) const in liblajolla_lib.a(shape.cpp.o) register_embree_op::operator()(TriangleMesh const&) const in liblajolla_lib.a(shape.cpp.o) decltype(auto) std::1::variant_detail::visitation::base::dispatcher<0ul>::dispatch<std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&>(std::1::variant_detail::visitation::variant::value_visitor&&, std::1::variant_detail::base<(std::1::variant_detail::_Trait)1, Sphere, TriangleMesh> const&) in liblajolla_lib.a(shape.cpp.o)

BachiLi commented 2 years ago

This issue was automatically closed by the PR above. Reopen if it doesn't work.