Skip to contentSkip to conversation

firefox: Fix build with x86_64/musl

PATCH New Khem Raj 1 participant 3 messages Jul 10, 2017

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 firefox: Fix build with x86_64/musl

---
 .../0005-original-patch-fix_off64_t.patch.patch    | 63 +++++++++++++++
 .../0006-original-patch-getcontext.patch.patch     | 30 ++++++++
 .../0007-original-patch-basename.patch.patch       | 51 ++++++++++++
 ...original-patch-musl-missing-headers.patch.patch | 32 ++++++++
 .../firefox/0009-original-patch-stab.h.patch.patch | 90 ++++++++++++++++++++++
 .../firefox/firefox/0010-Define-N_UNDF.patch       | 31 ++++++++
 ...-libav-with-sysctl-on-Unix-it-s-not-used-.patch | 30 ++++++++
 ...alls-siginfo_t-member-__si_fields-instead.patch | 30 ++++++++
 recipes-mozilla/firefox/firefox_45.9.0esr.bb       |  8 ++
 9 files changed, 365 insertions(+)
 create mode 100644 recipes-mozilla/firefox/firefox/0005-original-patch-fix_off64_t.patch.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0006-original-patch-getcontext.patch.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0007-original-patch-basename.patch.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0008-original-patch-musl-missing-headers.patch.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0009-original-patch-stab.h.patch.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0010-Define-N_UNDF.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0011-Don-t-build-libav-with-sysctl-on-Unix-it-s-not-used-.patch
 create mode 100644 recipes-mozilla/firefox/firefox/0012-musl-libc-calls-siginfo_t-member-__si_fields-instead.patch
recipes-mozilla/firefox/firefox/0005-original-patch-fix_off64_t.patch.patch new file +63 -0
new file mode 100644
index 0000000..ea6ff87
@@ -0,0 +1,63 @@
+From b1a3d3332e74b5a1bcf2a4fb7e08f3dece08318c Mon Sep 17 00:00:00 2001
+From: OpenEmbedded <oe.patch@oe>
+Date: Sat, 8 Jul 2017 15:57:20 -0700
+Subject: [PATCH 05/12] %% original patch: fix_off64_t.patch
+
+---
+ toolkit/crashreporter/google-breakpad/src/common/moz.build           | 5 +++--
+ .../google-breakpad/src/third_party/lss/linux_syscall_support.h      | 2 +-
+ tools/profiler/core/platform.h                                       | 2 +-
+ 3 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/toolkit/crashreporter/google-breakpad/src/common/moz.build b/toolkit/crashreporter/google-breakpad/src/common/moz.build
+index 6456e2864..9aec5afd3 100644
+--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
++++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
+@@ -35,8 +35,8 @@ if CONFIG['OS_ARCH'] == 'Linux':
+         'linux/dump_symbols.cc',
+         'linux/elf_symbols_to_module.cc',
+     ]
+-    HOST_DEFINES['HAVE_A_OUT_H'] = True
+-    DEFINES['HAVE_A_OUT_H'] = True
++    HOST_DEFINES['HAVE_A_OUT_H'] = False
++    DEFINES['HAVE_A_OUT_H'] = False
+ 
+ if CONFIG['OS_ARCH'] == 'Darwin' and CONFIG['HOST_OS_ARCH'] != 'Darwin':
+     HOST_CXXFLAGS += [
+@@ -98,6 +98,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+ 
+ if CONFIG['OS_TARGET'] == 'Android':
+     DEFINES['NO_STABS_SUPPORT'] = True
++DEFINES['NO_STABS_SUPPORT'] = True
+ 
+ DEFINES['BP_LOGGING_INCLUDE'] = '"BreakpadLogging.h"'
+ 
+diff --git a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+index 18277490f..b67d3a92d 100644
+--- a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
++++ b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+@@ -2814,7 +2814,7 @@ struct kernel_statfs {
+     LSS_INLINE _syscall6(void*, mmap,              void*, s,
+                          size_t,                   l, int,               p,
+                          int,                      f, int,               d,
+-                         __off64_t,                o)
++                         off64_t,                o)
+ 
+     LSS_INLINE _syscall4(int, newfstatat,         int,   d,
+                          const char *,            p,
+diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h
+index 5d2e25c8e..4917e5b8e 100644
+--- a/tools/profiler/core/platform.h
++++ b/tools/profiler/core/platform.h
+@@ -61,7 +61,7 @@
+ 
+ // We need a definition of gettid(), but glibc doesn't provide a
+ // wrapper for it.
+-#if defined(__GLIBC__)
++#if defined(__linux__)
+ #include <unistd.h>
+ #include <sys/syscall.h>
+ static inline pid_t gettid()
+-- 
+2.13.2
+
recipes-mozilla/firefox/firefox/0006-original-patch-getcontext.patch.patch new file +30 -0
new file mode 100644
index 0000000..c8b101e
@@ -0,0 +1,30 @@
+From ba081ed6eb612d72e0d9deb5cf40aa6f8ff5380a Mon Sep 17 00:00:00 2001
+From: OpenEmbedded <oe.patch@oe>
+Date: Sat, 8 Jul 2017 15:57:22 -0700
+Subject: [PATCH 06/12] %% original patch: getcontext.patch
+
+---
+ tools/profiler/core/platform-linux.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tools/profiler/core/platform-linux.cc b/tools/profiler/core/platform-linux.cc
+index 0df1e8f08..d8688959d 100644
+--- a/tools/profiler/core/platform-linux.cc
++++ b/tools/profiler/core/platform-linux.cc
+@@ -711,11 +711,13 @@ void OS::Startup() {
+ void TickSample::PopulateContext(void* aContext)
+ {
+   MOZ_ASSERT(aContext);
++#if defined(__GLIBC__)
+   ucontext_t* pContext = reinterpret_cast<ucontext_t*>(aContext);
+   if (!getcontext(pContext)) {
+     context = pContext;
+     SetSampleContext(this, aContext);
+   }
++#endif
+ }
+ 
+ void OS::SleepMicro(int microseconds)
+-- 
+2.13.2
+
recipes-mozilla/firefox/firefox/0007-original-patch-basename.patch.patch new file +51 -0

51 lines not on this page · raw message

recipes-mozilla/firefox/firefox/0008-original-patch-musl-missing-headers.patch.patch new file +32 -0
new file mode 100644
index 0000000..8198863
@@ -0,0 +1,32 @@
+From 68aa10845658bd4493e35e37d636002f87b57486 Mon Sep 17 00:00:00 2001
+From: OpenEmbedded <oe.patch@oe>
+Date: Sat, 8 Jul 2017 15:57:27 -0700
+Subject: [PATCH 08/12] %% original patch: musl-missing-headers.patch
+
+---
+ config/system-headers | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/config/system-headers b/config/system-headers
+index 403fa8d95..0fc063530 100644
+--- a/config/system-headers
++++ b/config/system-headers
+@@ -420,7 +420,6 @@ execinfo.h
+ extras.h
+ fabdef.h
+ fcntl.h
+-features.h
+ fibdef.h
+ File.h
+ filehdr.h
+@@ -1065,7 +1064,6 @@ sys/statfs.h
+ sys/stat.h
+ sys/statvfs.h
+ sys/syscall.h
+-sys/sysctl.h
+ sys/sysinfo.h
+ sys/sysmp.h
+ sys/syssgi.h
+-- 
+2.13.2
+
recipes-mozilla/firefox/firefox/0009-original-patch-stab.h.patch.patch new file +90 -0

90 lines not on this page · raw message

recipes-mozilla/firefox/firefox/0010-Define-N_UNDF.patch new file +31 -0
new file mode 100644
index 0000000..7baae8f
@@ -0,0 +1,31 @@
+From 86544a22d8f241b3ba2545f470831edc019c6638 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 8 Jul 2017 16:08:43 -0700
+Subject: [PATCH 10/12] Define N_UNDF
+
+Fixes
+error: 'N_UNDF' was not declared in this scope
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ toolkit/crashreporter/google-breakpad/src/stab.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/toolkit/crashreporter/google-breakpad/src/stab.h b/toolkit/crashreporter/google-breakpad/src/stab.h
+index 6f70af398..8fb2ffc97 100644
+--- a/toolkit/crashreporter/google-breakpad/src/stab.h
++++ b/toolkit/crashreporter/google-breakpad/src/stab.h
+@@ -41,6 +41,10 @@
+  * the N_STAB mask set.
+  */
+ 
++#if !defined (N_UNDF)
++#define N_UNDF 0
++#endif
++
+ #define	N_GSYM		0x20	/* global symbol */
+ #define	N_FNAME		0x22	/* F77 function name */
+ #define	N_FUN		0x24	/* procedure name */
+-- 
+2.13.2
+
recipes-mozilla/firefox/firefox/0011-Don-t-build-libav-with-sysctl-on-Unix-it-s-not-used-.patch new file +30 -0
new file mode 100644
index 0000000..4afb804
@@ -0,0 +1,30 @@
+From b31468e975212556f1d8c7d5d2cf8f3313496803 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 8 Jul 2017 16:27:06 -0700
+Subject: [PATCH 11/12] Don't build libav with sysctl on Unix (it's not used
+ anyway)
+
+backported from
+https://hg.mozilla.org/integration/mozilla-inbound/rev/081c52bae5e7
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ media/libav/config_unix.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/media/libav/config_unix.h b/media/libav/config_unix.h
+index 3921293a0..b3c44d62b 100644
+--- a/media/libav/config_unix.h
++++ b/media/libav/config_unix.h
+@@ -219,7 +219,7 @@
+ #define HAVE_STRERROR_R 1
+ #define HAVE_STRPTIME 1
+ #define HAVE_SYSCONF 1
+-#define HAVE_SYSCTL 1
++#define HAVE_SYSCTL 0
+ #define HAVE_USLEEP 1
+ #define HAVE_VIRTUALALLOC 0
+ #define HAVE_PTHREADS 0
+-- 
+2.13.2
+
recipes-mozilla/firefox/firefox/0012-musl-libc-calls-siginfo_t-member-__si_fields-instead.patch new file +30 -0
new file mode 100644
index 0000000..9b9af86
@@ -0,0 +1,30 @@
+From 92e6fdcc84c69ae25e9d4ed9e1e9c3203afeeaea Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 8 Jul 2017 16:37:03 -0700
+Subject: [PATCH 12/12] musl libc calls siginfo_t member __si_fields instead of
+ _sifields
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
+index dce6b7b85..5b2e2cc02 100644
+--- a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
++++ b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
+@@ -23,6 +23,11 @@
+ #include "sandbox/linux/services/android_ucontext.h"
+ #endif
+ 
++// musl libc defines siginfo_t __si_fields instead of _sifields
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++#define _sifields __si_fields
++#endif
++
+ namespace {
+ 
+ struct arch_sigsys {
+-- 
+2.13.2
+
recipes-mozilla/firefox/firefox_45.9.0esr.bb +8 -0
index 5087df0..55b2f3c 100644
@@ -50,6 +50,14 @@ SRC_URI_append_libc-musl = "\
            file://0002-disable-hunspell-hooks.patch \
            file://0003-define-TEMP_FAILURE_RETRY.patch \
            file://0004-Fix-mozilla-arm-builds.patch \
+           file://0005-original-patch-fix_off64_t.patch.patch \
+           file://0006-original-patch-getcontext.patch.patch \
+           file://0007-original-patch-basename.patch.patch \
+           file://0008-original-patch-musl-missing-headers.patch.patch \
+           file://0009-original-patch-stab.h.patch.patch \
+           file://0010-Define-N_UNDF.patch \
+           file://0011-Don-t-build-libav-with-sysctl-on-Unix-it-s-not-used-.patch \
+           file://0012-musl-libc-calls-siginfo_t-member-__si_fields-instead.patch \
 "
 
 SRC_URI[archive.md5sum] = "f4d83c5150fc5085db20d71862497eb8"
Signature · 1 line
2.13.2
author
#1 lore raw

PATCH 2/3 chromium: Fix build on musl/x86_64

---
 recipes-browser/chromium/chromium-browser.inc      |  2 +
 ...017-Use-_fpstate-instead-of-_libc_fpstate.patch | 65 ++++++++++++++++++++++
 ...tcmalloc-Use-off64_t-insread-of-__off64_t.patch | 26 +++++++++
 3 files changed, 93 insertions(+)
 create mode 100644 recipes-browser/chromium/chromium/0017-Use-_fpstate-instead-of-_libc_fpstate.patch
 create mode 100644 recipes-browser/chromium/chromium/0018-tcmalloc-Use-off64_t-insread-of-__off64_t.patch
recipes-browser/chromium/chromium-browser.inc +2 -0
index a1e22d6..094a3d3 100644
@@ -49,6 +49,8 @@ SRC_URI_append_libc-musl = "\
            file://0014-link-with-libexecinfo-on-musl.patch \
            file://0015-metrics-Keep-GNU-extentions-effective-only-when-usin.patch \
            file://0016-getcontext-API-is-unimplemented-in-musl.patch \
+           file://0017-Use-_fpstate-instead-of-_libc_fpstate.patch \
+           file://0018-tcmalloc-Use-off64_t-insread-of-__off64_t.patch \
 "
 
 S = "${WORKDIR}/chromium-${PV}"
recipes-browser/chromium/chromium/0017-Use-_fpstate-instead-of-_libc_fpstate.patch new file +65 -0

65 lines not on this page · raw message

recipes-browser/chromium/chromium/0018-tcmalloc-Use-off64_t-insread-of-__off64_t.patch new file +26 -0
new file mode 100644
index 0000000..2ef5433
@@ -0,0 +1,26 @@
+From 1a468dd5239ebdf013d9ffb3a2d181d0434b4c6c Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 8 Jul 2017 09:08:23 -0700
+Subject: [PATCH 2/2] tcmalloc: Use off64_t insread of __off64_t
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ third_party/tcmalloc/chromium/src/base/linux_syscall_support.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h b/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+index b53dd46c5..58da4d19d 100644
+--- a/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
++++ b/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+@@ -1930,7 +1930,7 @@ typedef unsigned long int ulong;
+   #if defined(__x86_64__)
+     /* Need to make sure __off64_t isn't truncated to 32-bits under x32.  */
+     LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
+-                                    __off64_t o) {
++                                    off64_t o) {
+       LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l),
+                                LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f),
+                                LSS_SYSCALL_ARG(d), (uint64_t)(o));
+-- 
+2.13.2
+
Signature · 1 line
2.13.2
author
#2 lore raw

PATCH 3/3 firefox: Fix host library contamination on x86_64

In reply to Khem Raj

On x86_64 build system starts to poke into build system libraries and its especially seen with glibc 2.26 since it has deprecated certain symbols which are not available in libc

e.g.

/usr/lib/libresolv.so.2: undefined reference to `__res_maybe_init@GLIBC_PRIVATE'
collect2: error: ld returned 1 exit status

So its linking to libresolv.so from host system is clear due to this error because its then using libc.so from cross build which is glibc 2.26 and doesnt have that symbol.

Explicilty specify -lresolv on linker cmdline for components where its needed.

---
 .../firefox/firefox/add-libresolv.patch            | 40 ++++++++++++++++++++++
 recipes-mozilla/firefox/firefox_45.9.0esr.bb       |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 recipes-mozilla/firefox/firefox/add-libresolv.patch
recipes-mozilla/firefox/firefox/add-libresolv.patch new file +40 -0
new file mode 100644
index 0000000..4bd0131
@@ -0,0 +1,40 @@
+Index: firefox-45.9.0esr/webapprt/gtk/moz.build
+===================================================================
+--- firefox-45.9.0esr.orig/webapprt/gtk/moz.build
++++ firefox-45.9.0esr/webapprt/gtk/moz.build
+@@ -24,3 +24,7 @@ DISABLE_STL_WRAPPING = True
+ CXXFLAGS += CONFIG['TK_CFLAGS']
+ 
+ OS_LIBS += CONFIG['TK_LIBS']
++OS_LIBS += [
++    'resolv',
++]
++
+Index: firefox-45.9.0esr/ipc/app/moz.build
+===================================================================
+--- firefox-45.9.0esr.orig/ipc/app/moz.build
++++ firefox-45.9.0esr/ipc/app/moz.build
+@@ -129,6 +129,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
+         'binder',
+         'utils',
+     ]
++OS_LIBS += [
++    'resolv',
++]
+ 
+ if CONFIG['GNU_CXX']:
+     CXXFLAGS += ['-Wshadow']
+Index: firefox-45.9.0esr/js/xpconnect/shell/moz.build
+===================================================================
+--- firefox-45.9.0esr.orig/js/xpconnect/shell/moz.build
++++ firefox-45.9.0esr/js/xpconnect/shell/moz.build
+@@ -35,6 +35,9 @@ if CONFIG['OS_ARCH'] == 'WINNT':
+ CFLAGS += CONFIG['TK_CFLAGS']
+ CXXFLAGS += CONFIG['TK_CFLAGS']
+ OS_LIBS += CONFIG['TK_LIBS']
++OS_LIBS += [
++    'resolv',
++]
+ 
+ if CONFIG['GNU_CXX']:
+     CXXFLAGS += ['-Wshadow']
recipes-mozilla/firefox/firefox_45.9.0esr.bb +1 -0
index 55b2f3c..3f2fbe0 100644
@@ -44,6 +44,7 @@ SRC_URI = "https://archive.mozilla.org/pub/firefox/releases/${PV}/source/firefox
            file://0003-do-not-link-against-crmf-library-it-is-not-there.patch \
            file://gcc7.patch \
            file://remove_AC_PATH_XTRA.patch \
+           file://add-libresolv.patch \
 "
 SRC_URI_append_libc-musl = "\
            file://0001-mallinfo-is-glibc-specific-API.patch \
Signature · 1 line
2.13.2