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 reference to `htobe64' #157

Closed
noloader opened this issue Jan 29, 2020 · 3 comments
Closed

undefined reference to `htobe64' #157

noloader opened this issue Jan 29, 2020 · 3 comments

Comments

@noloader
Copy link
Contributor

@noloader noloader commented Jan 29, 2020

Hi Everyone,

I'm working on a an older, CentOS 5, x86_64 machine. I use it for regression testing of some libraries. The machine provides GCC 4.1 and glibc 2.5, and the machine lacks htobe64, be64toh, __builtin_bswap64 and friends.

I need some up to date tools on the old machine, and Unbound gets built as a dependency. Attempting a compile results in:

.libs/cachedb.o: In function `prep_data':
/home/jwalton/Build-Scripts/unbound-1.9.1/cachedb/cachedb.c:400: undefined reference to `htobe64'
/home/jwalton/Build-Scripts/unbound-1.9.1/cachedb/cachedb.c:401: undefined reference to `htobe64'
.libs/cachedb.o: In function `good_expiry_and_qinfo':
/home/jwalton/Build-Scripts/unbound-1.9.1/cachedb/cachedb.c:424: undefined reference to `be64toh'
.libs/cachedb.o: In function `parse_data':
/home/jwalton/Build-Scripts/unbound-1.9.1/cachedb/cachedb.c:484: undefined reference to `be64toh'
/home/jwalton/Build-Scripts/unbound-1.9.1/cachedb/cachedb.c:485: undefined reference to `be64toh'
collect2: ld returned 1 exit status
gmake: *** [unbound-checkconf] Error 1
Failed to build Unbound

You might want to use a TRY_LINK test (not a TRY_COMPILE test) for htobe64 and be64toh since missing symbols may not cause a compile failure.

Update: I was testing an older version of Unbound. If this has been fixed, please close/delete this report.

@wcawijngaards
Copy link
Member

@wcawijngaards wcawijngaards commented Jan 29, 2020

Hi,
The commit above performs the TRY_LINK that you suggest, and tests for the function and provides a workaround if it is not present. If it does not work, please show what goes wrong in the configure.ac and config.log output (for htobe64), or what the compiler reports.

@noloader
Copy link
Contributor Author

@noloader noloader commented Jan 29, 2020

Thanks @wcawijngaards .

It looks good to me. I cloned and used makedist.sh to build a 1.9.7 release tarball. The tarball tested OK on the old machine.

I think this is the snippet of interest:

$ ./configure
...
checking for struct in_pktinfo.ipi_spec_dst... yes
checking for htobe64... no
checking for be64toh... no
checking for library containing setusercontext... no
...

@wcawijngaards
Copy link
Member

@wcawijngaards wcawijngaards commented Jan 29, 2020

Thanks! Good to know it works.

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

2 participants