potree / PotreeConverter

Create multi res point cloud to use with potree
http://potree.org
BSD 2-Clause "Simplified" License
679 stars 423 forks source link

MacOS Sierra: fatal error: 'experimental/filesystem' file not found #260

Closed chyang0107 closed 4 years ago

chyang0107 commented 7 years ago

Hi all,

I appreciate your time in advance. I am really interested in the Potree; however, I have little experience by using the command line and CMake at MacOS Sierra version 10.12.6. I failed to install the PotreeConverter at the final step "make". The error message picture is listed below

screen shot 2017-08-03 at 11 29 32 am

I follow the steps in the the post to run the CMake in the command line(https://github.com/travis-ci/travis-ci/issues/2175)[CMake command not found in OSX build environment].

I installed the Homebrew then

I also have no idea what the binary working directory means. It would be appreciated if you all could tell me the directory location. The picture below is the folder structure in my Mac.

screen shot 2017-08-03 at 11 42 30 am

Let me know if you have any idea how to address the fatal error and show me the location of binary working directory.

Many thanks, Hank

mhaffner commented 7 years ago

I can confirm a similar (possibly same) issue on GNU/Linux (Manjaro). After building lastools, I receive the following error on the make step when building PotreeConverter as described in the README. Here is the error:

$ make [ 8%] Building CXX object PotreeConverter/CMakeFiles/PotreeConverter.dir/src/PotreeConverter.cpp.o In file included from /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/src/PotreeConverter.cpp:14:0: /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/include/PotreeWriter.h:78:21: error: ‘std::function’ has not been declared void traverse(std::function<void(PWNode*)> callback); ^~~~~~~~ /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/include/PotreeWriter.h:78:29: error: expected ‘,’ or ‘...’ before ‘<’ token void traverse(std::function<void(PWNode*)> callback); ^ /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/include/PotreeWriter.h:80:33: error: ‘std::function’ has not been declared void traverseBreadthFirst(std::function<void(PWNode*)> callback); ^~~~~~~~ /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/include/PotreeWriter.h:80:41: error: expected ‘,’ or ‘...’ before ‘<’ token void traverseBreadthFirst(std::function<void(PWNode*)> callback); ^ /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/src/PotreeConverter.cpp: In function ‘void Potree::writeSources(std::__cxx11::string, std::vector<std::__cxx11::basic_string<char> >, std::vector<int>, std::vector<Potree::AABB>, std::__cxx11::string)’: /home/matt/dev/workspaces/PotreeConverter/master/PotreeConverter/src/PotreeConverter.cpp:260:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < sourceFilenames.size(); i++){ ~~^~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [PotreeConverter/CMakeFiles/PotreeConverter.dir/build.make:207: PotreeConverter/CMakeFiles/PotreeConverter.dir/src/PotreeConverter.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:86: PotreeConverter/CMakeFiles/PotreeConverter.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

mhaffner commented 7 years ago

Could it be that /dev/workspaces/lastools/master/LASzip/dll and ~/dev/workspaces/lastools/master/LASzip/build/src/liblaszip.so are no longer compatible with PotreeConverter? Since the master branch of lastools may have changed?

martinheidegger commented 7 years ago

Just researching this issue: experimental/filesystem is part of gcc since gcc 5.3: https://isocpp.org/files/papers/P0218r1.html and the version of gcc usually available on mac is 4.2.1. For a mac build we would need to replace all experimental/filesystem code with a different, cross platform, implementation. Any help or PR in that direction is welcome (though I am researching this atm. I will post any progress)

m-schuetz commented 7 years ago

Boost was used before but it's a headache to integrate which is why I switched to the standard experimental/filesystem. What about clang? Shouldn't that be up to date on mac? Travis passes with gcc 6 and clang 4, as far as I remember.

martinheidegger commented 7 years ago

I need to get to a better internet connection before I can make sure that I used the latest version of XCode for everything. But what I can say is that I can't get it to work with XCode 4.1 and that a correct installation of clang/g++ with homebrew is a extremely uncomfortable (and I havn't managed to get that up&running yet as well, the things I installed are g++ from gcc and not clang). Not having to do any installation work would be preferable.

I did consider rewriting the parsers & writers to a stream based approach where the file operations could be done outside of the c code (i.e. in JavaScript 😉 ).

m-schuetz commented 7 years ago

I'd rather not have a lib for the filesystem part, though. It's in the standard, albeit experimental, and visual studio, gcc and clang all support it.

martinheidegger commented 7 years ago

How do you suggest to build it in a Mac?

On Aug 9, 2017 19:56, "Markus Schütz" notifications@github.com wrote:

I'd rather not have a lib for the filesystem part, though. It's in the standard, albeit experimental, and visual studio, gcc and clang all support it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/potree/PotreeConverter/issues/260#issuecomment-321332941, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3yytbyA4WjLD07XgxYCJgCGgtYiCt8ks5sWfLEgaJpZM4OstRQ .

m-schuetz commented 7 years ago

Update the mac compilers.

m-schuetz commented 7 years ago

Maybe someone experienced with compiling on macs can help? Filesystem is going to come to mac eventually, no reason to downgrade the converter now. The previous release uses boost so maybe that works better with macs in the meantime.

m-schuetz commented 7 years ago

I can't get it to work with XCode 4.1

It seems like there is already xcode version 8. Maybe that one works better. Here is the travis build that says it works with clang 4: https://travis-ci.org/potree/PotreeConverter/jobs/257462385 From what I've read, clang is the default compiler of xcode?

martinheidegger commented 7 years ago

I am use 8.3.3 now and it doesn't have support for either c++17 (supports c++1z though?!) nor the experimental apis. The XCode 9 beta 5 release notes give no indication to a change in this. experimental/filesystem seems to just not be supported.

Installing and/or using a custom (homebrew) g++ turned out to be complicated and generally not a good idea because, as you mentioned, clang is the default on mac and for tools not break it is generally a good idea for clang to be the compiler (though it does cause incompatibility issues because it is a semver major change from 3 -> 4). clang can be installed using brew install llvm --with-clang.

Now I am stuck with https://stackoverflow.com/questions/16352833/linking-with-clang-on-os-x-generates-lots-of-symbol-not-found-errors which is not solved through the solution suggested in the link.

potree commented 7 years ago

Here is a description on how to configure cmake to use g++ on mac: https://stackoverflow.com/questions/10504419/cmake-project-use-local-g-version

Let me know if that helps to compile PotreeConverter on mac.

martinheidegger commented 7 years ago

I have given up on it. Will try to find another solution.

cherukumilli commented 7 years ago

I am running into the same problem. I tried both ways (with g++ and without). I see the following error:

$ export CMAKE_C_COMPILER=/usr/bin/gcc

$ export CMAKE_CXX_COMPILER=/usr/bin/g++

$ export LASTOOLS=/Users/dc/projects/avitas/lastools/LAStools/LASzip

$ cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=$LASTOOLS/dll -DLASZIP_LIBRARY=$LASTOOLS/LASzip/build/src/liblaszip.dylib ..
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/dc/projects/avitas/PotreeConverter/build

$ make
[  8%] Building CXX object PotreeConverter/CMakeFiles/PotreeConverter.dir/src/BINPointReader.cpp.o
clang: warning: -Z-reserved-lib-stdc++: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
/Users/dc/projects/avitas/PotreeConverter/PotreeConverter/src/BINPointReader.cpp:6:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
         ^
1 error generated.
make[2]: *** [PotreeConverter/CMakeFiles/PotreeConverter.dir/src/BINPointReader.cpp.o] Error 1
make[1]: *** [PotreeConverter/CMakeFiles/PotreeConverter.dir/all] Error 2
make: *** [all] Error 2
m-schuetz commented 7 years ago

clang: warning: -Z-reserved-lib-stdc++: 'linker' input unused [-Wunused-command-line-argument] clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]

Sounds like it's still using clang. Are you sure that /usr/bin/g++ points to an up-to-date version of g++ and that it is actually being used by the make command?

cherukumilli commented 7 years ago

@m-schuetz Let me google how to find out if I am using the up to date version of g++. BTW: if you know how to do that then can you please send me the instructions? I am using a MAC OS Sierra. I just installed the latest version of x-code also.

ninaamenta commented 7 years ago

I'm having exactly the same problem compiling potree on OS/X. Glad it's not just me :-). If anybody figures out a work-around I would be glad to hear about it!

m-schuetz commented 6 years ago

I've been told that recent versions of xcode now support the filesystem API. Can someone confirm?

martinheidegger commented 6 years ago

Updated latest Mac OS & XCode & Command line tools. No luck with develop branch.

Note: wrong flags?

m-schuetz commented 6 years ago

I see, thanks for trying it out!

Note: wrong flags?

That could be the case, I'm not sure which flags to set, though.

docdawning commented 6 years ago

I just attempted this on macOS High Sierra 10.13.2, with XCode 9.2 installed and thus g++ --version is:

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Here's a copy & paste of basically the whole thing from my command line:

dumpster-imac:git j$ git clone https://github.com/m-schuetz/LAStools.git LAStools.git
Cloning into 'LAStools.git'...
remote: Counting objects: 1827, done.
remote: Total 1827 (delta 0), reused 0 (delta 0), pack-reused 1827
Receiving objects: 100% (1827/1827), 88.69 MiB | 2.51 MiB/s, done.
Resolving deltas: 100% (1307/1307), done.
Checking out files: 100% (499/499), done.
dumpster-imac:git j$ cd LAStools.git/LASzip/
dumpster-imac:LASzip j$ mkdir build
dumpster-imac:LASzip j$ cd build/
dumpster-imac:build j$ cmake -DCMAKE_BUILD_TYPE=Release ..
-bash: cmake: command not found
dumpster-imac:build j$ brew search cmake
==> Searching local taps...
cmake
==> Searching taps on GitHub...
caskroom/cask/cmake
==> Searching blacklisted, migrated and deleted formulae...
dumpster-imac:build j$ brew update;brew upgrade
Updated 1 tap (caskroom/cask).
No changes to formulae.
dumpster-imac:build j$ brew install cmake
==> Downloading https://homebrew.bintray.com/bottles/cmake-3.10.0.high_sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring cmake-3.10.0.high_sierra.bottle.1.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> Summary
🍺  /usr/local/Cellar/cmake/3.10.0: 2,333 files, 32.4MB
dumpster-imac:build j$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   laszip

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/j/git/LAStools.git/LASzip/build
dumpster-imac:build j$ make
Scanning dependencies of target laszip
[  5%] Building CXX object src/CMakeFiles/laszip.dir/arithmeticdecoder.cpp.o
[ 10%] Building CXX object src/CMakeFiles/laszip.dir/arithmeticencoder.cpp.o
[ 15%] Building CXX object src/CMakeFiles/laszip.dir/arithmeticmodel.cpp.o
[ 20%] Building CXX object src/CMakeFiles/laszip.dir/integercompressor.cpp.o
[ 25%] Building CXX object src/CMakeFiles/laszip.dir/lasindex.cpp.o
[ 30%] Building CXX object src/CMakeFiles/laszip.dir/lasinterval.cpp.o
[ 35%] Building CXX object src/CMakeFiles/laszip.dir/lasquadtree.cpp.o
[ 40%] Building CXX object src/CMakeFiles/laszip.dir/lasreaditemcompressed_v1.cpp.o
[ 45%] Building CXX object src/CMakeFiles/laszip.dir/lasreaditemcompressed_v2.cpp.o
[ 50%] Building CXX object src/CMakeFiles/laszip.dir/lasreaditemcompressed_v3.cpp.o
[ 55%] Building CXX object src/CMakeFiles/laszip.dir/lasreadpoint.cpp.o
[ 60%] Building CXX object src/CMakeFiles/laszip.dir/lasunzipper.cpp.o
[ 65%] Building CXX object src/CMakeFiles/laszip.dir/laswriteitemcompressed_v1.cpp.o
[ 70%] Building CXX object src/CMakeFiles/laszip.dir/laswriteitemcompressed_v2.cpp.o
[ 75%] Building CXX object src/CMakeFiles/laszip.dir/laswriteitemcompressed_v3.cpp.o
[ 80%] Building CXX object src/CMakeFiles/laszip.dir/laswritepoint.cpp.o
[ 85%] Building CXX object src/CMakeFiles/laszip.dir/laszip.cpp.o
[ 90%] Building CXX object src/CMakeFiles/laszip.dir/laszip_dll.cpp.o
/Users/j/git/LAStools.git/LASzip/src/laszip_dll.cpp:1699:168: warning: data argument not used by format string [-Wformat-extra-args]
          sprintf(laszip_dll->error, "inconsistent number_of_point_records %u and extended_number_of_point_records %%llu", laszip_dll->header.number_of_point_records, laszip_dll->header.extended_number_of_point_records);
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                              ^
/Users/j/git/LAStools.git/LASzip/src/laszip_dll.cpp:3820:165: warning: format specifies type 'unsigned long long' but the argument has type 'U32' (aka 'unsigned int') [-Wformat]
              fprintf(stderr,"WARNING: number_of_point_records is %u. but extended_number_of_point_records is %llu.\n", laszip_dll->header.number_of_point_records, number_of_extended_variable_length_records);
                                                                                                              ~~~~                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                              %u
2 warnings generated.
[ 95%] Building CXX object src/CMakeFiles/laszip.dir/laszipper.cpp.o
[100%] Linking CXX shared library liblaszip.dylib
[100%] Built target laszip
dumpster-imac:build j$ cd ../../../PotreeConverter.git/
dumpster-imac:PotreeConverter.git j$ mkdir build
dumpster-imac:PotreeConverter.git j$ cd build/
dumpster-imac:build j$ cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=[ABSOLUTE_PATH_TO_LASTOOLS]/master/LASzip/dll -DLASZIP_LIBRARY=/Users/j/git/LAStools.git/LASzip/build/src/liblaszip.dylib ..
dumpster-imac:build j$ vim run_cmake.sh
dumpster-imac:build j$ chmod +x run_cmake.sh 
dumpster-imac:build j$ ./run_cmake.sh 
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/j/git/PotreeConverter.git/build
dumpster-imac:build j$ make
Scanning dependencies of target PotreeConverter
[  8%] Building CXX object PotreeConverter/CMakeFiles/PotreeConverter.dir/src/BINPointReader.cpp.o
clang: warning: -Z-reserved-lib-stdc++: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
/Users/j/git/PotreeConverter.git/PotreeConverter/src/BINPointReader.cpp:6:10: fatal error: 'experimental/filesystem' file not found
#include <experimental/filesystem>
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [PotreeConverter/CMakeFiles/PotreeConverter.dir/src/BINPointReader.cpp.o] Error 1
make[1]: *** [PotreeConverter/CMakeFiles/PotreeConverter.dir/all] Error 2
make: *** [all] Error 2

Thus to this point, I can confirm this issue remains with the latest typical setup for macOS. I'll comment again if I get it going, I'll keep working on it.

jjPlusPlus commented 6 years ago

I can confirm that I was able to work around this issue on High Sierra 10.13.1, using (homebrew) gcc 7.2.0 and g++ 7.20.

The extra steps were (as mentioned in linked stackoverflow posts here) to update the PATH in .profile with:
export PATH=/usr/local/Cellar/gcc/7.2.0/bin:$PATH
export LC_ALL=C; unset LANGUAGE

It was also necessary to symlink the homebrew-syntax 'gcc-7' and 'g++-7' in /usr/local/Cellar/gcc/7.2.0/bin to 'gcc' and 'g++'

When running the PotreeConverter cmake script, it is necessary to add the DCMAKE_C_COMPILER and DCMAKE_CXX_COMPILER flags. My cmake script ended up looking like this:

cmake -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/7.2.0/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/7.2.0/bin/g++ -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=/Users/automator/Documents/dev/workspaces/lastools/master/LASzip/dll -DLASZIP_LIBRARY=/Users/automator/Documents/dev/workspaces/lastools/master/LASzip/build/src/liblaszip.dylib ..

tschoeni commented 6 years ago

Works with gcc-6 as well:

brew install gcc@6 cd /ABSOLUTE/PATH/TO/PotreeConverter/build cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=/ABSOLUTE/PATH/TO/LASlib/LASzip/dll/ -DLASZIP_LIBRARY=/ABSOLUTE/PATH/TO/LASlib/LASzip/build/src/liblaszip.dylib -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc\@6/6.4.0_1/bin/gcc-6 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc\@6/6.4.0_1/bin/g++-6 ..