Adapt HAVE_GETHOSTUUID conditional for UIKit for macOS

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adapt HAVE_GETHOSTUUID conditional for UIKit for macOS

Micah Moore
Hello,

Attempting to use SQLite version 3.29.0 amalgamation in a [Catalyst](
https://developer.apple.com/ipad-apps-for-mac/) based project -- targeting
UIKit for macOS -- fails with the error "'gethostuuid' is unavailable: not
available on UIKit for macOS"

Specifically this conditional:

```
#if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
                           (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
#  if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \
       && (!defined(TARGET_IPHONE_SIMULATOR) ||
(TARGET_IPHONE_SIMULATOR==0))
#    define HAVE_GETHOSTUUID 1
#  else
#    warning "gethostuuid() is disabled."
#  endif
#endif
```

Should be adapted to disable gethostuuid() for TARGET_OS_UIKITFORMAC as
well:

```
#if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \
                           (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))
#  if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \
       && (!defined(TARGET_IPHONE_SIMULATOR) ||
(TARGET_IPHONE_SIMULATOR==0)) \
       && (!defined(TARGET_OS_UIKITFORMAC) || (TARGET_OS_UIKITFORMAC==0))
#    define HAVE_GETHOSTUUID 1
#  else
#    warning "gethostuuid() is disabled."
#  endif
#endif
```

Cheers,
Micah
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Adapt HAVE_GETHOSTUUID conditional for UIKit for macOS

Jens Alfke-2


> On Jul 17, 2019, at 9:29 AM, Micah Moore <[hidden email]> wrote:
>
> Attempting to use SQLite version 3.29.0 amalgamation in a [Catalyst](
> https://developer.apple.com/ipad-apps-for-mac/ <https://developer.apple.com/ipad-apps-for-mac/>) based project -- targeting
> UIKit for macOS -- fails with the error "'gethostuuid' is unavailable: not
> available on UIKit for macOS"

That's not an error, it's a warning. And it always occurs when building for iOS.

 It looks like you're building SQLite from source (why? it's already available as a dynamic library on Apple platforms) — you'll need to turn off -Werror ("Treat warnings as errors".)

—Jens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Adapt HAVE_GETHOSTUUID conditional for UIKit for macOS

Micah Moore
In reply to this post by Micah Moore
Thanks for the response.  Just to clarify, this is separate from the

`warning "gethostuuid() is disabled."` exuded from the else portion of the
conditional (when targeting iOS).  When targeting UIKit for macOS, the
conditional gets into the if portion because TARGET_OS_UIKITFORMAC is not
included as an exemption (this is the adjustment I was suggesting with my
post).

This is an error and causes a build failure because the HAVE_GETHOSTUUID is
set to 1 (so the gethostuuid() paths are included later on in the code),
even though it's not available on UIKit for macOS.

>It looks like you're building SQLite from source (why? it's already
available
as a dynamic library on Apple platforms)

While the dynamic library on Apple doesn't fail with the same error, this
issue does impact any custom builds/configurations of SQLite being built to
target the Apple ecosystem.

I can provide a test project that displays the error with Xcode 11 beta +
macOS 10.15 beta if that would be helpful.

Cheers,
Micah
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users