Bug #73405 Build fails when ntohll is a macro not a function
Submitted: 26 Jul 2014 17:20 Modified: 20 Nov 2018 11:50
Reporter: Ryan Schmidt Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.19 OS:Any
Assigned to: CPU Architecture:Any

[26 Jul 2014 17:20] Ryan Schmidt
Description:
In mysql 5.6.19, the cmake test you're using to determine if ntohll exists seems to assume that if it's available, then it is a symbol in a library. It fails to be properly detected, and a subsequent build error results, if it is instead a #define'd macro in header.

How to repeat:
Build mysql on a system where ntohll is a macro and not a library function
[26 Jul 2014 19:39] Ryan Schmidt
Another project which was using the same type of ntohll detection found a solution:

https://github.com/alanxz/rabbitmq-c/issues/200
https://github.com/alanxz/rabbitmq-c/commit/c7716b8bb9080bdec51dcbd571d16eeaeea5e5b6

I'll attach patches to fix the problem for mysql.
[26 Jul 2014 19:40] Ryan Schmidt
patch for configure.cmake

Attachment: patch-configure.cmake.diff (application/octet-stream, text), 532 bytes.

[26 Jul 2014 19:40] Ryan Schmidt
patch for util.h

Attachment: patch-innodb_memcached-daemon_memcached-include-memcached-util.h.diff (application/octet-stream, text), 400 bytes.

[29 Jul 2014 17:49] Sveta Smirnova
Thank you for the report.

I can verify this as feature request only unless you provide example of any OS which is supported by MySQL officially and has htonll defined as a macro.
[29 Jul 2014 17:50] Sveta Smirnova
Also, in order for us to accept patches you need to sign Oracle Contributor Agreement as described in the "Contributions" tab. Please sign it.

Thanks in advance.
[14 May 2015 4:23] Hanxue Lee
Hello Sveta,

MySQL still cannot properly build on OSX 10.10.4 - updated on 11th May 2015. According to the official MySQL list of supported platforms, OSX 10.10 is supported http://www.mysql.com/support/supportedplatforms/database.html

Could you as a developer create a new commit and patch the files directly please?
[6 May 2016 17:13] Andrew Janke
I can confirm that on OS X (which is on the supported OS list), `ntohll` is defined as a macro, at least in some circumstances, when using Xcode, which is the platform's official development environment.

Here's an example from Xcode 6.2, the most recent Xcode for OS X 10.9. You can see `ntohll` being defined via a macro.

```
[/Applications/Xcode-6.2.app/Contents/Developer/Platforms/MacOSX.platform]
$ grep -r ntohll *
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/_endian.h:#define ntohll(x)       ((__uint64_t)(x))
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/_endian.h:#define ntohll(x)       __DARWIN_OSSwapInt64(x)
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Headers/sys/_endian.h:#define	NTOHLL(x)	(x) = ntohll((__uint64_t)x)
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/_endian.h:#define ntohll(x)       ((__uint64_t)(x))
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/_endian.h:#define ntohll(x)       __DARWIN_OSSwapInt64(x)
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/_endian.h:#define	NTOHLL(x)	(x) = ntohll((__uint64_t)x)
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/_endian.h:#define ntohll(x)       ((__uint64_t)(x))
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/_endian.h:#define ntohll(x)       __DARWIN_OSSwapInt64(x)
Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/_endian.h:#define	NTOHLL(x)	(x) = ntohll((__uint64_t)x)
grep: warning: Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Headers/ruby/ruby: recursive directory loop
grep: warning: Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/Headers/ruby/ruby: recursive directory loop
grep: warning: Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby: recursive directory loop
Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/_endian.h:#define ntohll(x)       ((__uint64_t)(x))
Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/_endian.h:#define ntohll(x)       __DARWIN_OSSwapInt64(x)
```

Would it be possible to get this fixed so we can build MySQL with memcached support on OS X?
[20 Nov 2018 11:50] Dyre Tjeldvoll
Posted by developer:
 
Thank you for pointing this out. At this point, though, we do not have this issue on our supported platforms (incl. MacOSX), so our only option is to close this bug.