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

Compile fails on FreeBSD with ld: error: undefined symbol: htonll #5414

Closed
mfechner opened this issue Feb 20, 2020 · 12 comments · Fixed by #5417
Closed

Compile fails on FreeBSD with ld: error: undefined symbol: htonll #5414

mfechner opened this issue Feb 20, 2020 · 12 comments · Fixed by #5417

Comments

@mfechner
Copy link

I maintain the libgit2 package for FreeBSD.

Reproduction steps

Try to compile the new version 0.99.0 on FreeBSD.

Expected behavior

It should compile.

Actual behavior

Get a linker error:

ld: error: undefined symbol: htonll
>>> referenced by ntlm.c
>>>               deps/ntlmclient/CMakeFiles/ntlmclient.dir/ntlm.c.o:(ntlm_client_response)

ld: error: undefined symbol: htonll
>>> referenced by ntlm.c
>>>               deps/ntlmclient/CMakeFiles/ntlmclient.dir/ntlm.c.o:(ntlm_client_response)

ld: error: undefined symbol: htonll
>>> referenced by ntlm.c
>>>               deps/ntlmclient/CMakeFiles/ntlmclient.dir/ntlm.c.o:(ntlm_client_response)

You can find the full build log here:
https://pkg.fechner.net/data/121amd64-gitlab/2020-02-20_22h51m26s/logs/errors/libgit2-0.99.0.log

Version of libgit2 (release number or SHA1)

0.99.0

Operating system(s) tested

FreeBSD

@hkrummeck
Copy link

The same happens on SunOS (5.10)

@pks-t
Copy link
Member

pks-t commented Feb 21, 2020

Thanks for your bug report. Just for your interest: you can work around the issue by setting USE_NTLMCLIENT=OFF, but obviously this disables support for NTLM. Anyway, we should get this fixed.

Could you please check whether #5417 fixes the problem?

@mfechner
Copy link
Author

Could you please check whether #5417 fixes the problem?

thanks a lot, that fixes the problem for FreeBSD.

@pks-t
Copy link
Member

pks-t commented Feb 22, 2020

Thanks a lot for confirming. Will wait for @hkrummeck's feedback before merging #5417.

@pks-t
Copy link
Member

pks-t commented Feb 22, 2020

@ethomson: do you know if there is an easy way for us to get at least one of the BSDs into Azure so that we have testing for them? I'd be happy to set up required scripts when we've got a VM.

@hkrummeck
Copy link

hkrummeck commented Feb 24, 2020

Unfortunately this does not work for SunOS 10, there is no htonll defined.
It was apparently first introduced in Sunos 11.

At least on SPARC this should be a null operation:

#if defined(_BIG_ENDIAN) && !defined(ntohll)
#define ntohll(x)       (x)
#define htonll(x)       (x)
#endif

I found another issue in ../src/transports/auth_ntlm.c, strndup is not available in SunOS 10. I suppose this should be git__strndup?

With these 2 changes it can be compiled and linked.

@ethomson
Copy link
Member

Unfortunately this does not work for SunOS 10, there is no htonll defined.
It was apparently first introduced in Sunos 11.

Thanks for the info. We should be cognizant of little endian machines as well, as there was SunOS for x86 platforms.

I found another issue in ../src/transports/auth_ntlm.c, strndup is not available in SunOS 10. I suppose this should be git__strndup?

Yes, thanks, it probably should.

@ethomson
Copy link
Member

@ethomson: do you know if there is an easy way for us to get at least one of the BSDs into Azure so that we have testing for them? I'd be happy to set up required scripts when we've got a VM.

I started working on this: ethomson@1fe3fa5

Maintaining a FreeBSD machine is a bit of a pain, due to cost. It gets disabled if I hit my preset spending limits in my cloud provider, which would cause the nightlies to fail. But we can and should figure out a solution here.

@pks-t
Copy link
Member

pks-t commented Feb 24, 2020

@hkrummeck: I've amended my PR to hopefully fix this with SunOS<=10

@pks-t
Copy link
Member

pks-t commented Feb 24, 2020

I've also rolled in the strndup/strdup fixes. @ethomson, please let me know if I should move them into a separate PR. They seem to be trivial enough though to keep them here, though

@ethomson
Copy link
Member

This LGTM

@hkrummeck
Copy link

Yes, thanks, this fix builds on SunOS 10.

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

Successfully merging a pull request may close this issue.

4 participants