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

cmake: fix missing zlib.h when compiling libcurltool #11927

Closed

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Sep 24, 2023

Came up while testing debug/testing build for Windows. I'm not sure why it didn't come up in earlier tests with similar config. tool_hugehelp.c might indeed require zlib.h and without linking CURL_LIBS to the curltool target, CMake doesn't seem to add detected dependency headers to the compiler command.

[ 25%] Building C object src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
cd .../curl/bld-cmake-llvm-x64/src && /usr/local/opt/llvm/bin/clang
  --target=x86_64-w64-mingw32 --sysroot=/usr/local/opt/mingw-w64/toolchain-x86_64
  -DCURLDEBUG -DCURL_STATICLIB -DHAVE_CONFIG_H -DUNICODE -DUNITTESTS -D_UNICODE
  -I.../curl/include -I.../curl/lib -I.../curl/bld-cmake-llvm-x64/lib
  -I.../curl/bld-cmake-llvm-x64/include -I.../curl/src -Wno-unused-command-line-argument
  -D_UCRT -DDEBUGBUILD -DHAS_ALPN -DUSE_MANUAL=1  -fuse-ld=lld -Wl,-s -static-libgcc
  -lucrt [...] -O3 -DNDEBUG -municode -MD
  -MT src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
  -MF CMakeFiles/curltool.dir/tool_hugehelp.c.obj.d
  -o CMakeFiles/curltool.dir/tool_hugehelp.c.obj -c .../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c
.../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c:6:10: fatal error: 'zlib.h' file not found
    6 | #include <zlib.h>
      |          ^~~~~~~~

Follow-up to 39e7c22

Closes #11927

Came up while testing debug/testing build for Windows. I'm not sure why
it didn't come up in earlier tests with similar config.
`tool_hugehelp.c` might indeed require `zlib.h` and without linking
`CURL_LIBS` to the `curltool` target, CMake doesn't seem to add detected
dependency headers to the compiler command.

```
[ 25%] Building C object src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
cd .../curl/bld-cmake-llvm-x64/src && /usr/local/opt/llvm/bin/clang
  --target=x86_64-w64-mingw32 --sysroot=/usr/local/opt/mingw-w64/toolchain-x86_64
  -DCURLDEBUG -DCURL_STATICLIB -DHAVE_CONFIG_H -DUNICODE -DUNITTESTS -D_UNICODE
  -I.../curl/include -I.../curl/lib -I.../curl/bld-cmake-llvm-x64/lib
  -I.../curl/bld-cmake-llvm-x64/include -I.../curl/src -Wno-unused-command-line-argument
  -D_UCRT -DDEBUGBUILD -DHAS_ALPN -DUSE_MANUAL=1  -fuse-ld=lld -Wl,-s -static-libgcc
  -lucrt [...] -O3 -DNDEBUG -municode -MD
  -MT src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
  -MF CMakeFiles/curltool.dir/tool_hugehelp.c.obj.d
  -o CMakeFiles/curltool.dir/tool_hugehelp.c.obj -c .../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c
.../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c:6:10: fatal error: 'zlib.h' file not found
    6 | #include <zlib.h>
      |          ^~~~~~~~
```

Follow-up to 39e7c22

Closes #xxxxx
vszakats added a commit to vszakats/curl that referenced this pull request Sep 24, 2023
Came up while testing debug/testing build for Windows. I'm not sure why
it didn't come up in earlier tests with similar config.
`tool_hugehelp.c` might indeed require `zlib.h` and without linking
`CURL_LIBS` to the `curltool` target, CMake doesn't seem to add detected
dependency headers to the compiler command.

```
[ 25%] Building C object src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
cd .../curl/bld-cmake-llvm-x64/src && /usr/local/opt/llvm/bin/clang
  --target=x86_64-w64-mingw32 --sysroot=/usr/local/opt/mingw-w64/toolchain-x86_64
  -DCURLDEBUG -DCURL_STATICLIB -DHAVE_CONFIG_H -DUNICODE -DUNITTESTS -D_UNICODE
  -I.../curl/include -I.../curl/lib -I.../curl/bld-cmake-llvm-x64/lib
  -I.../curl/bld-cmake-llvm-x64/include -I.../curl/src -Wno-unused-command-line-argument
  -D_UCRT -DDEBUGBUILD -DHAS_ALPN -DUSE_MANUAL=1  -fuse-ld=lld -Wl,-s -static-libgcc
  -lucrt [...] -O3 -DNDEBUG -municode -MD
  -MT src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
  -MF CMakeFiles/curltool.dir/tool_hugehelp.c.obj.d
  -o CMakeFiles/curltool.dir/tool_hugehelp.c.obj -c .../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c
.../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c:6:10: fatal error: 'zlib.h' file not found
    6 | #include <zlib.h>
      |          ^~~~~~~~
```

Follow-up to 39e7c22

Closes curl#11927
@vszakats vszakats closed this in f3303b5 Sep 25, 2023
@vszakats vszakats deleted the fix-curltool-lib-missing-zlibh branch September 25, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant