PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
10.01k stars 4.62k forks source link

[compile error] "posix_fallocate not available on OpenBSD" #5950

Closed thyssentishman closed 9 months ago

thyssentishman commented 9 months ago

Describe the error

I'm trying to port PCL to OpenBSD and I'm running into the following error when compiling:

FAILED: io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o 
/usr/ports/pobj/pcl-1.14.0/bin/c++ -DHAVE_PCAP -DPCLAPI_EXPORTS -I/usr/ports/pobj/pcl-1.14.0/build-amd64/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/common/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/octree/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/openni/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/openni2/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/ensenso/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/davidSDK/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/dssdk/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/pcap/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/png/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/vtk/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/libusb/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/OpenMP/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include -isystem /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/recognition/include/pcl/recognition/3rdparty -isystem /usr/local/include -isystem /usr/local/include/eigen3 -O2 -pipe -DNDEBUG -std=c++14 -fPIC -MD -MT io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o -MF io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o.d -o io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o -c /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/src/pcd_grabber.cpp
In file included from /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/src/pcd_grabber.cpp:38:
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:186:25: error: no member named 'posix_fallocate' in the global namespace
      const int res = ::posix_fallocate(fd, 0, length);
                      ~~^
1 error generated.
ninja: build stopped: subcommand failed.

*** Error 1 in . (/usr/ports/devel/cmake/cmake.port.mk:46 'do-build')
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3055 '/usr/ports/pobj/pcl-1.14.0/build-amd64/.build_done')
*** Error 2 in /home/johannes/repos/ports/main/graphics/pcl (/usr/ports/infrastructure/mk/bsd.port.mk:2702 'all')

I believe that posix_fallocate is not yet (or will not be) available on OpenBSD. I bluntly tried to use the __APPLE__ workaround, but I had no success. Any other workarounds I could implement to fix this?

To Reproduce Try building PCL on OpenBSD.

Your Environment (please complete the following information):

mvieth commented 9 months ago

Interesting, on FreeBSD it seems to be available, based on what I have read. Have you tried pretending to be an ANDROID ? https://github.com/PointCloudLibrary/pcl/blob/master/io/include/pcl/io/low_level_io.h#L174 :smile:

thyssentishman commented 9 months ago

Have you tried pretending to be an ANDROID ?

Sadly it doesn't work either:

FAILED: io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o 
/usr/ports/pobj/pcl-1.14.0/bin/c++ -DHAVE_PCAP -DPCLAPI_EXPORTS -I/usr/ports/pobj/pcl-1.14.0/build-amd64/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/common/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/octree/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/openni/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/openni2/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/ensenso/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/davidSDK/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/dssdk/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/pcap/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/png/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/vtk/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/libusb/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/OpenMP/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include -isystem /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/recognition/include/pcl/recognition/3rdparty -isystem /usr/local/include -isystem /usr/local/include/eigen3 -O2 -pipe -DNDEBUG -std=c++14 -fPIC -MD -MT io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o -MF io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o.d -o io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o -c /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/src/pcd_grabber.cpp
In file included from /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/src/pcd_grabber.cpp:38:
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:176:13: error: no member named 'fallocate' in the global namespace
      if (::fallocate(fd, 0, 0, length) == 0)
          ~~^
1 error generated.
ninja: build stopped: subcommand failed.

*** Error 1 in . (/usr/ports/devel/cmake/cmake.port.mk:46 'do-build')
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3055 '/usr/ports/pobj/pcl-1.14.0/build-amd64/.build_done')
*** Error 2 in /home/johannes/repos/ports/main/graphics/pcl (/usr/ports/infrastructure/mk/bsd.port.mk:2702 'all')

EDIT: Just found this, maybe it helps?

mvieth commented 9 months ago

EDIT: Just found this, maybe it helps?

I will have a look

I bluntly tried to use the __APPLE__ workaround, but I had no success

What happened? Another compiler error?

thyssentishman commented 9 months ago

I bluntly tried to use the __APPLE__ workaround, but I had no success

What happened? Another compiler error?

Here the error when using the __APPLE__ workaround:

FAILED: io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o 
/usr/ports/pobj/pcl-1.14.0/bin/c++ -DHAVE_PCAP -DPCLAPI_EXPORTS -I/usr/ports/pobj/pcl-1.14.0/build-amd64/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/common/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/octree/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/openni/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/openni2/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/ensenso/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/davidSDK/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/dssdk/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/pcap/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/png/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/vtk/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/libusb/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/OpenMP/include -I/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include -isystem /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/recognition/include/pcl/recognition/3rdparty -isystem /usr/local/include -isystem /usr/local/include/eigen3 -O2 -pipe -DNDEBUG -std=c++14 -fPIC -MD -MT io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o -MF io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o.d -o io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o -c /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/src/pcd_grabber.cpp
In file included from /usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/src/pcd_grabber.cpp:38:
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:158:9: error: no type named 'fstore_t' in the global namespace
      ::fstore_t store = {F_ALLOCATEALL | F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, length, 0};
      ~~^
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:158:27: error: use of undeclared identifier 'F_ALLOCATEALL'
      ::fstore_t store = {F_ALLOCATEALL | F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, length, 0};
                          ^
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:158:43: error: use of undeclared identifier 'F_ALLOCATECONTIG'
      ::fstore_t store = {F_ALLOCATEALL | F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, length, 0};
                                          ^
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:158:61: error: use of undeclared identifier 'F_PEOFPOSMODE'
      ::fstore_t store = {F_ALLOCATEALL | F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, length, 0};
                                                            ^
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:159:23: error: use of undeclared identifier 'F_PREALLOCATE'
      if (::fcntl(fd, F_PREALLOCATE, &store) != -1)
                      ^
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:163:25: error: use of undeclared identifier 'F_ALLOCATEALL'
      store.fst_flags = F_ALLOCATEALL;
                        ^
/usr/ports/pobj/pcl-1.14.0/pcl-pcl-1.14.0/io/include/pcl/io/low_level_io.h:164:23: error: use of undeclared identifier 'F_PREALLOCATE'
      if (::fcntl(fd, F_PREALLOCATE, &store) != -1)
                      ^
7 errors generated.
ninja: build stopped: subcommand failed.

*** Error 1 in . (/usr/ports/devel/cmake/cmake.port.mk:46 'do-build')
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3055 '/usr/ports/pobj/pcl-1.14.0/build-amd64/.build_done')
*** Error 2 in /home/johannes/repos/ports/main/graphics/pcl (/usr/ports/infrastructure/mk/bsd.port.mk:2702 'all')
mvieth commented 9 months ago

@thyssentishman Can you test if https://github.com/PointCloudLibrary/pcl/pull/5957 solves your problem?

thyssentishman commented 9 months ago

@thyssentishman Can you test if #5957 solves your probl

Yes, it does! And with that pcl finishes to compile. I have the port ready for submission now. Thank you very much.