kenz-gelsoft / gecko-dev

Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/setup/index.html
Other
16 stars 2 forks source link

B_USE_POSITIVE_POSIX_ERROR to build #44

Open kenz-gelsoft opened 2 months ago

kenz-gelsoft commented 2 months ago

like dependent libraries

CPPFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -DEV_ENABLE=0" \
        LDFLAGS="-lbsd -lposix_error_mapper -lnetwork" \
kenz-gelsoft commented 2 months ago

https://searchfox.org/mozilla-esr128/source/toolkit/library/moz.build#33

kenz-gelsoft commented 2 months ago

https://searchfox.org/mozilla-esr128/source/browser/app/moz.build#115

kenz-gelsoft commented 2 months ago
diff --git a/browser/app/moz.build b/browser/app/moz.build
index 434167c9961a..d9fbe8b7fd38 100644
--- a/browser/app/moz.build
+++ b/browser/app/moz.build
@@ -117,6 +117,11 @@ if CONFIG["OS_ARCH"] == "Darwin":
         "-framework CoreFoundation",
     ]

+if CONFIG["OS_ARCH"] == "Haiku":
+    OS_LIBS += [
+        "posix_error_mapper",
+    ]
+
 if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT":
     # For sandbox includes and the include dependencies those have
     LOCAL_INCLUDES += [
diff --git a/haiku_mozconfig b/haiku_mozconfig
index 484aa884feb3..70392a0def2c 100644
--- a/haiku_mozconfig
+++ b/haiku_mozconfig
@@ -1,3 +1,4 @@
+mk_add_options B_USE_POSITIVE_POSIX_ERRORS=1
 ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only
 ac_add_options --disable-audio-backends
 ac_add_options --disable-jit
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index a9feb0b1612a..d5b0acea67cf 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -339,6 +339,11 @@ if CONFIG["OS_ARCH"] == "Darwin":
         "-weak_framework MediaPlayer",
     ]

+if CONFIG["OS_ARCH"] == "Haiku":
+    OS_LIBS += [
+        "posix_error_mapper",
+    ]
+

 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
kenz-gelsoft commented 2 months ago

Hm, above build crashes immediately as B_USE_POSITIVE_POSIX_ERRORS not defined correctly. mk_add_options didn't work here.

~/src/gecko-dev> ./mach build
 0:00.40 W Clobber not needed.
 0:00.44 W Adding make options from /boot/home/src/gecko-dev/mozconfig-dbg
    B_USE_POSITIVE_POSIX_ERRORS=1
    MOZ_OBJDIR=/boot/home/src/gecko-dev/obj-ff-dbg
    OBJDIR=/boot/home/src/gecko-dev/obj-ff-dbg
    FOUND_MOZCONFIG=/boot/home/src/gecko-dev/mozconfig-dbg
    export FOUND_MOZCONFIG
 0:00.44 /bin/make -f client.mk -j12 -s
 0:00.79 Elapsed: 0.00s; From dist/private: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.80 Elapsed: 0.00s; From dist/public: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.89 Elapsed: 0.07s; From _tests: Kept 683 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:01.08 Elapsed: 0.24s; From dist/bin: Kept 2908 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:01.13 Elapsed: 0.30s; From dist/include: Kept 6561 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:01.69 browser/app
 0:01.74 clang++: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
 0:03.08 /boot/home/src/gecko-dev/browser/app/nsBrowserApp.cpp:282:53: error: use of undeclared identifier 'B_USE_POSITIVE_POSIX_ERRORS'
 0:03.09   282 |   printf("HELLO, B_USE_POSITIVE_POSIX_ERRORS=%d\n", B_USE_POSITIVE_POSIX_ERRORS);
 0:03.09       |                                                     ^
 0:03.27 1 error generated.
kenz-gelsoft commented 2 months ago

trying with CPPFLAGS. I should have to do with LDFLAGS for -lposix_error_mapper

kenz-gelsoft commented 1 month ago

This time wont build

~/src/gecko-dev> export CPPFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS"
~/src/gecko-dev> export LDFLAGS="-lposix_error_mapper"
~/src/gecko-dev> ./mach configure
~/src/gecko-dev> ./mach build
 0:46.69 error: failed to run custom build command for `proc-macro2 v1.0.74`
 0:46.69 Caused by:
 0:46.70   process didn't exit successfully: `/boot/home/src/gecko-dev/obj-ff-dbg/debug/build/proc-macro2-a602507d597561ba/build-script-build` (exit status: 101)
 0:46.70   --- stderr
 0:46.70   thread 'main' panicked at library/std/src/sys_common/process.rs:155:17:
 0:46.70   called `Result::unwrap()` on an `Err` value: Os { code: 2147483637, kind: Uncategorized, message: "Operation would block" }
 0:46.70   stack backtrace:
 0:46.70      0:      0x1d301f4b180 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcc36895e762d40e8
 0:46.70      1:      0x1d301f83eeb - core::fmt::write::hc8f30f2da618a011
 0:46.70      2:      0x1d301f39dc9 - std::io::Write::write_fmt::h68ece00fccf8f380
 0:46.70      3:      0x1d301f4af68 - std::sys_common::backtrace::print::h4d5a8eb53405b53a
 0:46.70      4:      0x1d301f60549 - std::panicking::default_hook::{{closure}}::h0ea0fb6c510e782c
 0:46.70      5:      0x1d301f60235 - std::panicking::default_hook::h8115fa82c7cb53bf
 0:46.71      6:      0x1d301f60ea4 - std::panicking::rust_panic_with_hook::hb210c5da6bd5b81e
 0:46.71      7:      0x1d301f4b734 - std::panicking::begin_panic_handler::{{closure}}::ha2f2badcad609d3a
 0:46.71      8:      0x1d301f4b399 - std::sys_common::backtrace::__rust_end_short_backtrace::hf81b499aaa9ef36e
 0:46.72      9:      0x1d301f60a67 - rust_begin_unwind
 0:46.73     10:      0x1d301f9c133 - core::panicking::panic_fmt::h3418d4c268d9f2d2
 0:46.73     11:      0x1d301f95ac6 - core::result::unwrap_failed::h51530e17572283af
 0:46.73     12:      0x1d301f28577 - std::sys_common::process::wait_with_output::h12b5b585d1de37d8
 0:46.73     13:      0x1d301f18fac - std::process::Command::output::hb7c6e03f2134703a
 0:46.73     14:      0x1d301f139fc - build_script_build::rustc_minor_version::hf70f12db7db4a84e
 0:46.73                                  at /boot/home/src/gecko-dev/third_party/rust/proc-macro2/build.rs:185:18
 0:46.73     15:      0x1d301f139fc - build_script_build::main::ha543c305088210f7
 0:46.73                                  at /boot/home/src/gecko-dev/third_party/rust/proc-macro2/build.rs:45:17
 0:46.73     16:      0x1d301f14933 - core::ops::function::FnOnce::call_once::h9cb89def41c472ca
 0:46.73                                  at /build/rust/library/core/src/ops/function.rs:250:5
 0:46.74     17:      0x1d301f14933 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2fefce2fd29ab034
 0:46.74                                  at /build/rust/library/std/src/sys_common/backtrace.rs:155:18
 0:46.75     18:      0x1d301f14949 - std::rt::lang_start::{{closure}}::hbd32483ec0f0edc6
 0:46.75                                  at /build/rust/library/std/src/rt.rs:159:18
 0:46.75     19:      0x1d301f5ed31 - std::rt::lang_start_internal::ha4329a9b72de3eae
 0:46.75     20:      0x1d301f1492c - main
 0:46.75     21:      0x1d301f132be - _start
 0:46.75     22:       0x3319790e85 - runtime_loader