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

add PointCloudLibrary (PCL) #2811

Merged
merged 11 commits into from
Apr 17, 2021
Merged

Conversation

Crghilardi
Copy link
Contributor

This PR adds a build_tarballs.jl for PCL

I have built successfully with linux-x86_64-glibc locally, have not tested other platforms.

As I tried to note in the script, I ran into a few issues while working on this locally that I was able to get around but they probably fall into the "hacky" category.

  1. Without first deleting the libgomp.so* products, CMake was returning a series of messages like:
CMake Warning at cmake/pcl_targets.cmake:222 (add_library):
  Cannot generate a safe runtime search path for target pcl_common because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libgomp.so.1] in /opt/x86_64-linux-gnu/x86_64-linux-gnu/lib64 may be hidden by files in:
      /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/lib

  Some of these libraries may not be found correctly.
Call Stack (most recent call first):
  common/CMakeLists.txt:176 (PCL_ADD_LIBRARY)

  1. Normally, there are a series of hardware checks that get done. This check is explicitly flagged with if(NOT CMAKE_CROSSCOMPILING) and requires the user to explicitly set cache flags if cross compiling. I couldn't figure out how to get this running, so I skipped it for now.
HAVE_MM_MALLOC
HAVE_POSIX_MEMALIGN
HAVE_SSE4_2_EXTENSIONS
HAVE_SSE4_1_EXTENSIONS
HAVE_SSSE3_EXTENSIONS
HAVE_SSE2_EXTENSIONS
HAVE_SSE_EXTENSIONS

Double checking spelling of Library and ExecutableProducts would also be appreciated, I got through about 15 of them before I realized you could just hit enter to use the default string....

@giordano
Copy link
Member

giordano commented Apr 11, 2021

  1. that's a warning, not an error, I think we can simply ignore it. It's true we have two libgomp, one in the compiler's directory (/opt/${target}/${target}/lib*) and one in the prefix (${libdir}, which has a symlink pointing to it in /opt/${target}/${target}/sys-root/usr/local/lib), but in practice it isn't a problem for us.
  2. for the options to specify manually, I need to look at the first two, for the extensions we can say we always have SSE and SSE2 for x86_64 platforms, for the others we'd need to build for different microarchitectures (but for the time being probably safer to say they aren't available)

@giordano
Copy link
Member

Next error I'm getting on Windows is

[ 21%] Linking CXX shared library ../bin/libpcl_io.dll
cd /workspace/srcdir/pcl/build/io && /usr/bin/cmake -E cmake_link_script CMakeFiles/pcl_io.dir/link.txt --verbose=true
/usr/bin/cmake -E rm -f CMakeFiles/pcl_io.dir/objects.a
/opt/bin/x86_64-w64-mingw32-libgfortran4-cxx11/x86_64-w64-mingw32-ar cr CMakeFiles/pcl_io.dir/objects.a @CMakeFiles/pcl_io.dir/objects1.rsp
/opt/bin/x86_64-w64-mingw32-libgfortran4-cxx11/x86_64-w64-mingw32-g++ --sysroot=/opt/x86_64-w64-mingw32/x86_64-w64-mingw32/sys-root/   -Wabi=11 -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion  -O3 -DNDEBUG -Wl,--as-needed -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--allow-multiple-definition -shared -o ../bin/libpcl_io.dll -Wl,--out-implib,../lib/libpcl_io.dll.a -Wl,--major-image-version,1,--minor-image-version,11 -Wl,--whole-archive CMakeFiles/pcl_io.dir/objects.a -Wl,--no-whole-archive @CMakeFiles/pcl_io.dir/linklibs.rsp
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x172): undefined reference to `__imp_WSAStartup'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x203): undefined reference to `__imp_bind'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x213): undefined reference to `__imp_setsockopt'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x1409): undefined reference to `__imp_ntohl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x1871): undefined reference to `__imp_WSARecvFrom'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x1882): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x1cf2): undefined reference to `__imp_ntohs'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text+0x1d48): undefined reference to `__imp_ntohl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail17winsock_init_base7cleanupERNS2_4dataE[_ZN5boost4asio6detail17winsock_init_base7cleanupERNS2_4dataE]+0x13): undefined reference to `__imp_WSACleanup'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops16clear_last_errorEv[_ZN5boost4asio6detail10socket_ops16clear_last_errorEv]+0x5): undefined reference to `__imp_WSASetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops4bindEyPK8sockaddryRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops4bindEyPK8sockaddryRNS_6system10error_codeE]+0x41): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops4sendEyPK7_WSABUFyiRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops4sendEyPK7_WSABUFyiRNS_6system10error_codeE]+0x52): undefined reference to `__imp_WSASend'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops4sendEyPK7_WSABUFyiRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops4sendEyPK7_WSABUFyiRNS_6system10error_codeE]+0x62): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops9poll_readEyhiRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops9poll_readEyhiRNS_6system10error_codeE]+0x89): undefined reference to `__imp_select'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops9poll_readEyhiRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops9poll_readEyhiRNS_6system10error_codeE]+0x99): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops20network_to_host_longEm[_ZN5boost4asio6detail10socket_ops20network_to_host_longEm]+0x3): undefined reference to `__imp_ntohl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops20host_to_network_longEm[_ZN5boost4asio6detail10socket_ops20host_to_network_longEm]+0x3): undefined reference to `__imp_htonl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops21host_to_network_shortEt[_ZN5boost4asio6detail10socket_ops21host_to_network_shortEt]+0x6): undefined reference to `__imp_htons'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio2ip10address_v4C1Ej[_ZN5boost4asio2ip10address_v4C1Ej]+0xc): undefined reference to `__imp_htonl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZNK5boost4asio2ip10address_v47to_uintEv[_ZNK5boost4asio2ip10address_v47to_uintEv]+0x5): undefined reference to `__imp_ntohl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZNK5boost4asio2ip7address14is_unspecifiedEv[_ZNK5boost4asio2ip7address14is_unspecifiedEv]+0x39): undefined reference to `__imp_ntohl'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZNK5boost4asio2ip6detail8endpoint4portEv[_ZNK5boost4asio2ip6detail8endpoint4portEv]+0x7): undefined reference to `__imp_ntohs'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio2ip6detail8endpoint4portEt[_ZN5boost4asio2ip6detail8endpoint4portEt]+0xd): undefined reference to `__imp_htons'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio2ip6detail8endpoint7addressERKNS1_7addressE[_ZN5boost4asio2ip6detail8endpoint7addressERKNS1_7addressE]+0x12): undefined reference to `__imp_ntohs'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops13error_wrapperIiEET_S4_RNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops13error_wrapperIiEET_S4_RNS_6system10error_codeE]+0x17): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops9inet_ptonEiPKcPvPmRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops9inet_ptonEiPKcPvPmRNS_6system10error_codeE]+0x5e): undefined reference to `__imp_WSAStringToAddressA'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio2ip12make_addressEPKcRNS_6system10error_codeE[_ZN5boost4asio2ip12make_addressEPKcRNS_6system10error_codeE]+0x48): undefined reference to `__imp_WSAStringToAddressA'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio2ip12make_addressEPKcRNS_6system10error_codeE[_ZN5boost4asio2ip12make_addressEPKcRNS_6system10error_codeE]+0x59): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops5closeEyRhbRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops5closeEyRhbRNS_6system10error_codeE]+0x34): undefined reference to `__imp_closesocket'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail10socket_ops5closeEyRhbRNS_6system10error_codeE[_ZN5boost4asio6detail10socket_ops5closeEyRhbRNS_6system10error_codeE]+0x183): undefined reference to `__imp_ioctlsocket'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail23win_iocp_socket_serviceINS0_2ip3udpEE4openERNS5_19implementation_typeERKS4_RNS_6system10error_codeE[_ZN5boost4asio6detail23win_iocp_socket_serviceINS0_2ip3udpEE4openERNS5_19implementation_typeERKS4_RNS_6system10error_codeE]+0x77): undefined reference to `__imp_WSASocketW'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail23win_iocp_socket_serviceINS0_2ip3udpEE4openERNS5_19implementation_typeERKS4_RNS_6system10error_codeE[_ZN5boost4asio6detail23win_iocp_socket_serviceINS0_2ip3udpEE4openERNS5_19implementation_typeERKS4_RNS_6system10error_codeE]+0x88): undefined reference to `__imp_WSAGetLastError'
CMakeFiles/pcl_io.dir/objects.a(hdl_grabber.cpp.obj):hdl_grabber.cpp:(.text$_ZN5boost4asio6detail23win_iocp_socket_serviceINS0_2ip3udpEE4openERNS5_19implementation_typeERKS4_RNS_6system10error_codeE[_ZN5boost4asio6detail23win_iocp_socket_serviceINS0_2ip3udpEE4openERNS5_19implementation_typeERKS4_RNS_6system10error_codeE]+0x2f4): undefined reference to `__imp_setsockopt'
CMakeFiles/pcl_io.dir/objects.a(vlp_grabber.cpp.obj):vlp_grabber.cpp:(.text+0x102): undefined reference to `__imp_WSAStartup'
CMakeFiles/pcl_io.dir/objects.a(robot_eye_grabber.cpp.obj):robot_eye_grabber.cpp:(.text+0x102): undefined reference to `__imp_WSAStartup'
CMakeFiles/pcl_io.dir/objects.a(robot_eye_grabber.cpp.obj):robot_eye_grabber.cpp:(.text+0x193): undefined reference to `__imp_bind'
CMakeFiles/pcl_io.dir/objects.a(robot_eye_grabber.cpp.obj):robot_eye_grabber.cpp:(.text+0x1a3): undefined reference to `__imp_setsockopt'
CMakeFiles/pcl_io.dir/objects.a(robot_eye_grabber.cpp.obj):robot_eye_grabber.cpp:(.text+0x11bc): undefined reference to `__imp_WSACleanup'
CMakeFiles/pcl_io.dir/objects.a(robot_eye_grabber.cpp.obj):robot_eye_grabber.cpp:(.text$_ZN5boost4asio6detail28win_iocp_socket_service_base21start_receive_from_opERNS2_24base_implementation_typeEP7_WSABUFyP8sockaddriPiPNS1_18win_iocp_operationE[_ZN5boost4asio6detail28win_iocp_socket_service_base21start_receive_from_opERNS2_24base_implementation_typeEP7_WSABUFyP8sockaddriPiPNS1_18win_iocp_operationE]+0x86): undefined reference to `__imp_WSARecvFrom'
CMakeFiles/pcl_io.dir/objects.a(robot_eye_grabber.cpp.obj):robot_eye_grabber.cpp:(.text$_ZN5boost4asio6detail28win_iocp_socket_service_base21start_receive_from_opERNS2_24base_implementation_typeEP7_WSABUFyP8sockaddriPiPNS1_18win_iocp_operationE[_ZN5boost4asio6detail28win_iocp_socket_service_base21start_receive_from_opERNS2_24base_implementation_typeEP7_WSABUFyP8sockaddriPiPNS1_18win_iocp_operationE]+0x8e): undefined reference to `__imp_WSAGetLastError'
collect2: error: ld returned 1 exit status
make[2]: *** [io/CMakeFiles/pcl_io.dir/build.make:391: bin/libpcl_io.dll] Error 1
make[2]: Leaving directory '/workspace/srcdir/pcl/build'
make[1]: *** [CMakeFiles/Makefile2:1165: io/CMakeFiles/pcl_io.dir/all] Error 2
make[1]: Leaving directory '/workspace/srcdir/pcl/build'
make: *** [Makefile:172: all] Error 2

There is a missing -lws2_32 in the linker invocation, but I need to figure out where the invocation is coming from...........

@giordano
Copy link
Member

Ok, the good news is that once that issue is solved, build should be successful for 64-bit windows 🎉

@giordano
Copy link
Member

Ok, now this is building for all major platforms (Linux with glibc, macOS, FreeBSD, 64-bit Windows). In the next days I'll try to look into the other platforms, if we're lucky it'll just be a matter of setting the macros mentioned above.

@Crghilardi
Copy link
Contributor Author

FWIW, I did some local testing and was able to get a local build working for x86_64-linux-musl-cxx11 by removing the -DPCL_ENABLE_SSE=OFF flag and adding the extension flags like:

cmake .. -DCMAKE_INSTALL_PREFIX=$prefix \
    -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
    -DWITH_VTK=OFF \
    -DWITH_LIBUSB=OFF \
    -DWITH_QT=OFF \
    -DWITH_CUDA=OFF \
    -DWITH_QHULL=OFF \
    -DWITH_OPENGL=OFF \
    -DWITH_PCAP=OFF \
    -DPCL_WARNINGS_ARE_ERRORS=OFF \
    -DCMAKE_BUILD_TYPE=Release \
 -DHAVE_MM_MALLOC=OFF \
 -DHAVE_POSIX_MEMALIGN=ON \
 -DHAVE_SSE4_2_EXTENSIONS=OFF \
 -DHAVE_SSE4_1_EXTENSIONS=OFF \
 -DHAVE_SSSE3_EXTENSIONS=OFF \
 -DHAVE_SSE3_EXTENSIONS=OFF \
 -DHAVE_SSE2_EXTENSIONS=ON \
 -DHAVE_SSE_EXTENSIONS=ON

I am not sure how to write that more to make platform agnostic right now

@@ -0,0 +1,20 @@
--- a/io/include/pcl/io/low_level_io.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch upstreamed: PointCloudLibrary/pcl#4704

@giordano
Copy link
Member

So much green with a simple CMake hack 🙂 Only failing platform now is 32-bit Windows

@@ -0,0 +1,10 @@
--- a/io/CMakeLists.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch upstreamed: PointCloudLibrary/pcl#4707

@@ -0,0 +1,12 @@
--- a/io/include/pcl/io/low_level_io.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch upstreamed: PointCloudLibrary/pcl#4708

@giordano
Copy link
Member

Ok, it looks like we're good to go now, and I've upstreamed all possible patches (the remaining patch is a CMake hack that we can really use only here).

@giordano giordano merged commit 4933308 into JuliaPackaging:master Apr 17, 2021
@Crghilardi Crghilardi deleted the add_PCL branch April 17, 2021 20:10
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.

2 participants