Skip to content

feat: upgrade to v1.2.3 — option exercise, protobuf 5.x, build system improvements#17

Merged
hotea merged 85 commits into
masterfrom
dev
Jun 17, 2026
Merged

feat: upgrade to v1.2.3 — option exercise, protobuf 5.x, build system improvements#17
hotea merged 85 commits into
masterfrom
dev

Conversation

@hotea

@hotea hotea commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add option exercise support (new API)
  • Upgrade protobuf to 5.x (5.28.3 on Linux, Homebrew 5.x on macOS)
  • Build system overhaul: multi-OS support, skip-if-built optimization, fix OpenSSL/Boost detection
  • C++17 compatibility fixes (ambiguous overloads, long long casts)
  • Update outputs for Windows/Mac/Linux

Version

v1.2.3 (see include/tigerapi/version.h)

Test plan

  • Build on macOS with scripts/build_linux_mac.sh
  • Build on Linux
  • Verify option exercise API calls

tigersk and others added 30 commits January 16, 2025 16:30
Dev

See merge request server/openapi/openapi-cpp-sdk!53
Dev->master

See merge request server/openapi/openapi-cpp-sdk!59
- Add include/google/protobuf/ to .gitignore
- Remove protobuf headers from git (use system/external protobuf instead)
- Protobuf v25.1 headers should be provided by external installation
- Remove include/google/protobuf/ from .gitignore
- Add back all protobuf v25.1 headers (233 files)
- This makes it easier for users to build without installing protobuf separately
- Headers are from protobuf v25.1 (libprotobuf 4.25.1)
Feat win

See merge request server/openapi/openapi-cpp-sdk!62
tigersk and others added 29 commits June 16, 2026 17:28
- tiger_client.h: clarify thread-safety prerequisite (cpprestsdk >= 2.10)
- trade_client.h: introduce PARAM_NOT_SET constant to replace -1 sentinel
- tiger_client.cpp: include response body in sign-missing error log
- trade_client.cpp: use PARAM_NOT_SET in option exercise guard conditions
The script previously assumed /usr/local/boost_1_86_0 existed and failed
with 'Could NOT find Boost' on a clean Linux machine.

Changes:
- Add ensure_boost() that downloads and builds Boost 1.86 from archives.boost.io
  when BOOST_ROOT/include/boost is absent (same approach as build_linux_mac.sh)
- Accept BOOST_ROOT / BOOST_VERSION env overrides for custom installs
- Pass explicit Boost_INCLUDE_DIR and Boost_LIBRARY_DIR to cmake to prevent
  fallback to any system-installed incompatible version
- Add Boost_NO_SYSTEM_PATHS=ON to mirror the mac package script
- Cache the downloaded tarball under .cache/ to avoid re-downloading on reruns
- Clean build dirs before configure (same as package_mac.sh) to avoid stale cache
…oost

- wget: on failure, remove partial download and exit with clear error message
- b2 install: check parent dir is writable before attempting install;
  print actionable hint (sudo or BOOST_ROOT override) when it is not
apt-get was the only path; machines using dnf (RHEL/Fedora/Rocky/Alma)
or yum (CentOS 7) would fail with 'command not found'.

Now detects apt-get → dnf → yum in order, maps package names correctly
(e.g. libssl-dev → openssl-devel, g++ → gcc-c++, pkg-config → pkgconfig).
Falls back to a clear error if none of the three are found.
…exists

- If tar extracts to a dir with a different name than expected (e.g. boost_1_86_0
  vs boost_1.86.0), detect the real name from the tarball listing and rename it
- Add explicit check that bootstrap.sh exists before pushd; emit a clear error
  with recovery hint (delete cached tarball) if it is missing
- On wget failure, remove partial file and fail with clear message
- Remove the fallback ./bootstrap.sh retry (it was masking the real error:
  the script was not being found at all, not rejecting --prefix)
… ~125MB)

archives.boost.io is slow; GitHub releases CDN is significantly faster.
Using boost-1.86.0-b2-nodocs.tar.gz which contains bootstrap.sh and all
required libraries but omits documentation.

- URL: github.com/boostorg/boost/releases/download/boost-1.86.0/...
- Format: .tar.gz (was .tar.bz2) → fix tar flags to -xzf / -tzf
- Extracted dir: boost-1.86.0 (dotted, not boost_1_86_0) → fix src_dir
- Both build_linux_mac.sh and package_linux.sh updated consistently
…instead

The b2-nodocs tarball's bootstrap.sh does not accept --prefix.
The install prefix should only be passed to b2 install (already done).
Add _check_system_boost() helper to build_linux_mac.sh and package_linux.sh
that reads BOOST_VERSION from version.hpp and accepts only 1.86–1.89.
Boost 1.90+ is rejected because it breaks cpprestsdk (SIGSEGV in do_use_service).
Source compilation of 1.86 is now the fallback, not the default path.
b2 silently exited with 'failed updating 1 target' when BOOST_ROOT parent
was not writable. Now fail early with a clear message and workaround hints.
cpprestsdk is always compiled from source against the same BOOST_ROOT,
so ABI is consistent at any version >= 1.86. Homebrew 1.90 on macOS is fine.
…IX default

- PROTOBUF_PREFIX auto-detects Homebrew protobuf (5.x) on macOS; Linux keeps
  source-built v3.21.12. pb_source regenerated with matching protoc.
- SDK_INSTALL_PREFIX defaults to output/<OS>/sdk (writable, no sudo needed).
- CMakeLists.txt: restore HOMEBREW_INCLUDE_DIR; Protobuf_INCLUDE_DIRS listed
  first so pinned headers shadow include/google/ stubs.
- build_sdk: clear CMakeCache.txt before configure to prevent stale Protobuf_ROOT.
- Rebuilt output/Mac Debug.zip and Release.zip with protobuf 5.28.3.
…tput/<OS>

cmake install goes directly to output/Mac/Debug and output/Mac/Release.
Removed the extra copy step (install_dir == output_dir now).
Zip packages contain Debug/ and Release/ at the root level.
- Change PROTOBUF_VERSION default to v5.28.3 on Linux (must match pb_source
  generated with protoc 5.28.3)
- Add -Dprotobuf_ROOT, -DProtobuf_ROOT and -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
  to cmake invocation so cpprestsdk's find_dependency(Protobuf) cannot override
  the explicitly specified protobuf prefix
- package_linux.sh: replace hardcoded protobuf-v25.1 with dynamic PROTOBUF_PREFIX
  (defaults to /usr/local/opt/protobuf-v5.28.3); same cmake detection flags
- package_linux.sh: remove redundant sdk/ subdirectory layer; zip now contains
  Debug/ and Release/ at root (consistent with build_linux_mac.sh output)
protobuf v5.x requires abseil-cpp as a git submodule (third_party/abseil-cpp).
Without 'git submodule update --init --recursive' the cmake configure step fails
with 'does not contain a CMakeLists.txt file' for abseil-cpp.
cpprestsdk's find_dependency(OpenSSL) re-defines the OpenSSL imported targets
with INTERFACE_INCLUDE_DIRECTORIES='/include' (empty prefix) on Linux systems
where OPENSSL_INCLUDE_DIR is not already cached.

Two-layer fix:
1. build_linux_mac.sh: always pass explicit -DOPENSSL_INCLUDE_DIR,
   -DOPENSSL_CRYPTO_LIBRARY, -DOPENSSL_SSL_LIBRARY (with lib64 fallback),
   and add openssl_root to CMAKE_PREFIX_PATH.
2. CMakeLists.txt: after find_package(cpprestsdk), patch any OpenSSL::SSL /
   OpenSSL::Crypto target whose INTERFACE_INCLUDE_DIRECTORIES is '/include'
   using the correctly resolved OPENSSL_INCLUDE_DIR.
protobuf 5.x embeds absl lts_20240116 which uses C++17 deduction guides
(FunctionRef, lambda conversions) that do not compile under gnu++11.
Change GCC flag from gnu++11 to gnu++17.

Also guard -arch arm64 behind APPLE so Linux Clang builds are not broken
by an architecture flag that only applies on macOS.
… C++17

C++17 stricter overload resolution makes long long int ambiguous between
int64_t and other overloads. Cast to int64_t explicitly.
Same ambiguous overload issue as exercise_id — C++17 stricter resolution
requires explicit cast for submit_option_exercise and check_option_exercise.
- GCC flag: gnu++11 -> gnu++17 (absl lts_20240116 requires C++17)
- Clang: guard -arch arm64 behind APPLE (Linux Clang has no such flag)
- Linux: find absl from PROTOBUF_PREFIX cmake dir and link it,
  same as macOS already does via Homebrew abseil
Sync the same OpenSSL fix from build_linux_mac.sh: always pass
OPENSSL_ROOT_DIR/INCLUDE_DIR/CRYPTO_LIBRARY/SSL_LIBRARY explicitly
with lib64 fallback, so cpprestsdk's find_dependency(OpenSSL) cannot
produce a broken target with INTERFACE_INCLUDE_DIRECTORIES='/include'.
…dy exist

After running build_linux_mac.sh the installed libs are already at
output/Linux/Debug/lib/libtigerapi.a and output/Linux/Release/lib/libtigerapi.a.
package_linux.sh now detects this and jumps straight to the zip step,
avoiding a redundant full recompilation.
feat: option exercise APIs, thread-safe refactor, Mac zip rebuild

See merge request server/openapi/openapi-cpp-sdk!66
@hotea hotea merged commit 181f5ea into master Jun 17, 2026
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