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

GH-43416: [CI] Upgrade our vcpkg version on .env #43417

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

raulcd
Copy link
Member

@raulcd raulcd commented Jul 25, 2024

Rationale for this change

We are using a pretty old version and we are seeing some CI jobs.

What changes are included in this PR?

Upgrade vcpkg version

Are these changes tested?

on CI

Are there any user-facing changes?

No

Copy link

⚠️ GitHub issue #43416 has been automatically assigned in GitHub to PR creator.

@raulcd
Copy link
Member Author

raulcd commented Jul 25, 2024

@github-actions crossbow submit -g vcpkg wheel java-jars

Copy link

Unable to match any tasks for `wheel`
The Archery job run can be found at: https://github.com/apache/arrow/actions/runs/10092011041

@raulcd
Copy link
Member Author

raulcd commented Jul 25, 2024

@github-actions crossbow submit -g vcpkg -g wheel java-jars

This comment was marked as outdated.

@raulcd
Copy link
Member Author

raulcd commented Jul 25, 2024

@github-actions crossbow submit python-wheel-manylinux-2-28

Copy link

Unable to match any tasks for `python-wheel-manylinux-2-28`
The Archery job run can be found at: https://github.com/apache/arrow/actions/runs/10092813787

@raulcd
Copy link
Member Author

raulcd commented Jul 25, 2024

@github-actions crossbow submit wheel-manylinux-2-28-cp39-amd64

Copy link

Revision: a60bc06

Submitted crossbow builds: ursacomputing/crossbow @ actions-243699443d

Task Status
wheel-manylinux-2-28-cp39-amd64 GitHub Actions

@raulcd
Copy link
Member Author

raulcd commented Jul 25, 2024

I am unsure why ORC is failing to build when calling fetchcontent_makeavailable(orc) with:

CMake Error at /tmp/arrow-build/_deps/orc-src/cmake_modules/ThirdpartyToolchain.cmake:467 (elseif):
  given arguments:

    "ORC_PREFER_STATIC_PROTOBUF" "AND"

  Unknown arguments specified
Call Stack (most recent call first):
  /tmp/arrow-build/_deps/orc-src/CMakeLists.txt:166 (INCLUDE)

I can see we define (since #43011):

    set(ORC_PREFER_STATIC_PROTOBUF
        OFF
        CACHE BOOL "" FORCE)

debugging locally I can see we use ORC 2.0.1 and the failure is coming from:

if (ORC_PACKAGE_KIND STREQUAL "conan")
  target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES})
elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
  target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB})
else ()
  target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY})
endif()

@kou any idea why fetchcontent building ORC might not see the defined ORC_PREFER_STATIC_PROTOBUF?

@raulcd
Copy link
Member Author

raulcd commented Jul 26, 2024

@github-actions crossbow submit wheel-manylinux-2-28-cp39-amd64

@raulcd
Copy link
Member Author

raulcd commented Jul 26, 2024

I am not sure why but applying the patch here: ee89232 is able to build orc

edited commit

Copy link

Revision: 982a6ce

Submitted crossbow builds: ursacomputing/crossbow @ actions-46a723f68f

Task Status
wheel-manylinux-2-28-cp39-amd64 GitHub Actions

@raulcd
Copy link
Member Author

raulcd commented Jul 26, 2024

I am currently trying to understand why protoc fails on flight with SIGSEGV:

[143/176] Generating Flight.pb.cc, Flight.pb.h, Flight.grpc.pb.cc, Flight.grpc.pb.h
FAILED: src/arrow/flight/Flight.pb.cc src/arrow/flight/Flight.pb.h src/arrow/flight/Flight.grpc.pb.cc src/arrow/flight/Flight.grpc.pb.h /tmp/arrow-build/src/arrow/flight/Flight.pb.cc /tmp/arrow-build/src/arrow/flight/Flight.pb.h /tmp/arrow-build/src/arrow/flight/Flight.grpc.pb.cc /tmp/arrow-build/src/arrow/flight/Flight.grpc.pb.h 
cd /tmp/arrow-build/src/arrow/flight && /opt/vcpkg/installed/x64-linux/tools/protobuf/protoc -I/arrow/cpp/../format --cpp_out=/tmp/arrow-build/src/arrow/flight /arrow/cpp/../format/Flight.proto && /opt/vcpkg/installed/x64-linux/tools/protobuf/protoc -I/arrow/cpp/../format --grpc_out=/tmp/arrow-build/src/arrow/flight --plugin=protoc-gen-grpc=/opt/vcpkg/installed/amd64-linux-static-release/../x64-linux/tools/grpc/grpc_cpp_plugin /arrow/cpp/../format/Flight.proto
--grpc_out: protoc-gen-grpc: Plugin killed by signal 11.

@raulcd
Copy link
Member Author

raulcd commented Jul 26, 2024

@github-actions crossbow submit wheel-macos-big-sur-cp310-arm64

Copy link

Revision: 2cedbe6

Submitted crossbow builds: ursacomputing/crossbow @ actions-08db436a21

Task Status
wheel-macos-big-sur-cp310-arm64 GitHub Actions

@kou
Copy link
Member

kou commented Jul 29, 2024

Hmm. It seems that https://github.com/apache/orc/blob/23044d79a26cf8792bcb1936ab601308b0781962/cmake_modules/ThirdpartyToolchain.cmake#L416-L418 wasn't used. It means that Protobuf_ROOT is an empty string in this case:

get_target_property(PROTOBUF_INCLUDE_DIR ${ARROW_PROTOBUF_LIBPROTOBUF}
INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(Protobuf_ROOT "${PROTOBUF_INCLUDE_DIR}" DIRECTORY)
set(PROTOBUF_HOME
${Protobuf_ROOT}
CACHE STRING "" FORCE)

Could you debug print Protobuf_ROOT value?

BTW, the ORC code should be fixed:

diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index 79324984a..f0808715b 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -466,13 +466,13 @@ if (ORC_PACKAGE_KIND STREQUAL "conan")
 elseif (NOT "${PROTOBUF_HOME}" STREQUAL "")
   find_package (Protobuf REQUIRED)
 
-  if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
+  if (ORC_PREFER_STATIC_PROTOBUF AND PROTOBUF_STATIC_LIB)
     add_resolved_library (orc_protobuf ${PROTOBUF_STATIC_LIB} ${PROTOBUF_INCLUDE_DIR})
   else ()
     add_resolved_library (orc_protobuf ${PROTOBUF_LIBRARY} ${PROTOBUF_INCLUDE_DIR})
   endif ()
 
-  if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
+  if (ORC_PREFER_STATIC_PROTOBUF AND PROTOC_STATIC_LIB)
     add_resolved_library (orc_protoc ${PROTOC_STATIC_LIB} ${PROTOBUF_INCLUDE_DIR})
   else ()
     add_resolved_library (orc_protoc ${PROTOC_LIBRARY} ${PROTOBUF_INCLUDE_DIR})

@wgtmac Could you fix the ORC side problem (that is not related to this PR's failure)? We should not use ${...} in these if (...)s because it may be "not defined" or "an empty string". In these case, the if (...) becomes if (A AND). It's a syntax error. ORC has similar problem for other libraries such as LZ4: https://github.com/apache/orc/blob/37201cb8a186d2111a5ccf49b213003c4c947859/cmake_modules/ThirdpartyToolchain.cmake#L313

@wgtmac
Copy link
Member

wgtmac commented Jul 29, 2024

@kou Sorry for the issue caused by ORC. Let me take a look.

@kou
Copy link
Member

kou commented Jul 29, 2024

Thanks!

@raulcd
Copy link
Member Author

raulcd commented Jul 29, 2024

Hmm. It seems that https://github.com/apache/orc/blob/23044d79a26cf8792bcb1936ab601308b0781962/cmake_modules/ThirdpartyToolchain.cmake#L416-L418 wasn't used. It means that Protobuf_ROOT is an empty string in this case:

get_target_property(PROTOBUF_INCLUDE_DIR ${ARROW_PROTOBUF_LIBPROTOBUF}
INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(Protobuf_ROOT "${PROTOBUF_INCLUDE_DIR}" DIRECTORY)
set(PROTOBUF_HOME
${Protobuf_ROOT}
CACHE STRING "" FORCE)

Could you debug print Protobuf_ROOT value?

-- Building Apache ORC from source
-- ## Protobuf_ROOT: /opt/vcpkg/installed/amd64-linux-static-release
-- Build type: RELEASE

@kou you lost me with this comment, are you talking about the ORC issue here or the flight issue with protobuf?

other logs about where protoc is:

-- Found Protobuf: /opt/vcpkg/installed/x64-linux/tools/protobuf/protoc (found version "25.1.0")
-- Providing CMake module for FindProtobufAlt as part of Arrow CMake package
-- Found protoc: /opt/vcpkg/installed/x64-linux/tools/protobuf/protoc

@kou
Copy link
Member

kou commented Jul 29, 2024

you lost me with this comment, are you talking about the ORC issue here or the flight issue with protobuf?

The ORC issue here. I don't think that the cpp/cmake_modules/orc.diff is the right approach.
Sorry. I haven't looked at #43417 (comment) yet.

@raulcd
Copy link
Member Author

raulcd commented Jul 29, 2024

I don't think that the cpp/cmake_modules/orc.diff is the right approach.

ah! ok, that makes sense. Thanks for your help!

@kou
Copy link
Member

kou commented Jul 30, 2024

(I hope that I can take a look at the Flight issue tomorrow...)

@raulcd
Copy link
Member Author

raulcd commented Jul 30, 2024

(I hope that I can take a look at the Flight issue tomorrow...)

Thanks @kou, no worries, I am testing the orc issue and it seems like the FindProtobuf file from ORC isn't used. I'll keep testing and will share findings.

@raulcd
Copy link
Member Author

raulcd commented Jul 30, 2024

ok, vcpkg uses CONFIG for find_package and does not use FindProtobuf.cmake but ProtobufConfig.cmake or protobuf-config.cmake based on debug:

    /opt/vcpkg/installed/amd64-linux-static-release/share/protobuf/ProtobufConfig.cmake
    /opt/vcpkg/installed/amd64-linux-static-release/share/protobuf/protobuf-config.cmake

This does not populate PROTOBUF_STATIC_LIB nor PROTOC_STATIC_LIB, the following snippet for orc.diff fixes the issue:

diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index aa520ff..7bd75d1 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -416,6 +416,18 @@ endif ()
 if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
   find_package (Protobuf REQUIRED)
   set(PROTOBUF_VENDORED FALSE)
+  if (Protobuf_FOUND AND NOT PROTOBUF_STATIC_LIB)
+    get_target_property (target_type protobuf::libprotobuf TYPE)
+    if (target_type STREQUAL "STATIC_LIBRARY")
+        set(PROTOBUF_STATIC_LIB protobuf::libprotobuf)
+    endif ()
+  endif()
+  if (Protobuf_FOUND AND NOT PROTOC_STATIC_LIB)
+    get_target_property (target_type protobuf::libprotoc TYPE)
+    if (target_type STREQUAL "STATIC_LIBRARY")
+        set (PROTOC_STATIC_LIB protobuf::libprotoc)
+    endif ()
+  endif()
 else ()
   set(PROTOBUF_PREFIX "${THIRDPARTY_DIR}/protobuf_ep-install")
   set(PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include")

@raulcd
Copy link
Member Author

raulcd commented Jul 30, 2024

I've tried to debug the protoc issue but I've had no luck, adding it here in case it can help:

[root@17eac57d5aef flight]# gdb --args /opt/vcpkg/installed/x64-linux/tools/protobuf/protoc -I/arrow/cpp/../format --grpc_out=/tmp/arrow-build/src/arrow/flight --plugin=protoc-gen-grpc=/opt/vcpkg/installed/amd64-linux-static-release/../x64-linux/tools/grpc/grpc_cpp_plugin /arrow/cpp/../format/Flight.proto
...
(gdb) set follow-fork-mode child
(gdb) run
Starting program: /opt/vcpkg/installed/x64-linux/tools/protobuf/protoc -I/arrow/cpp/../format --grpc_out=/tmp/arrow-build/src/arrow/flight --plugin=protoc-gen-grpc=/opt/vcpkg/installed/amd64-linux-static-release/../x64-linux/tools/grpc/grpc_cpp_plugin /arrow/cpp/../format/Flight.proto
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Attaching after Thread 0x799b682acc00 (LWP 642) fork to child process 643]
[New inferior 2 (process 643)]
[Detaching after fork from parent process 642]
[Inferior 1 (process 642) detached]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
process 643 is executing new program: /opt/vcpkg/installed/x64-linux/tools/grpc/grpc_cpp_plugin

Thread 2.1 "grpc_cpp_plugin" received signal SIGSEGV, Segmentation fault.
[Switching to process 643]
0x00007e16ee5638a4 in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:1832
1832	rtld.c: No such file or directory.

I tried setting the following to docker-compose.yml as suggested on stackoverflow on the Error disabling address space randomization: Operation not permitted to try and remove that warning without luck (I don't think is related, though):

diff --git a/docker-compose.yml b/docker-compose.yml
index cf22324..674fe0a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1132,6 +1132,10 @@ services:
       - .:/arrow:delegated
       - ${DOCKER_VOLUME_PREFIX}python-wheel-manylinux-2-28-ccache:/ccache:delegated
     command: /arrow/ci/scripts/python_wheel_manylinux_build.sh
+    cap_add:
+      - SYS_PTRACE
+    security_opt:
+      - apparmor:unconfined
 
   python-wheel-manylinux-test-imports:
     image: ${ARCH}/python:${PYTHON}

It seems that just executing grpc_cpp_plugin segfaults:

[root@849e8f917b46 flight]# /opt/vcpkg/installed/x64-linux/tools/grpc/grpc_cpp_plugin
Segmentation fault (core dumped)

edit: added some more info.

@kou
Copy link
Member

kou commented Jul 31, 2024

This problem #43417 (comment) may be already solved in upstream: apache/orc#1963
(But not released yet.)

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

Successfully merging this pull request may close these issues.

None yet

3 participants