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

Undefined symbols _htonll on OS X 10.9 and earlier #5613

Closed
ryandesign opened this issue Aug 24, 2020 · 2 comments
Closed

Undefined symbols _htonll on OS X 10.9 and earlier #5613

ryandesign opened this issue Aug 24, 2020 · 2 comments

Comments

@ryandesign
Copy link

Hi, I'm a MacPorts developer. We recently updated our libgit2 to 1.0.1 and found that it builds fine on OS X 10.10 and later but fails on 10.9 and earlier because of your use of htonll which was not added to OS X until 10.10.

You have some code in deps/ntlmclient/compat.h (see #5414) for defining compatibility versions of htonll on various systems but you haven't considered OS X there.

Instead of having to handle each operating system individually, it might be better to have your cmake script test whether htonll is available and use a compatibility implementation otherwise. That would automatically handle OS X 10.9 and earlier and any other systems you haven't yet considered.

Reproduction steps

build libgit2

Expected behavior

successful build

Actual behavior

build failure:

deps/ntlmclient/ntlm.c:1129:16: warning: implicit declaration of function 'htonll' is invalid in C99 [-Wimplicit-function-declaration]
        local_nonce = htonll(ntlm->nonce);
                      ^
Undefined symbols for architecture x86_64:
  "_htonll", referenced from:
      _ntlm_client_response in ntlm.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libgit2.1.0.1.dylib] Error 1

Version of libgit2 (release number or SHA1)

1.0.1

Operating system(s) tested

OS X (macOS) 10.9.5

@pks-t
Copy link
Member

pks-t commented Aug 24, 2020

Instead of having to handle each operating system individually, it might be better to have your cmake script test whether htonll is available and use a compatibility implementation otherwise. That would automatically handle OS X 10.9 and earlier and any other systems you haven't yet considered.

Yeah, you're right about this. I've opened #5614 to fix this once and for all.

dbevans added a commit to macports/macports-ports that referenced this issue Aug 25, 2020
Macro htonll() is not defined on these platforms.

Closes https://trac.macports.org/ticket/61057

Thanks to @ryandesign for pushing this upstream.
See libgit2/libgit2#5613
and libgit2/libgit2#5614.
@ethomson
Copy link
Member

ethomson commented Mar 9, 2024

Fixed via #5658

@ethomson ethomson closed this as completed Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants