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

src: omit hugehelp and ca-embed from libcurltool #16068

Closed
wants to merge 10 commits into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Jan 21, 2025

CMake builds using the Xcode generator broke with an error saying it
doesn't support multiple targets depending on the same custom commands.
These custom commands are generating tool_hugehelp.c and
tool_c_embed.c for the curl tool and libcurltool.

unit1394 and unit1604 tests use libcurltool to test tool-specific
functions. They don't need hugehelp and ca-embed. It's thus safe to
disable and exclude them when compiling the sources for libcurltool.
Use the UNITTESTS macro to detect a libcurltool build within C.

After this patch these sources are solely used for building the curl
tool. Making the build compatible with the CMake Xcode generator.

Apply the change to autotools too to keep build systems synchronized.

Follow-up to 12a6de2 #16043


Clean fix for:

CMake Error in src/CMakeLists.txt:
-- Generating done (0.2s)
  The custom command generating

    /Users/runner/work/curl/curl/bld/src/tool_hugehelp.c

  is attached to multiple targets:

    curl
    curltool

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".

CMake Generate step failed.  Build files cannot be regenerated correctly.
Error: Process completed with exit code 1.

https://github.com/curl/curl/actions/runs/12840127495/job/35808354148?pr=16043#step:5:1797

```
[100%] Linking C executable units.app/units
cd /Users/runner/work/curl/curl/bld/tests/unit && /opt/homebrew/bin/cmake -E cmake_link_script CMakeFiles/units.dir/link.txt --verbose=1
Undefined symbols for architecture arm64:
  "_hugehelp", referenced from:
      _operate in libcurltool.a[2](unity_0_c.c.o)
  "_showhelp", referenced from:
      _tool_help in libcurltool.a[2](unity_0_c.c.o)
      _tool_help in libcurltool.a[2](unity_0_c.c.o)
ld: symbol(s) not found for architecture arm64
```
https://github.com/curl/curl/actions/runs/12874833803/job/35895032436
To make curltool not rely on generated sources:
`tool_hugehelp.c` and `tool_ca_embed.c`

Xcode generator doesn't support having two targets depending on
the same custom commands.

Follow-up to 12a6de2 curl#16043
@vszakats vszakats changed the title src: disable hugehelp and ca-embed calls from curltool library src: omit hugehelp and ca-embed from curltool library Jan 21, 2025
@vszakats vszakats marked this pull request as draft January 21, 2025 20:40
@vszakats

This comment was marked as resolved.

@vszakats vszakats marked this pull request as ready for review January 21, 2025 22:25
@vszakats vszakats changed the title src: omit hugehelp and ca-embed from curltool library src: omit hugehelp and ca-embed from libcurltool Jan 21, 2025
@vszakats vszakats closed this in 96843f4 Jan 22, 2025
@vszakats vszakats deleted the curltool-xcode branch January 22, 2025 10:22
vszakats added a commit that referenced this pull request Jan 26, 2025
Rework the way `tool_hugehelp.c` is included in builds.

After this patch, with `./configure` and CMake `tool_hugehelp.c` is only
compiled when building with manuals enabled. With manuals disabled this
source file is not used anymore. The method is similar to how
8a3740b implemented `tool_ca_embed.c`.
`./configure` always generates it as before, otherwise the build fails.

- winbuild: rework to not need `buildconf.bat`, but automatically use
  `tool_hugehelp.c` if present (e.g. when building from an official
  source tarball) and enable `USE_MANUAL` accordingly.

- `buildconf.bat`: after dropping `tool_hugehelp.c` generation, the only
  logic left was `cp Makefile.dist Makefile`. This allowed to launch
  winbuild builds via GNU Make in a Git repo. Drop this option together
  with the batch file.

- build `libcurltool` without `USE_MANUAL` macro to exclude the manual
  and the dependence on the generator commands. Drop relying on
  `UNITTESTS` for this purpose.
  Follow-up to 96843f4 #16068

- `src/mkhelp.pl`: include `tool_hugehelp.h` before using `USE_MANUAL`
  to have it set in `config-*.h` builds with source tarballs created
  with manual but without zlib.

Closes #16081
vszakats pushed a commit that referenced this pull request Feb 6, 2025
As `tool_hugehelp.c` is no longer included into `Makefile.inc`,
I did add it explicitly to list of source files built on IBMi.

Follow-up to 96843f4 #16068
Fixes #16214
Closes #16215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appleOS specific to an Apple operating system build cmake cmdline tool tests
Development

Successfully merging this pull request may close these issues.

1 participant