Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
## - however: exec_process seems to handle our arguments incorrectly (at least on Windows). Check functionality before you commit!

# Determine what to build (all or single library)
set( BUILD_TYPE LIST CACHE STRING "Can be used to restrict building to a single library: ALL,LIBSVM,XERCESC,BOOST,COINOR,BZIP2,ZLIB,GLPK,KISSFFT,OPENMP,ARROW,LIBZIP")
set( VALID_BUILD_TYPES "ALL" "LIBSVM" "XERCESC" "BOOST" "COINOR" "BZIP2" "ZLIB" "GLPK" "EIGEN" "KISSFFT" "HDF5" "OPENMP" "ARROW" "LIBZIP")
set( BUILD_TYPE LIST CACHE STRING "Can be used to restrict building to a single library: ALL,LIBSVM,XERCESC,BOOST,COINOR,BZIP2,ZLIB,GLPK,EIGEN,KISSFFT,HDF5,OPENMP,ARROW,LIBZIP,CURL")
set( VALID_BUILD_TYPES "ALL" "LIBSVM" "XERCESC" "BOOST" "COINOR" "BZIP2" "ZLIB" "GLPK" "EIGEN" "KISSFFT" "HDF5" "OPENMP" "ARROW" "LIBZIP" "CURL")

# check build type
if (BUILD_TYPE STREQUAL "HELP" OR BUILD_TYPE STREQUAL "LIST")
Expand Down Expand Up @@ -198,6 +198,7 @@ set(HDF5_DIR ${CONTRIB_BIN_SOURCE_DIR}/hdfsrc)
set(OPENMP_DIR ${CONTRIB_BIN_SOURCE_DIR}/openmp-12.0.1.src)
set(ARROW_DIR ${CONTRIB_BIN_SOURCE_DIR}/arrow-apache-arrow-23.0.0/cpp)
set(LIBZIP_DIR ${CONTRIB_BIN_SOURCE_DIR}/libzip-1.11.4)
set(CURL_DIR ${CONTRIB_BIN_SOURCE_DIR}/curl-8.12.1)

## source(archive) paths
## PLEASE upload all source archives to
Expand All @@ -212,7 +213,7 @@ set(LIBZIP_DIR ${CONTRIB_BIN_SOURCE_DIR}/libzip-1.11.4)
## set(ARCHIVE_ZLIB_SHA256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
## NOTE: for local development you can simply place the *.tar.gz in the binary
## directory to prevent the download and sha256 verification
## LIBRARIES: BZIP2, ZLIB, BOOST, XERCES, LIBSVM, GLPK, COINOR, EIGEN, KISSFFT, HDF5, OPENMP, ARROW, LIBZIP
## LIBRARIES: BZIP2, ZLIB, BOOST, XERCES, LIBSVM, GLPK, COINOR, EIGEN, KISSFFT, HDF5, OPENMP, ARROW, LIBZIP, CURL

set(ARCHIVE_BZIP2 bzip2-1.0.5.tar.gz)
set(ARCHIVE_BZIP2_TAR bzip2-1.0.5.tar)
Expand Down Expand Up @@ -266,6 +267,10 @@ set(ARCHIVE_LIBZIP libzip-1.11.4.tar.gz)
set(ARCHIVE_LIBZIP_TAR libzip-1.11.4.tar)
set(ARCHIVE_LIBZIP_SHA256 "82e9f2f2421f9d7c2466bbc3173cd09595a88ea37db0d559a9d0a2dc60dc722e")

set(ARCHIVE_CURL curl-8.12.1.tar.gz)
set(ARCHIVE_CURL_TAR curl-8.12.1.tar)
set(ARCHIVE_CURL_SHA256 "7b40ea64947e0b440716a4d7f0b7aa56230a5341c8377d7b609649d4aea8dbcf")

## necessary for clean up .. change if install process of library changes
set(INCLUDE_DIR_BOOST ${CONTRIB_BIN_INCLUDE_DIR}/boost)
set(INCLUDE_DIR_XERCES ${CONTRIB_BIN_INCLUDE_DIR}/xercesc)
Expand All @@ -275,6 +280,7 @@ set(INCLUDE_DIR_EIGEN ${CONTRIB_BIN_INCLUDE_DIR}/eigen3)
set(INCLUDE_DIR_KISSFFT ${CONTRIB_BIN_INCLUDE_DIR}/kissfft)
set(INCLUDE_DIR_OPENMP ${CONTRIB_BIN_INCLUDE_DIR}/openmp.src)
set(INCLUDE_DIR_ARROW ${CONTRIB_BIN_INCLUDE_DIR}/arrow)
set(INCLUDE_DIR_CURL ${CONTRIB_BIN_INCLUDE_DIR}/curl)

## hack for simple libs that do not have include directories
set(INCLUDE_FILES_LIBSVM ${CONTRIB_BIN_INCLUDE_DIR}/svm.h)
Expand Down Expand Up @@ -490,6 +496,7 @@ include ("${CMAKE_SOURCE_DIR}/libraries.cmake/hdf5.cmake")
include ("${CMAKE_SOURCE_DIR}/libraries.cmake/openmp.cmake")
include ("${CMAKE_SOURCE_DIR}/libraries.cmake/arrow.cmake")
include ("${CMAKE_SOURCE_DIR}/libraries.cmake/libzip.cmake")
include ("${CMAKE_SOURCE_DIR}/libraries.cmake/curl.cmake")

## build mac os x specific C/C++ flags
set( OPENMS_CONTRIB_MACOSX_MIXED_MODE 0 CACHE INTERNAL "building multiple architectures on MacOSX" FORCE)
Expand Down Expand Up @@ -544,6 +551,15 @@ if (BUILD_TYPE STREQUAL "ALL" OR "BOOST" IN_LIST BUILD_TYPE)
OPENMS_CONTRIB_BUILD_BOOST()
endif()

##################################################
### CURL ###
##################################################
if (BUILD_TYPE STREQUAL "ALL" OR "CURL" IN_LIST BUILD_TYPE)
OPENMS_CLEAN_LIB("CURL")
OPENMS_CONTRIB_BUILD_CURL()
OPENMS_COPY_LIBS("CURL")
endif()

##################################################
### ARROW ###
##################################################
Expand Down
1 change: 1 addition & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RUN apt-get -y update \
libqt5opengl5-dev \
libeigen3-dev \
coinor-libcoinmp-dev \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates

Expand Down
9 changes: 6 additions & 3 deletions dockerfiles/pyopenms/manylinux/ARM64_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ ARG OPENMS_VERSION="latest"
# Make source files from context available in docker
COPY . /contrib

RUN yum install -y wget
RUN yum install -y xz qt6-qtbase-devel qt6-qtsvg-devel
RUN yum install -y libtool cmake3
RUN yum install -y \
wget \
xz qt6-qtbase-devel qt6-qtsvg-devel \
libtool cmake3 libcurl-devel \
&& yum clean all \
&& rm -rf /var/cache/yum

# Build contrib for the current checked out branch
# During cleanup: removes archives
Expand Down
9 changes: 6 additions & 3 deletions dockerfiles/pyopenms/manylinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ ARG OPENMS_VERSION="latest"
# Make source files from context available in docker
COPY . /contrib

RUN yum install -y wget
RUN yum install -y xz qt6-qtbase-devel qt6-qtsvg-devel
RUN yum install -y libtool cmake3
RUN yum install -y \
wget \
xz qt6-qtbase-devel qt6-qtsvg-devel \
libtool cmake3 libcurl-devel \
&& yum clean all \
&& rm -rf /var/cache/yum

# Build contrib for the current checked out branch
# During cleanup: removes archives
Expand Down
44 changes: 44 additions & 0 deletions docs/plans/2026-03-06-curl-arrow-integration-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Design: Integrate curl into Arrow's dependency chain

## Problem

jpfeuffer's review on PR #173 asks that the dependency chain
curl -> aws-sdk -> arrow/parquet uses the same curl built by contrib.

Currently:
- CURL is built after Arrow (wrong order)
- Arrow has no S3/curl options enabled
- Arrow does not bundle curl — it requires it via `find_package(CURL)`

## Approach

Build CURL before ARROW and configure Arrow to use it via the existing
`CMAKE_PREFIX_PATH` mechanism (same pattern used for boost, zlib, bzip2).

## Changes

### 1. CMakeLists.txt — Reorder build

Move the CURL build block before ARROW. New order:
... -> BOOST -> CURL -> ARROW -> ...

### 2. libraries.cmake/arrow.cmake — Enable S3 with bundled AWS SDK

Add to both Windows and Linux/macOS cmake invocations:
- `-DARROW_S3=ON` — enables S3 filesystem, triggers AWS SDK + curl
- `-DAWSSDK_SOURCE=BUNDLED` — Arrow builds AWS SDK from source, using our curl

Curl is found automatically via `CMAKE_PREFIX_PATH=${PROJECT_BINARY_DIR}`
which is already set in arrow.cmake. No extra flags needed.

### 3. No other changes needed

- curl.cmake already installs to `${PROJECT_BINARY_DIR}`
- Dockerfiles already have `libcurl-dev`
- No new dependency resolution mechanism required

## Key facts

- Arrow 23.0.0 does NOT support `CURL_SOURCE=BUNDLED` — curl must be a system/pre-built dependency
- Arrow finds curl via standard `find_package(CURL REQUIRED)` in its `find_curl()` macro
- AWS SDK can be BUNDLED by Arrow, but still requires external curl
4 changes: 4 additions & 0 deletions libraries.cmake/arrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ if (MSVC)
-D ARROW_WITH_BZIP2=ON
-D ARROW_WITH_ZSTD=ON
-D ARROW_WITH_SNAPPY=ON
-D ARROW_S3=ON
-D AWSSDK_SOURCE=BUNDLED
-D Snappy_SOURCE=BUNDLED
-D zstd_SOURCE=BUNDLED
-D Thrift_SOURCE=BUNDLED
Expand Down Expand Up @@ -147,6 +149,8 @@ else() ## Linux/MacOS
"-DARROW_WITH_BZIP2=ON"
"-DARROW_WITH_ZSTD=ON"
"-DARROW_WITH_SNAPPY=ON"
"-DARROW_S3=ON"
"-DAWSSDK_SOURCE=BUNDLED"
"-DSnappy_SOURCE=BUNDLED"
"-Dzstd_SOURCE=BUNDLED"
"-DThrift_SOURCE=BUNDLED"
Expand Down
92 changes: 92 additions & 0 deletions libraries.cmake/curl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
##################################################
### libcurl ###
##################################################

MACRO( OPENMS_CONTRIB_BUILD_CURL )
OPENMS_LOGHEADER_LIBRARY("curl")

if(MSVC)
set(ZIP_ARGS x -y -osrc)
else()
set(ZIP_ARGS xzf)
endif()
OPENMS_SMARTEXTRACT(ZIP_ARGS ARCHIVE_CURL "CURL" "CMakeLists.txt")
Comment on lines +8 to +13
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -path "*/libraries.cmake/*.cmake" -type f | head -20

Repository: OpenMS/contrib

Length of output: 1855


🏁 Script executed:

cat -n libraries.cmake/curl.cmake 2>/dev/null | head -20

Repository: OpenMS/contrib

Length of output: 825


🏁 Script executed:

rg -n "set\(ZIP_ARGS" libraries.cmake/ -A 1 -B 1

Repository: OpenMS/contrib

Length of output: 3461


🏁 Script executed:

rg -n "OPENMS_SMARTEXTRACT" . -A 5 -B 2 --type cmake | head -50

Repository: OpenMS/contrib

Length of output: 3165


Remove quotes from ZIP_ARGS to match project conventions and ensure correct flag parsing.

curl.cmake uses quoted strings for ZIP_ARGS ("x -y -osrc" and "xzf"), making them single-element lists in CMake. All 14 other library files in libraries.cmake/ use the unquoted tokenized form (x -y -osrc and xzf), which correctly splits extraction flags as separate arguments. The quoted form risks incorrect argument passing to 7z on MSVC.

Suggested fix
 if(MSVC)
-  set(ZIP_ARGS "x -y -osrc")
+  set(ZIP_ARGS x -y -osrc)
 else()
-  set(ZIP_ARGS "xzf")
+  set(ZIP_ARGS xzf)
 endif()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libraries.cmake/curl.cmake` around lines 8 - 13, The ZIP_ARGS variable is
currently set with quoted strings making them single-element lists; update the
MSVC and non-MSVC branches to set ZIP_ARGS without quotes so flags are tokenized
(e.g., change set(ZIP_ARGS "x -y -osrc") and set(ZIP_ARGS "xzf") to unquoted
forms) so OPENMS_SMARTEXTRACT( ZIP_ARGS ARCHIVE_CURL "CURL" "CMakeLists.txt")
receives separate arguments and 7z flag parsing behaves like the other
libraries.


# curl doesn't allow insource builds
set(_CURL_BUILD_DIR "${CURL_DIR}/build")
file(TO_NATIVE_PATH "${_CURL_BUILD_DIR}" _CURL_NATIVE_BUILD_DIR)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_CURL_NATIVE_BUILD_DIR})

# Platform-specific TLS backend
if(MSVC)
set(_CURL_TLS_OPTION "-DCURL_USE_SCHANNEL=ON")
elseif(APPLE)
set(_CURL_TLS_OPTION "-DCURL_USE_SECTRANSP=ON")
else()
set(_CURL_TLS_OPTION "-DCURL_USE_OPENSSL=ON")
endif()

if(APPLE)
set(_CURL_EXTRA_ARGS
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
"-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}"
"-DCMAKE_MACOSX_RPATH=TRUE"
)
else()
set(_CURL_EXTRA_ARGS "")
endif()

message(STATUS "Generating curl build system .. ")
execute_process(COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
${ARCHITECTURE_OPTION_CMAKE}
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}
-D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBRARIES}
-D BUILD_CURL_EXE=OFF
Comment on lines +43 to +46
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Do not force shared curl builds unconditionally.

This overrides the global shared/static policy and can desync curl artifacts from the rest of contrib.

Suggested fix
-                -D BUILD_SHARED_LIBS=ON
+                -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBRARIES}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libraries.cmake/curl.cmake` around lines 43 - 46, The diff currently forces
shared builds by setting -D BUILD_SHARED_LIBS=ON which overrides the global
shared/static policy and can desync curl from other contrib; update the curl
CMake invocation to stop forcing BUILD_SHARED_LIBS=ON — either remove the -D
BUILD_SHARED_LIBS line entirely or make it conditional/forward the consuming
variable (e.g., pass -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} or only set it
when an explicit curl-specific option is provided), and keep the other flags
(CMAKE_BUILD_TYPE, CMAKE_INSTALL_PREFIX, BUILD_CURL_EXE) unchanged so curl
follows the project's global shared/static policy.

-D BUILD_TESTING=OFF
-D CURL_DISABLE_LDAP=ON
-D CURL_USE_LIBPSL=OFF
${_CURL_TLS_OPTION}
${_CURL_EXTRA_ARGS}
${CURL_DIR}
WORKING_DIRECTORY ${_CURL_NATIVE_BUILD_DIR}
OUTPUT_VARIABLE _CURL_CMAKE_OUT
ERROR_VARIABLE _CURL_CMAKE_ERR
RESULT_VARIABLE _CURL_CMAKE_SUCCESS)

# output to logfile
file(APPEND ${LOGFILE} ${_CURL_CMAKE_OUT})
file(APPEND ${LOGFILE} ${_CURL_CMAKE_ERR})

if (NOT _CURL_CMAKE_SUCCESS EQUAL 0)
message(FATAL_ERROR "Generating curl build system .. failed")
else()
message(STATUS "Generating curl build system .. done")
endif()

# the install target on windows has a different name than on mac/lnx
if(MSVC)
set(_CURL_INSTALL_TARGET "INSTALL")
else()
set(_CURL_INSTALL_TARGET "install")
endif()

message(STATUS "Building curl (Release) .. ")
execute_process(COMMAND ${CMAKE_COMMAND} --build ${_CURL_NATIVE_BUILD_DIR} --target ${_CURL_INSTALL_TARGET} --config Release
WORKING_DIRECTORY ${_CURL_NATIVE_BUILD_DIR}
OUTPUT_VARIABLE _CURL_BUILD_OUT
ERROR_VARIABLE _CURL_BUILD_ERR
RESULT_VARIABLE _CURL_BUILD_SUCCESS)

# output to logfile
file(APPEND ${LOGFILE} ${_CURL_BUILD_OUT})
file(APPEND ${LOGFILE} ${_CURL_BUILD_ERR})

if (NOT _CURL_BUILD_SUCCESS EQUAL 0)
message(FATAL_ERROR "Building curl (Release) .. failed")
else()
message(STATUS "Building curl (Release) .. done")
endif()

ENDMACRO( OPENMS_CONTRIB_BUILD_CURL )