Skip to content

cmake: add CURL_USE_LIBUV option - #14399

Closed
vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:cm-libuv
Closed

vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:cm-libuv

Conversation

@vszakats

@vszakats vszakats commented Aug 5, 2024 •

Copy link
Copy Markdown
Member

Also use an #undef hack for CMake Unity builds to avoid the previously
included memdebug.h header messing up the declarations pulled in by
uv.h:

In file included from ~/curl/bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
In file included from ~/curl/src/tool_operate.c:54:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv.h:71:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv/unix.h:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:269:7: error: expected parameter declarator
void            freeaddrinfo(struct addrinfo *);
                ^
~/curl/lib/memdebug.h:167:31: note: expanded from macro 'freeaddrinfo'
  curl_dbg_freeaddrinfo(data, __LINE__, __FILE__)
                              ^

Follow-up to 38d334e #14298
Closes #14399

We need to undo a previous override to avoid applying it to
system headers, and messing them up:
```
In file included from ~/curl/_build-cmake-libressl/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
In file included from ~/curl/src/tool_operate.c:54:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv.h:71:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv/unix.h:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:269:7: error: expected parameter declarator
void            freeaddrinfo(struct addrinfo *);
                ^
~/curl/lib/memdebug.h:167:31: note: expanded from macro 'freeaddrinfo'
  curl_dbg_freeaddrinfo(data, __LINE__, __FILE__)
                              ^
<scratch space>:102:1: note: expanded from here
269
^
In file included from ~/curl/_build-cmake-libressl/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
In file included from ~/curl/src/tool_operate.c:54:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv.h:71:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv/unix.h:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:269:7: error: expected ')'
~/curl/lib/memdebug.h:167:31: note: expanded from macro 'freeaddrinfo'
  curl_dbg_freeaddrinfo(data, __LINE__, __FILE__)
                              ^
<scratch space>:102:1: note: expanded from here
269
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:269:7: note: to match this '('
~/curl/lib/memdebug.h:167:24: note: expanded from macro 'freeaddrinfo'
  curl_dbg_freeaddrinfo(data, __LINE__, __FILE__)
                       ^
In file included from ~/curl/_build-cmake-libressl/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
In file included from ~/curl/src/tool_operate.c:54:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv.h:71:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv/unix.h:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:271:6: error: expected parameter declarator
int             getaddrinfo(const char * __restrict, const char * __restrict,
                ^
~/curl/lib/memdebug.h:160:47: note: expanded from macro 'getaddrinfo'
  curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
                                              ^
<scratch space>:104:1: note: expanded from here
273
^
In file included from ~/curl/_build-cmake-libressl/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:88:
In file included from ~/curl/src/tool_operate.c:54:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv.h:71:
In file included from /usr/local/Cellar/libuv/1.48.0/include/uv/unix.h:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:271:6: error: expected ')'
~/curl/lib/memdebug.h:160:47: note: expanded from macro 'getaddrinfo'
  curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
                                              ^
<scratch space>:104:1: note: expanded from here
273
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/netdb.h:271:6: note: to match this '('
~/curl/lib/memdebug.h:160:23: note: expanded from macro 'getaddrinfo'
  curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
                      ^
4 errors generated.
```
@vszakats vszakats changed the title cmake: add support for CURL_USE_LIBUV option cmake: add CURL_USE_LIBUV option Aug 5, 2024
@vszakats vszakats closed this in f7d5f47 Aug 6, 2024
@vszakats
vszakats deleted the cm-libuv branch August 6, 2024 00:43
vszakats added a commit to vszakats/curl that referenced this pull request Feb 9, 2025
Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.

Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.

Ref: curl#16272
Ref: 71cf0d1 curl#14772
Ref: 3efba94 curl#14765
Ref: f7d5f47 curl#14399

Closes curl#16274
vszakats added a commit to vszakats/curl that referenced this pull request Feb 9, 2025
Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.

Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.

Ref: curl#16272
Ref: 71cf0d1 curl#14772
Ref: 3efba94 curl#14765
Ref: f7d5f47 curl#14399

Closes curl#16274
vszakats added a commit that referenced this pull request Feb 13, 2025
Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.

Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.

Also drop GHA/windows workaround and use the same unity batch across
all jobs. Follow-up to 29e4eda #16272

Ref: #16272
Ref: 71cf0d1 #14772
Ref: 3efba94 #14765
Ref: f7d5f47 #14399

Closes #16274
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.

Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.

Also drop GHA/windows workaround and use the same unity batch across
all jobs. Follow-up to 29e4eda curl#16272

Ref: curl#16272
Ref: 71cf0d1 curl#14772
Ref: 3efba94 curl#14765
Ref: f7d5f47 curl#14399

Closes curl#16274
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.

2 participants