Revopoint / 3DViewer

GNU General Public License v3.0
21 stars 5 forks source link

OpenMP error while executing CMake command in macOS #7

Open crosswick opened 1 year ago

crosswick commented 1 year ago

Hi, I'm getting this error:

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FindOpenMP.cmake:577 (find_package_handle_standard_args)
  CMakeLists.txt:40 (find_package)

It seems similar to this issue which was resolved, I think by changing how the x64/arm64 platforms are handled: https://github.com/alpaka-group/alpaka/issues/1821

crosswick commented 1 year ago

I have tried the same on my Intel macOS 12.6.6 machine and am getting the same error.

Here are my steps:

which yields again the error:

CMake Error at /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindOpenMP.cmake:577 (find_package_handle_standard_args)
  CMakeLists.txt:40 (find_package)
Revopoint commented 1 year ago

Hi, You need to install the OpenMP. Use the following command to install, and then recompile.

crosswick commented 1 year ago

Thank you - this made no change unfortunately, I still get the same error on both systems.

Revopoint commented 1 year ago

Have you deleted the generated build files and then re-executed the CMake build for the project? If you haven't deleted the files, please do so, and then re-execute CMake.

crosswick commented 1 year ago

I have now deleted the contents of the /build directory and re-executed the cmake build; this is the result in the terminal:

-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FindOpenMP.cmake:577 (find_package_handle_standard_args)
  CMakeLists.txt:40 (find_package)

-- Configuring incomplete, errors occurred!

I still wonder whether it is a similar issue to the one I linked above: https://github.com/alpaka-group/alpaka/issues/1821

Revopoint commented 1 year ago

I have some suggestions on my side. Here are the suggestions:

If you have successfully installed OpenMP (omp) using brew install libomp on macOS, but CMake's find_package(OpenMP REQUIRED) still cannot find OpenMP, it may be due to the following reasons:

  1. Cache issue: CMake uses a cache to store previous search results. When using find_package, if the previous search result is already cached, CMake will not re-run the search. In this case, even if OpenMP is correctly installed, CMake may fail to find it. To address this issue, you can try deleting the CMake-generated build directory and then re-run CMake to ensure it re-executes the search step.

  2. Environment variables issue: CMake may not be able to automatically detect the installation path of OpenMP. You can try setting the OMP_INCLUDE_PATH and OMP_LIBRARY_PATH environment variables before running the CMake command to instruct CMake to search for OpenMP. For example:

export OMP_INCLUDE_PATH="/usr/local/include"
export OMP_LIBRARY_PATH="/usr/local/lib"

Please adjust the actual installation paths of OpenMP accordingly.

Revopoint commented 1 year ago

If you still can't resolve the issue, you can try updating the code of 3DViewer and switch to the 'no-omp' branch, where OpenMP is not enabled. Build the project from that branch, and then address the OpenMP compilation issue separately.

crosswick commented 1 year ago

Still can't get it to work...

From the brew install libomp terminal output, I gathered this information on relevant folders:

==> Caveats
libomp is keg-only, which means it was not symlinked into /usr/local,
because it can override GCC headers and result in broken builds.

For compilers to find libomp you may need to set:
  export LDFLAGS="-L/usr/local/opt/libomp/lib"
  export CPPFLAGS="-I/usr/local/opt/libomp/include"
==> Summary
🍺  /usr/local/Cellar/libomp/16.0.5: 7 files, 1.7MB

pasting these two folders into your export commands did not work; the same with the /include and /lib folders found in the folder in the Summary; each time deleting the /build folder first.

edit: also tried the exact export commands from the Caveats info, and with the folder from the summary; no change.

I will now try the no-omp branch.

crosswick commented 1 year ago

The no-omp branch does compile but the app crashes immediately. From the problem report:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: '@rpath/QtOpenGL.framework/Versions/5/QtOpenGL'
Referenced from: '/Users/USER/*/libosgQOpenGL.3.6.5.dylib'
Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)

Perhaps you are able to arrange a fresh macOS 12.6.6 installation for testing at your end?

Revopoint commented 1 year ago

Sorry for the inconvenience, the reason it cannot run is that the dependent library cannot be found. You need to copy the dependency library to '3DViewer.app/Contents/Frameworks'. Please execute the following script:

# run in build/bin
lib_dir=3DViewer.app/Contents/Frameworks
thirdparty=../../thirdparty
mkdir $lib_dir

cp $thirdparty/3DCamera/mac/x64/lib3DCamera.dylib $lib_dir
cp -R $thirdparty/osg3.6.5/mac/lib/*.dylib $lib_dir
cp -R $PWD/../../thirdparty/libpng/mac/lib/*.dylib $lib_dir
cp -R $PWD/../../thirdparty/quazip/mac/lib/*.dylib $lib_dir
cp -R $PWD/../../thirdparty/yaml-cpp0.6.0/mac/lib/*.dylib $lib_dir

# set $Qt5_ROOT=
# For example :/Users/mac/Qt5.10.1/5.10.1/clang_64
$Qt5_ROOT/bin/macdeployqt 3DViewer.app
crosswick commented 1 year ago

I cannot get this to work either; also I presumably do need OpenMP acceleration for my app, so the no-omp branch/app is not really an option for me.

I would rather wait now for a turn-key solution, a step-by-step guide that works on a fresh and up-to-date macOS 12.6.6 installation, please.

Again, I hope you have investigated the points raised in https://github.com/alpaka-group/alpaka/issues/1821

crosswick commented 1 year ago

I'm sorry but I cannot. I have replicated those exact steps and still get the original error.

steven@Mac-Pro-van-Steven ~ % mkdir ~/3DViewer-git
steven@Mac-Pro-van-Steven ~ % cd ~/3DViewer-git
steven@Mac-Pro-van-Steven 3DViewer-git % git clone https://github.com/Revopoint/3DViewer.git
Cloning into '3DViewer'...
remote: Enumerating objects: 2999, done.
remote: Counting objects: 100% (63/63), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 2999 (delta 1), reused 4 (delta 1), pack-reused 2936
Receiving objects: 100% (2999/2999), 268.49 MiB | 1.74 MiB/s, done.
Resolving deltas: 100% (1537/1537), done.
Updating files: 100% (2630/2630), done.
steven@Mac-Pro-van-Steven 3DViewer-git % ls
3DViewer
steven@Mac-Pro-van-Steven 3DViewer-git % cd 3DViewer
steven@Mac-Pro-van-Steven 3DViewer % cd ..
steven@Mac-Pro-van-Steven 3DViewer-git % mkdir 3DViewer/build
steven@Mac-Pro-van-Steven 3DViewer-git % cd 3DViewer/build
steven@Mac-Pro-van-Steven build % export LDFLAGS="-L/usr/local/opt/libomp/lib"
steven@Mac-Pro-van-Steven build % export CPPFLAGS="-I/usr/local/opt/libomp/include"
steven@Mac-Pro-van-Steven build % cmake -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/FindOpenMP.cmake:577 (find_package_handle_standard_args)
  CMakeLists.txt:40 (find_package)

-- Configuring incomplete, errors occurred!
steven@Mac-Pro-van-Steven build % 
Revopoint commented 1 year ago

Still can't get it to work...

From the brew install libomp terminal output, I gathered this information on relevant folders:

==> Caveats
libomp is keg-only, which means it was not symlinked into /usr/local,
because it can override GCC headers and result in broken builds.

For compilers to find libomp you may need to set:
  export LDFLAGS="-L/usr/local/opt/libomp/lib"
  export CPPFLAGS="-I/usr/local/opt/libomp/include"
==> Summary
🍺  /usr/local/Cellar/libomp/16.0.5: 7 files, 1.7MB

pasting these two folders into your export commands did not work; the same with the /include and /lib folders found in the folder in the Summary; each time deleting the /build folder first.

edit: also tried the exact export commands from the Caveats info, and with the folder from the summary; no change.

I will now try the no-omp branch.

Please try the following command to see if it can solve your problem.

cmake -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/  -DCMAKE_PREFIX_PATH=/usr/local/opt/libomp
or
cmake -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/  -DCMAKE_PREFIX_PATH=/usr/local/Cellar/libomp/16.0.5
Revopoint commented 1 year ago

Still can't get it to work... From the brew install libomp terminal output, I gathered this information on relevant folders:

==> Caveats
libomp is keg-only, which means it was not symlinked into /usr/local,
because it can override GCC headers and result in broken builds.

For compilers to find libomp you may need to set:
  export LDFLAGS="-L/usr/local/opt/libomp/lib"
  export CPPFLAGS="-I/usr/local/opt/libomp/include"
==> Summary
🍺  /usr/local/Cellar/libomp/16.0.5: 7 files, 1.7MB

pasting these two folders into your export commands did not work; the same with the /include and /lib folders found in the folder in the Summary; each time deleting the /build folder first. edit: also tried the exact export commands from the Caveats info, and with the folder from the summary; no change. I will now try the no-omp branch.

Please try the following command to see if it can solve your problem.

cmake -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/  -DCMAKE_PREFIX_PATH=/usr/local/opt/libomp
or
cmake -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/  -DCMAKE_PREFIX_PATH=/usr/local/Cellar/libomp/16.0.5

Please make sure that the libomp.a and libomp.dylib library files can be found in the /usr/local/opt/libomp/lib directory.

crosswick commented 1 year ago

Progress! Both command work on my Intel Mac; the resulting 3DViewer app immediately crashes again, though, with in the Problem Report:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: '@rpath/QtOpenGL.framework/Versions/5/QtOpenGL'
Referenced from: '/Users/USER/*/libosgQOpenGL.3.6.5.dylib'
Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)

Please make sure that the libomp.a and libomp.dylib library files can be found in the /usr/local/opt/libomp/lib directory.

They can, yes.

Revopoint commented 1 year ago

Progress! Both command work on my Intel Mac; the resulting 3DViewer app immediately crashes again, though, with in the Problem Report:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: '@rpath/QtOpenGL.framework/Versions/5/QtOpenGL'
Referenced from: '/Users/USER/*/libosgQOpenGL.3.6.5.dylib'
Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)

Please make sure that the libomp.a and libomp.dylib library files can be found in the /usr/local/opt/libomp/lib directory.

They can, yes.

This is because 3DViewer cannot find third-party libraries such as osg. You need to manually copy them to the rpath path of 3DViewer.app. The following command can achieve the copying. This part will be optimized later to address this issue.

# run in build/bin
lib_dir=3DViewer.app/Contents/Frameworks
thirdparty=../../thirdparty
mkdir $lib_dir

cp $thirdparty/3DCamera/mac/x64/lib3DCamera.dylib $lib_dir
cp -R $thirdparty/osg3.6.5/mac/lib/*.dylib $lib_dir
cp -R $PWD/../../thirdparty/libpng/mac/lib/*.dylib $lib_dir
cp -R $PWD/../../thirdparty/quazip/mac/lib/*.dylib $lib_dir
cp -R $PWD/../../thirdparty/yaml-cpp0.6.0/mac/lib/*.dylib $lib_dir

# set $Qt5_ROOT=
# For example :/Users/mac/Qt5.10.1/5.10.1/clang_64
$Qt5_ROOT/bin/macdeployqt 3DViewer.app
crosswick commented 1 year ago

I see; I'm having some trouble with that last statement. I do see this file:

/usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt

so without the clang_64 subdirectory, perhaps this is needed?

Executing the entire statement yields:

steven@Mac-Pro-van-Steven bin % /usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt 3DViewer.app
Error: Could not find app bundle "3DViewer.app"
Revopoint commented 1 year ago

I see; I'm having some trouble with that last statement. I do see this file:

/usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt

so without the clang_64 subdirectory, perhaps this is needed?

Executing the entire statement yields:

steven@Mac-Pro-van-Steven bin % /usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt 3DViewer.app
Error: Could not find app bundle "3DViewer.app"

clang_64 is not necessary. You can directly run 3DViewer.app before executing macdeployqt. If it runs without any issues, there is no need to execute macdeployqt. If you encounter any problems during execution, please provide me with the error information.

crosswick commented 1 year ago

Still the same errors I'm afraid. When directly running 3DViewer.app:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: '@rpath/QtOpenGL.framework/Versions/5/QtOpenGL'
Referenced from: '/Users/USER/*/libosgQOpenGL.3.6.5.dylib'
Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)

I can't get the macdeployqt command to work, still:

steven@Mac-Pro-van-Steven bin % /usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt 3DViewer.app
Error: Could not find app bundle "3DViewer.app"
crosswick commented 1 year ago

Ah, but this does work:

steven@Mac-Pro-van-Steven bin % /usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt /Users/steven/3DViewer-git/3DViewer/build/bin/3DViewer.app
ERROR: Cannot resolve rpath "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
ERROR: Cannot resolve rpath "@rpath/QtWidgets.framework/Versions/5/QtWidgets"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
ERROR: Cannot resolve rpath "@rpath/QtGui.framework/Versions/5/QtGui"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
ERROR: Cannot resolve rpath "@rpath/QtCore.framework/Versions/5/QtCore"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
steven@Mac-Pro-van-Steven bin %

3DViewer.app does work now - thank you.

So I guess the issue is closed now... although it might be good to leave it open for now, until a new version is ready?

crosswick commented 1 year ago

At least... it works on my Intel 12.6.6 macOS system now.

On my arm64 Macbook, this cmake command works:

steven@Stevens-MacBook-Pro-2 build % cmake -DQt5_DIR=/opt/homebrew/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/ -DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libomp/16.0.5

but then when running make, it runs into these errors:

Undefined symbols for architecture arm64:
  "_png_create_info_struct", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_create_read_struct", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_create_write_struct", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_destroy_read_struct", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_destroy_write_struct", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_get_bit_depth", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_image_height", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_image_width", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_io_ptr", referenced from:
      readPngDataCallBack(png_struct_def*, unsigned char*, unsigned long) in imageutil.cpp.o
  "_png_get_rowbytes", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_rows", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_init_io", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_read_png", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_IHDR", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_set_longjmp_fn", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_read_fn", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_sig_bytes", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_swap", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_sig_cmp", referenced from:
      checkIsPng(__sFILE*) in imageutil.cpp.o
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_write_end", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_write_info", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_write_row", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libcsutil.dylib] Error 1
make[1]: *** [csutil/CMakeFiles/csutil.dir/all] Error 2
make: *** [all] Error 2
Revopoint commented 1 year ago

Ah, but this does work:

steven@Mac-Pro-van-Steven bin % /usr/local/Cellar/qt@5/5.15.9/bin/macdeployqt /Users/steven/3DViewer-git/3DViewer/build/bin/3DViewer.app
ERROR: Cannot resolve rpath "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
ERROR: Cannot resolve rpath "@rpath/QtWidgets.framework/Versions/5/QtWidgets"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
ERROR: Cannot resolve rpath "@rpath/QtGui.framework/Versions/5/QtGui"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
ERROR: Cannot resolve rpath "@rpath/QtCore.framework/Versions/5/QtCore"
ERROR:  using QSet("/Users/steven/3DViewer-git/3DViewer/src/../thirdparty/osg3.6.5/mac/lib")
steven@Mac-Pro-van-Steven bin %

3DViewer.app does work now - thank you.

So I guess the issue is closed now... although it might be good to leave it open for now, until a new version is ready?

Ok, we will update the new version on GitHub as soon as possible.

Revopoint commented 1 year ago

At least... it works on my Intel 12.6.6 macOS system now.

On my arm64 Macbook, this cmake command works:

steven@Stevens-MacBook-Pro-2 build % cmake -DQt5_DIR=/opt/homebrew/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/ -DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libomp/16.0.5

but then when running make, it runs into these errors:

Undefined symbols for architecture arm64:
  "_png_create_info_struct", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_create_read_struct", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_create_write_struct", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_destroy_read_struct", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_destroy_write_struct", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_get_bit_depth", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_image_height", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_image_width", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_io_ptr", referenced from:
      readPngDataCallBack(png_struct_def*, unsigned char*, unsigned long) in imageutil.cpp.o
  "_png_get_rowbytes", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_get_rows", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_init_io", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_read_png", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_IHDR", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_set_longjmp_fn", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_read_fn", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_sig_bytes", referenced from:
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_set_swap", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_sig_cmp", referenced from:
      checkIsPng(__sFILE*) in imageutil.cpp.o
      ImageUtil::genPixDataFromPngData(QByteArray, int&, int&, int&, QByteArray&) in imageutil.cpp.o
  "_png_write_end", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_write_info", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
  "_png_write_row", referenced from:
      ImageUtil::saveGrayScale16ByLibpng(int, int, QByteArray, QString) in imageutil.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libcsutil.dylib] Error 1
make[1]: *** [csutil/CMakeFiles/csutil.dir/all] Error 2
make: *** [all] Error 2

This is because the third-party libraries in the 'thirdparty' directory are compiled for the amd64 platform and are currently not compatible with compilation for arm64.

We will update the arm64 version of 3DCamera and other third-party libraries on GitHub, but we kindly ask for your patience and give us some time to do so.

crosswick commented 11 months ago

Hello, just to check: is there progress on the arm64 version, please? My quick attempt with version 1.2.16 was not successful.

crosswick commented 11 months ago

Ah, I'm getting the same error on my Intel machine:

steven@Mac-Pro-van-Steven build % cmake -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.9/lib/cmake/Qt5 ../src/
-- --Current platform: mac
Updating '/Users/steven/3DViewer/src/csviewer/translations/lang_en.qm'...
    Generated 10 translation(s) (0 finished and 10 unfinished)
    Ignored 187 untranslated source text(s)
Updating '/Users/steven/3DViewer/src/csviewer/translations/lang_zh.qm'...
    Generated 174 translation(s) (0 finished and 174 unfinished)
    Ignored 23 untranslated source text(s)
-- --Target OS:mac
-- --Target Platform:x64
-- --C Complier:/usr/bin/clang
-- --CXX Complier:/usr/bin/clang++
-- --C FLAGS:
-- --CXX FLAGS:
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/steven/3DViewer/build
steven@Mac-Pro-van-Steven build % make
make: *** No targets specified and no makefile found.  Stop.
crosswick commented 11 months ago

After deleting the build folder and trying again, it does create a Makefile. Odd.

In the meantime, I'm getting good help from GPT on configuring the correct libpng version for arm64.

Revopoint commented 11 months ago

Hello, just to check: is there progress on the arm64 version, please? My quick attempt with version 1.2.16 was not successful.

I'm sorry, there is currently no arm64 3DCamera SDK available for MacOS.

crosswick commented 11 months ago

I understand - could you please give me an estimate on when it will be available? Two months ago you indicated that you would update the arm64 version of 3DCamera and other third-party libraries on GitHub...

As you will undoubtedly know, running natively on Apple Silicon has large benefits for a 3D data processing application (which uses your API), seen as an Intel app running through Rosetta 2 can only access a fraction of the GPU power available.

Revopoint commented 11 months ago

We plan to release the macOS arm64 version of 3DCamera by the end of September. Please be patient and wait.

crosswick commented 11 months ago

That's great, thank you for letting me know.

crosswick commented 10 months ago

Good day - perhaps useful to know: for my current prototype, I have decided to take a non-realtime approach; I therefor have no great hurry myself right now to be able to compile with the 3DCamera library on darwin-arm64.

Revopoint commented 10 months ago

Thank you for your understanding. I'd like to mention that the development and testing of the darwin-arm64 3DCamera library will take some time. If you're not in a hurry to use it, I will do my best to ensure the quality of the library and will notify you promptly when it's ready.

crosswick commented 10 months ago

Great. In the mean time I have thought of a possible workaround, which might be interesting to explore for others as well: create an Pangolin video driver in X64/Rosetta and stream depth or point cloud data from that to a native arm64 app.

https://github.com/stevenlovegrove/Pangolin/tree/master/components/pango_video/include/pangolin/video/drivers