Skip to content

Commit aaa7e4d

Browse files
committed
fix: error 'unistd.h' file not found on Windows
On https://searchfox.org/mozilla-central/rev/ead020d/mozglue/baseprofiler/public/BaseProfilerUtils.h#22, it detects Windows platform by seeing if the `XP_WIN` macro is defined, if not then assumes it's on POSIX and includes the `<unistd.h>` header to use `getpid()`. The `mozilla/BaseProfilerUtils.h` header file is introduced to `js/Debug.h` in https://phabricator.services.mozilla.com/D221102 (https://bugzilla.mozilla.org/show_bug.cgi?id=1911021), but it would be compiled without `XP_WIN` in our building configuration
1 parent a3ea199 commit aaa7e4d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

setup.sh

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ sed -i'' -e 's/return !IsIteratorHelpersEnabled()/return false/' ./js/src/vm/Glo
6464
sed -i'' -e '/MOZ_CRASH_UNSAFE_PRINTF/,/__PRETTY_FUNCTION__);/d' ./mfbt/LinkedList.h # would crash in Debug Build: in `~LinkedList()` it should have removed all this list's elements before the list's destruction
6565
sed -i'' -e '/MOZ_ASSERT(stackRootPtr == nullptr);/d' ./js/src/vm/JSContext.cpp # would assert false in Debug Build since we extensively use `new JS::Rooted`
6666
sed -i'' -e 's/"-fuse-ld=ld"/"-ld64" if c_compiler.version > "14.0.0" else "-fuse-ld=ld"/' ./build/moz.configure/toolchain.configure # XCode 15 changed the linker behaviour. See https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking
67+
sed -i'' -e 's/defined(XP_WIN)/defined(_WIN32)/' ./mozglue/baseprofiler/public/BaseProfilerUtils.h # this header file is introduced to js/Debug.h in https://phabricator.services.mozilla.com/D221102, but it would be compiled without XP_WIN in this building configuration
6768

6869
cd js/src
6970
mkdir -p _build
@@ -81,6 +82,7 @@ mkdir -p ../../../../_spidermonkey_install/
8182
--disable-explicit-resource-management
8283
# disable-explicit-resource-management: Disable the `using` syntax that is enabled by default in SpiderMonkey nightly, otherwise the header files will disagree with the compiled lib .so file
8384
# when it's using a `IF_EXPLICIT_RESOURCE_MANAGEMENT` macro, e.g., the `enum JSProtoKey` index would be off by 1 (header `JSProto_Uint8Array` 27 will be interpreted as `JSProto_Int8Array` in lib as lib has an extra element)
85+
# https://bugzilla.mozilla.org/show_bug.cgi?id=1940342
8486
make -j$CPUS
8587
echo "Done building spidermonkey"
8688

0 commit comments

Comments
 (0)