Skip to content

Commit 21abff4

Browse files
committed
Install static curl
1 parent ec5d5ba commit 21abff4

File tree

5 files changed

+99
-48
lines changed

5 files changed

+99
-48
lines changed

.github/workflows/_build_test_upload.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,16 @@ jobs:
8787
arch: x64
8888
- name: Install Build Dependency
8989
shell: bash
90+
env:
91+
PYTHON_VERSION: ${{ matrix.python-version }}
9092
run: |
9193
if ${{ startsWith( matrix.os, 'ubuntu' ) }}; then
92-
yum -y install ninja-build
93-
# yum -y install openssl-devel openssl-static curl-devel zlib-static
94-
yum -y install curl-devel zlib-static
94+
source packaging/manylinux/python_helper.sh
95+
yum -y install ninja-build zlib-static
96+
# Docker path is /__w by default
97+
export WORKSPACE="/__w"
98+
# Install static OpenSSL/libcrypto library
99+
./packaging/manylinux/install_openssl_curl.sh
95100
else
96101
pip install cmake ninja
97102
echo "/home/runner/.local/bin" >> $GITHUB_PATH
@@ -105,16 +110,13 @@ jobs:
105110
run: |
106111
if ${{ startsWith( matrix.os, 'ubuntu' ) }}; then
107112
source packaging/manylinux/python_helper.sh
108-
# Docker path is /__w by default
109-
export WORKSPACE="/__w"
110113
# See: https://github.com/actions/checkout/issues/760
111114
git config --global --add safe.directory "$WORKSPACE/data/data"
112-
# Install static OpenSSL/libcrypto library
113-
./packaging/manylinux/install_openssl.sh
114115
# AWSSDK uses $CMAKE_PREFIX_PATH to find openssl
115-
export CMAKE_PREFIX_PATH="$WORKSPACE/ssl/:$CMAKE_PREFIX_PATH"
116-
export OPENSSL_ROOT_DIR="$WORKSPACE/ssl"
117-
export STATIC_OPENSSL=TRUE
116+
export OPENSSL_ROOT_DIR="/__w/ssl"
117+
export CURL_ROOT_DIR="/__w/curl"
118+
export CMAKE_PREFIX_PATH="$OPENSSL_ROOT_DIR:$CURL_ROOT_DIR:$CMAKE_PREFIX_PATH"
119+
export STATIC_DEPS=TRUE
118120
fi
119121
packaging/build_wheel.sh
120122
- name: Validate TorchData Wheel
@@ -211,7 +213,7 @@ jobs:
211213
# --username __token__ \
212214
# --password "$PYPI_TOKEN" \
213215
# dist/torchdata*.whl
214-
#
216+
#
215217
# conda_build_test:
216218
# needs: get_release_type
217219
# runs-on: ${{ matrix.os }}
@@ -269,7 +271,7 @@ jobs:
269271
# with:
270272
# name: torchdata-artifact
271273
# path: conda-bld/*/torchdata-*.tar.bz2
272-
#
274+
#
273275
# conda_upload:
274276
# if: always() && inputs.branch != ''
275277
# needs: [get_release_type, conda_build_test]
@@ -304,13 +306,13 @@ jobs:
304306
# run: |
305307
# conda install -yq anaconda-client
306308
# conda install -c conda-forge -yq jq
307-
#
309+
#
308310
# if [[ ${{ needs.get_release_type.outputs.type }} == 'official' ]]; then
309311
# CONDA_CHANNEL=pytorch
310312
# else
311313
# CONDA_CHANNEL=pytorch-${{ needs.get_release_type.outputs.type }}
312314
# fi
313-
#
315+
#
314316
# if [[ ${{ needs.get_release_type.outputs.type }} == 'nightly' ]]; then
315317
# # Loop over all platforms [win-64, osx-64, linux-64]
316318
# for subdir in $(find . -type f -name '*torchdata*.tar.bz2' | sed -r 's|/[^/]+$||' | uniq | cut -f2 -d/) ; do
@@ -339,7 +341,7 @@ jobs:
339341
# else
340342
# anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ./*/torchdata-*.tar.bz2 -u "$CONDA_CHANNEL" --label main --no-progress --force
341343
# fi
342-
#
344+
#
343345
# build_docs:
344346
# if: |
345347
# always() && inputs.branch != '' &&
@@ -373,14 +375,14 @@ jobs:
373375
# else
374376
# PYTORCH_VERSION=torch==${{ inputs.pytorch_version }}
375377
# fi
376-
#
378+
#
377379
# PIP_CHANNEL=${{ needs.get_release_type.outputs.type }}
378380
# if [[ $PIP_CHANNEL == 'official' ]]; then
379381
# pip3 install "$PYTORCH_VERSION" -f https://download.pytorch.org/whl/torch_stable.html
380382
# else
381383
# pip3 install --pre "$PYTORCH_VERSION" -f "https://download.pytorch.org/whl/$PIP_CHANNEL/torch_$PIP_CHANNEL.html"
382384
# fi
383-
#
385+
#
384386
# pip3 install -r requirements.txt
385387
# python3 setup.py install
386388
# - name: Check env

.github/workflows/ci.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
branches:
55
- main
66
- release/*
7-
# pull_request:
8-
# types: [opened, synchronize, reopened, labeled]
9-
# branches:
10-
# - main
11-
# # For PR created by ghstack
12-
# - gh/*/*/base
13-
# - release/*
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled]
9+
branches:
10+
- main
11+
# For PR created by ghstack
12+
- gh/*/*/base
13+
- release/*
1414

1515
jobs:
1616
test:
@@ -29,9 +29,6 @@ jobs:
2929
- 3.7
3030
- 3.8
3131
- 3.9
32-
with-s3:
33-
- 1
34-
- 0
3532
steps:
3633
- name: Setup additional system libraries
3734
if: startsWith( matrix.os, 'ubuntu' )
@@ -44,10 +41,10 @@ jobs:
4441
with:
4542
python-version: ${{ matrix.python-version }}
4643
- name: Setup msbuild on Windows
47-
if: matrix.with-s3 == 1 && matrix.os == 'windows-latest'
44+
if: matrix.os == 'windows-latest'
4845
uses: microsoft/[email protected]
4946
- name: Set up Visual Studio shell
50-
if: matrix.with-s3 == 1 && matrix.os == 'windows-latest'
47+
if: matrix.os == 'windows-latest'
5148
uses: egor-tensin/vs-shell@v2
5249
with:
5350
arch: x64
@@ -65,7 +62,7 @@ jobs:
6562
run: |
6663
python setup.py install
6764
env:
68-
BUILD_S3: ${{ matrix.with-s3 }}
65+
BUILD_S3: 1
6966
- name: Install test requirements
7067
run: pip3 install expecttest fsspec iopath==0.1.9 numpy pytest rarfile protobuf
7168
- name: Run DataPipes tests with pytest

.github/workflows/domain_ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
branches:
55
- main
66
- release/*
7-
# pull_request:
8-
# branches:
9-
# - main
10-
# # For PR created by ghstack
11-
# - gh/*/*/base
12-
# - release/*
7+
pull_request:
8+
branches:
9+
- main
10+
# For PR created by ghstack
11+
- gh/*/*/base
12+
- release/*
1313

1414
jobs:
1515
torchvision:
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
OPENSSL_URL="https://www.openssl.org/source/"
9+
OPENSSL_NAME="openssl-1.1.1o"
10+
OPENSSL_SHA256="9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f"
11+
OPENSSL_BUILD_FLAGS="no-ssl2 no-zlib no-shared no-comp no-dynamic-engine enable-ec_nistp_64_gcc_128"
12+
13+
CURL_URL="https://github.com/curl/curl/releases/download"
14+
CURL_NAME="curl-7.83.1"
15+
CURL_BUILD_FLAGS="--disable-shared"
16+
17+
function check_sha256sum {
18+
local fname=$1
19+
local sha256=$2
20+
echo "${sha256} ${fname}" > ${fname}.sha256
21+
sha256sum -c ${fname}.sha256
22+
rm ${fname}.sha256
23+
}
24+
25+
yum erase -y openssl-devel curl-devel
26+
27+
pushd ${WORKSPACE}
28+
29+
# OpenSSL
30+
curl -fsSL -o ${OPENSSL_NAME}.tar.gz ${OPENSSL_URL}/${OPENSSL_NAME}.tar.gz
31+
check_sha256sum ${OPENSSL_NAME}.tar.gz ${OPENSSL_SHA256}
32+
tar zxf ${OPENSSL_NAME}.tar.gz
33+
34+
pushd ${OPENSSL_NAME}
35+
36+
./config $OPENSSL_BUILD_FLAGS --prefix=${WORKSPACE}/ssl --openssldir=${WORKSPACE}/ssl
37+
make -j4 > /dev/null
38+
# avoid installing the docs
39+
# https://github.com/openssl/openssl/issues/6685#issuecomment-403838728
40+
make install_sw > /dev/null
41+
42+
popd
43+
rm -rf ${OPENSSL_NAME} ${OPENSSL_NAME}.tar.gz
44+
45+
# cURL
46+
curl -fsSL -o ${CURL_NAME}.tar.gz ${CURL_URL}/${CURL_NAME//./_}/${CURL_NAME}.tar.gz
47+
tar zxf ${CURL_NAME}.tar.gz
48+
49+
pushd ${CURL_NAME}
50+
51+
./configure ${CURL_BUILD_FLAGS} --with-openssl=${WORKSPACE}/ssl --prefix=${WORKSPACE}/curl
52+
make -j4 > /dev/null
53+
make install > /dev/null
54+
55+
popd
56+
rm -rf ${CURL_NAME} ${CURL_NAME}.tar.gz
57+
58+
popd

torchdata/csrc/CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ if(BUILD_S3)
2424
elseif(APPLE)
2525
set(AWSSDK_DEP_LIBRARIES pthread curl)
2626
elseif(UNIX)
27-
if(STATIC_OPENSSL)
27+
set(AWSSDK_DEP_LIBRARIES pthread)
28+
if(STATIC_DEPS)
2829
set(OPENSSL_USE_STATIC_LIBS TRUE)
2930
endif()
31+
include(FindCURL)
32+
list(APPEND AWSSDK_DEP_LIBRARIES ${CURL_LIBRARIES})
3033
include(FindOpenSSL)
31-
set(AWSSDK_DEP_INCLUDE_DIRS ${AWSSDK_INCLUDE_DIRS})
32-
set(AWSSDK_DEP_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES} ${OPENSSL_SSL_LIBRARIES} curl)
34+
list(APPEND AWSSDK_DEP_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
3335
endif()
34-
message(STATUS "AWSSDK DEPENDENCIES AWSSDK_DEP_INCLUDE_DIRS: ${AWSSDK_DEP_INCLUDE_DIRS}, AWSSDK_DEP_LIBRARIES: ${AWSSDK_DEP_LIBRARIES}")
36+
message(STATUS "AWSSDK DEPENDENCIES AWSSDK_DEP_LIBRARIES: ${AWSSDK_DEP_LIBRARIES}")
3537

3638
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3739

@@ -54,7 +56,6 @@ if(BUILD_S3)
5456
${Python_INCLUDE_DIR}
5557
${pybind11_INCLUDE_DIRS}
5658
${AWSSDK_INCLUDE_DIRS}
57-
${AWSSDK_DEP_INCLUDE_DIRS}
5859
)
5960

6061
target_link_libraries(
@@ -66,13 +67,6 @@ if(BUILD_S3)
6667
${AWSSDK_DEP_LIBRARIES}
6768
)
6869

69-
if(UNIX)
70-
target_link_libraries(
71-
_torchdata
72-
PRIVATE
73-
)
74-
endif()
75-
7670
set_target_properties(_torchdata PROPERTIES PREFIX "")
7771
if (MSVC)
7872
set_target_properties(_torchdata PROPERTIES SUFFIX ".pyd")

0 commit comments

Comments
 (0)