Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX compile fix #148

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

OSX compile fix #148

wants to merge 3 commits into from

Conversation

pavan4
Copy link

@pavan4 pavan4 commented Jun 9, 2020

  • Fixes the compilation issue on OSX Catalina
  • Need to install openmp and tbb using: brew install tbb libomp
  • Assumes tbb and omp libraries are in /usr/local/include else specify path in CMakeLists.txt

@ndahlquist
Copy link

Confirmed this fixes the issue on OS X for me. Thank you so much @pavan4 !

@cpheinrich cpheinrich mentioned this pull request Aug 6, 2020
@CodeAunt
Copy link

CodeAunt commented Mar 27, 2022

  • Fixes the compilation issue on OSX Catalina
  • Need to install openmp and tbb using: brew install tbb libomp
  • Assumes tbb and omp libraries are in /usr/local/include else specify path in CMakeLists.txt

my tbb is installed in /opt/homebrew/Cellar/tbb@2020/ as tbb@2020 and I failed to compile the project where I use tbb. It seems that CMake fail to recognize it. And /opt/homebrew/include/openapi is an empty directory.

the new tbb@2021 differs to 2020 version a lot.

using Monterey and apple m1 chip

@pavan4
Copy link
Author

pavan4 commented Mar 29, 2022

@CodeAunt yes you are right. This PR is not updated for the latest OSX updates. The latest tbb changes (openapi) require a lot of changes. I will take a stab at it and try tp put a PR but I have resorted to running this on a docker container with Ubuntu base on OSX and pinned all the repositories to old versions (for tbb etc.,.)

@CodeAunt
Copy link

@CodeAunt yes you are right. This PR is not updated for the latest OSX updates. The latest tbb changes (openapi) require a lot of changes. I will take a stab at it and try tp put a PR but I have resorted to running this on a docker container with Ubuntu base on OSX and pinned all the repositories to old versions (for tbb etc.,.)

Thanks for your advice and work. I also started trying to deploy it on Ubuntu.

@CodeAunt
Copy link

@pavan4 Hi, I'm using ubuntu now, but still encountered this problem. And the error after executing make -j:

[ 98%] Building CXX object apps/texrecon/CMakeFiles/texrecon.dir/texrecon.cpp.o
/home/jessie/Desktop/mvs-texturing/apps/texrecon/texrecon.cpp: In function ‘int main(int, char**)’:
/home/jessie/Desktop/mvs-texturing/apps/texrecon/texrecon.cpp:110:42: warning: catching polymorphic type ‘class util::FileException’ by value [-Wcatch-value=]
  110 |             } catch (util::FileException e) {
      |                                          ^
[100%] Linking CXX executable texrecon
/usr/bin/ld: CMakeFiles/texrecon.dir/texrecon.cpp.o: in function `tbb::task_scheduler_init::~task_scheduler_init()':
/usr/local/include/tbb/task_scheduler_init.h:128: undefined reference to `tbb::task_scheduler_init::terminate()'
/usr/bin/ld: CMakeFiles/texrecon.dir/texrecon.cpp.o: in function `tbb::task_scheduler_init::task_scheduler_init(int, unsigned long)':
/usr/local/include/tbb/task_scheduler_init.h:122: undefined reference to `tbb::task_scheduler_init::initialize(int, unsigned long)'
...

Stuck with the same problem :(
I'm using:
Ubuntu 18.04
tbb 2020.1-2 installed from sudo apt-get install libtbb-dev
tried tbb from earlier release but tbb_config.cmake file is not found after compiling.
And I could not find tbb in /usr/local/include after sudo apt-get install libtbb-dev

Could you please give me some advice about this? Thanks

@CodeAunt
Copy link

@pavan4 Hi, I also failed to compile this on ubuntu 18.04 docker container.
Could you please help with the configure process about:

pinned all the repositories to old versions (for tbb etc.,.)"

I'm using:

$ apt list libtbb-dev
libtbb-dev/bionic,now 2017~U7-8 arm64

@pavan4
Copy link
Author

pavan4 commented Apr 13, 2022

@CodeAunt I'll leave a dockerfile here for you to create a reproducible build. Hopefully, this helps you

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -qq update && apt-get -y -qq install \
    cmake \
    build-essential \
    libpng-dev \
    libjpeg-dev \
    libtiff-dev \
    libtbb-dev \
    git \
    freeglut3-dev \
    libglib2.0-0

RUN git clone https://github.com/nmoehrle/mvs-texturing.git
RUN cd mvs-texturing && mkdir build && cd build && \
    cmake .. && \
    make -j && make install

I'm not sure what machine you are using or what your error is. You can change the base to 20.04 as well (I have tried and tested both)

@CodeAunt
Copy link

@pavan4 Thanks, I have built it successfully on an arm64 device by removing -mfpmath=sse and other similar options in CMakeLists and Makefiles. The docker file will help me on x64 devices later🙏🏻.

$ git diff CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0006c0..a2d4bc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,11 @@
 cmake_minimum_required(VERSION 3.1)
 
-LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/elibs/tbb")
-
 project(Texturing)
 include(ExternalProject)
 
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/elibs/tbb")
+find_package(TBB REQUIRED)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0006c0..a2d4bc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,11 @@
 cmake_minimum_required(VERSION 3.1)
 
-LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/elibs/tbb")
-
 project(Texturing)
 include(ExternalProject)
 
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/elibs/tbb")
+find_package(TBB REQUIRED)
 include(ExternalProject)
 
+LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/elibs/tbb")
+find_package(TBB REQUIRED)
+
 if(NOT CMAKE_BUILD_TYPE)
     message(STATUS "Setting build type to 'RELWITHDEBINFO' as none was specified.")
     set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
@@ -13,7 +14,6 @@ endif()
 #Search for TBB library (release build)
 set(CMAKE_BUILD_TYPE_BACKUP ${CMAKE_BUILD_TYPE})
 set(CMAKE_BUILD_TYPE RELEASE)
-FIND_PACKAGE(TBB REQUIRED)
 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_BACKUP})
 
 set(CMAKE_CXX_STANDARD 11)
@@ -29,13 +29,14 @@ endif()
 
 if(CMAKE_COMPILER_IS_GNUCXX)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Wundef -pedantic")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -funroll-loops")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funroll-loops")
 endif()
 
 find_package(PNG REQUIRED)
 find_package(JPEG REQUIRED)
 find_package(TIFF REQUIRED)
 
 add_subdirectory(elibs)
 include_directories(SYSTEM
     ${CMAKE_SOURCE_DIR}/elibs/rayint/libs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants