Skip to content

Commit 52163ed

Browse files
authored
Fix #2148 (#2173)
* Fix #2148 * Removed 32bit environment * buld-error-check-on-32bit * Use 32bit depedency from Windows
1 parent af7a69b commit 52163ed

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

.github/workflows/test.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
clang-format --version
4141
cd test && make style_check
4242
43-
ubuntu:
43+
build-error-check-on-32bit:
4444
runs-on: ubuntu-latest
4545
if: >
4646
(github.event_name == 'push') ||
@@ -53,10 +53,28 @@ jobs:
5353
- arch_flags: -m32
5454
arch_suffix: :i386
5555
name: (32-bit)
56-
- arch_flags:
57-
arch_suffix:
58-
name: (64-bit)
59-
name: ubuntu ${{ matrix.config.name }}
56+
steps:
57+
- name: checkout
58+
uses: actions/checkout@v4
59+
- name: install libraries
60+
run: |
61+
sudo dpkg --add-architecture i386
62+
sudo apt-get update
63+
sudo apt-get install -y libc6-dev${{ matrix.config.arch_suffix }} libstdc++-13-dev${{ matrix.config.arch_suffix }} \
64+
libssl-dev${{ matrix.config.arch_suffix }} libcurl4-openssl-dev${{ matrix.config.arch_suffix }} \
65+
zlib1g-dev${{ matrix.config.arch_suffix }} libbrotli-dev${{ matrix.config.arch_suffix }} \
66+
libzstd-dev${{ matrix.config.arch_suffix }}
67+
- name: build and run tests (expect failure)
68+
run: cd test && make test EXTRA_CXXFLAGS="${{ matrix.config.arch_flags }}"
69+
continue-on-error: true
70+
71+
ubuntu:
72+
runs-on: ubuntu-latest
73+
if: >
74+
(github.event_name == 'push') ||
75+
(github.event_name == 'pull_request' &&
76+
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
77+
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
6078
steps:
6179
- name: checkout
6280
uses: actions/checkout@v4

httplib.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@
1010

1111
#define CPPHTTPLIB_VERSION "0.22.0"
1212

13+
/*
14+
* Platform compatibility check
15+
*/
16+
17+
#if defined(_WIN32) && !defined(_WIN64)
18+
#error \
19+
"cpp-httplib doesn't support 32-bit Windows. Please use a 64-bit compiler."
20+
#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ < 8
21+
#error \
22+
"cpp-httplib doesn't support 32-bit platforms. Please use a 64-bit compiler."
23+
#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ < 8
24+
#error \
25+
"cpp-httplib doesn't support platforms where size_t is less than 64 bits."
26+
#endif
27+
1328
/*
1429
* Configuration
1530
*/
@@ -177,11 +192,7 @@
177192

178193
#pragma comment(lib, "ws2_32.lib")
179194

180-
#ifdef _WIN64
181195
using ssize_t = __int64;
182-
#else
183-
using ssize_t = long;
184-
#endif
185196
#endif // _MSC_VER
186197

187198
#ifndef S_ISREG

0 commit comments

Comments
 (0)