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

curl 7.85 can not be built with musl-libc #9560

Closed
georgthegreat opened this issue Sep 21, 2022 · 5 comments
Closed

curl 7.85 can not be built with musl-libc #9560

georgthegreat opened this issue Sep 21, 2022 · 5 comments
Assignees
Labels

Comments

@georgthegreat
Copy link

georgthegreat commented Sep 21, 2022

Compilation is broken with the following output:

In file included from contrib/libs/curl/lib/easy.c:89:
In file included from contrib/libs/curl/lib/easy_lock.h:53:
contrib/libs/musl/include/sched.h:84:7: error: redefinition of 'Curl_ccalloc' as different kind of symbol
void *calloc(size_t, size_t);
      ^
contrib/libs/curl/lib/curl_memory.h:128:29: note: expanded from macro 'calloc'
#define calloc(nbelem,size) Curl_ccalloc(nbelem, size)
                            ^
contrib/libs/curl/lib/curl_memory.h:107:29: note: previous definition is here
extern curl_calloc_callback Curl_ccalloc;
                            ^
In file included from contrib/libs/curl/lib/easy.c:89:
In file included from contrib/libs/curl/lib/easy_lock.h:53:
/home/thegeorg/arcadia/contrib/libs/musl/include/sched.h:85:6: error: redefinition of 'Curl_cfree' as different kind of symbol
void free(void *);
     ^
contrib/libs/curl/lib/curl_memory.h:132:19: note: expanded from macro 'free'
#define free(ptr) Curl_cfree(ptr)
                  ^
contrib/libs/curl/lib/curl_memory.h:104:27: note: previous definition is here
extern curl_free_callback Curl_cfree;

Upon brief research it looks like curl by default (i. e. when no CURLDEBUG is defined) goes through double definition chain (i. e. defining #define free(ptr) Curl_cfree(ptr) and invoke free() from Curl_cfree.

In musl it is impossible to #undef free, as free is not a macro in musl.

By studying the diff I was unable to find a changeset causing the problem.
Could you, please, take a look?

@bagder bagder added the build label Sep 21, 2022
@bagder
Copy link
Member

bagder commented Sep 21, 2022

In musl it is impossible to #undef free, as free is not a macro in musl.

It is not a define virtually anywhere (the undef is but a precaution for some edge case we ran into decades ago) and in C, undef'ing a symbol that isn't defined is just a no-op.

@georgthegreat
Copy link
Author

georgthegreat commented Sep 21, 2022

7.84.0 is buildable with musl, so it is the minor update that caused the issie.

bagder added a commit that referenced this issue Sep 21, 2022
The mentioned "last 3 includes" order should be respected. easy_lock.h should
be included before those three.

Reported-by: Yuriy Chernyshov
Fixes #9560
@bagder
Copy link
Member

bagder commented Sep 21, 2022

Yes, but it is not the undef causing it...

@bagder
Copy link
Member

bagder commented Sep 21, 2022

Try #9561, I think it fixes the issue!

@georgthegreat
Copy link
Author

georgthegreat commented Sep 21, 2022

Thanks, this worked.

@bagder bagder self-assigned this Sep 21, 2022
@bagder bagder closed this as completed in 1998f34 Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants