[libvirt] [PATCH 0/3] macOS build and CI fixes

The first one is technically a build breaker, but only affects development builds so it can wait the end of the freeze I guess. The second patch gets Travis to the point where the build failure would actually show up, and the last one is just a small cleanup. Andrea Bolognani (3): util: gettid() is Linux-specific travis: Upgrade brew packages travis: Don't try to install brew packages twice .travis.yml | 2 +- src/util/virthread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.14.3

The manual page clearly states that gettid() is Linux-specific and should not be used in programs that are intended to be portable. Unfortunately, it looks like macOS implemented the functionality and defined SYS_gettid accordingly, only to deprecate syscall() altogether with 10.12 (Sierra), released last late year. To avoid compilation errors, call gettid() on Linux only. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virthread.c b/src/util/virthread.c index 6c495158f..05b5572f5 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -268,7 +268,7 @@ bool virThreadIsSelf(virThreadPtr thread) * the pthread_self() id on Linux. */ unsigned long long virThreadSelfID(void) { -#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) +#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux__) pid_t tid = syscall(SYS_gettid); return tid; #else -- 2.14.3

On Mon, Dec 04, 2017 at 05:23:45PM +0100, Andrea Bolognani wrote:
The manual page clearly states that
gettid() is Linux-specific and should not be used in programs that are intended to be portable.
Unfortunately, it looks like macOS implemented the functionality and defined SYS_gettid accordingly, only to deprecate syscall() altogether with 10.12 (Sierra), released last late year.
To avoid compilation errors, call gettid() on Linux only.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/virthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virthread.c b/src/util/virthread.c index 6c495158f..05b5572f5 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -268,7 +268,7 @@ bool virThreadIsSelf(virThreadPtr thread) * the pthread_self() id on Linux. */ unsigned long long virThreadSelfID(void) { -#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) +#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux__) pid_t tid = syscall(SYS_gettid); return tid; #else
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Installed packages might be outdated by the time the build runs, so we should update them. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 480419dfd..70fee3b6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ env: - VIR_TEST_DEBUG=1 before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew install gnutls libgcrypt yajl gettext rpcgen; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install gnutls libgcrypt yajl gettext rpcgen; fi before_script: - ./autogen.sh -- 2.14.3

On Mon, Dec 04, 2017 at 05:23:46PM +0100, Andrea Bolognani wrote:
Installed packages might be outdated by the time the build runs, so we should update them.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml index 480419dfd..70fee3b6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ env: - VIR_TEST_DEBUG=1
before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew install gnutls libgcrypt yajl gettext rpcgen; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install gnutls libgcrypt yajl gettext rpcgen; fi
before_script: - ./autogen.sh
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

gettext, gnutls and libgcrypt are already installed on the system, so we don't need to request their installation. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 70fee3b6a..bef991cb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ env: - VIR_TEST_DEBUG=1 before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install gnutls libgcrypt yajl gettext rpcgen; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl; fi before_script: - ./autogen.sh -- 2.14.3

On Mon, Dec 04, 2017 at 05:23:47PM +0100, Andrea Bolognani wrote:
gettext, gnutls and libgcrypt are already installed on the system, so we don't need to request their installation.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml index 70fee3b6a..bef991cb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ env: - VIR_TEST_DEBUG=1
before_install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install gnutls libgcrypt yajl gettext rpcgen; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update && brew upgrade && brew install rpcgen yajl; fi
before_script: - ./autogen.sh
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrange