Issues cross compiling v8 for iOS

45 views
Skip to first unread message

Darin Dimitrov

unread,
May 27, 2019, 7:40:09 AM5/27/19
to v8-users
I am trying to cross compile V8 for iOS (https://chromium.googlesource.com/v8/v8.git/+/be47fd1c37ead74cf5c4479043426e0376d3ff29) as described here: https://v8.dev/docs/cross-compile-ios

Using Mac OS 10.14.5 and XCode 10.2.1 I am getting the following error when building embedded.S:

[1321/1328] ASM obj/v8_snapshot/embedded.o
FAILED
: obj/v8_snapshot/embedded.o
../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF obj/v8_snapshot/embedded.o.d -DNO_TCMALLOC -DCHROMIUM_BUILD -DCR_XCODE_VERSION=1021 -DCR_CLANG_REVISION=\"361212-67510fac-2\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DNS_BLOCK_ASSERTIONS=1 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DENABLE_MINOR_MC -DENABLE_HANDLE_ZAPPING -DV8_USE_SNAPSHOT -DV8_CONCURRENT_MARKING -DV8_EMBEDDED_BUILTINS -DV8_WIN64_UNWINDING_INFO -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_TARGET_ARCH_X64 -DDISABLE_UNTRUSTED_CODE_MITIGATIONS -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -I../.. -Igen -I../.. -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -std=c11 -arch x86_64 -g2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk -stdlib=libc++ -mios-simulator-version-min=10 -c gen/embedded.S -o obj/v8_snapshot/embedded.o
gen/embedded.S:68:15: error: unexpected token in '.section' directive
.section .text
              ^
gen/embedded.S:379:1: error: unknown directive
.type Builtins_RecordWrite, @function
^
gen/embedded.S:431:1: error: unknown directive
.type Builtins_EphemeronKeyBarrier, @function
^
gen/embedded.S:448:1: error: unknown directive
.type Builtins_AdaptorWithBuiltinExitFrame, @function
^
gen/embedded.S:453:1: error: unknown directive
.type Builtins_ArgumentsAdaptorTrampoline, @function
^
gen/embedded.S:466:1: error: unknown directive
.type Builtins_CallFunction_ReceiverIsNullOrUndefined, @function
^
............ and hundreds of other similar errors ...........


Jakob Gruber

unread,
May 27, 2019, 7:49:42 AM5/27/19
to v8-u...@googlegroups.com
Hi Darin,

I've been reworking cross-compile support in mksnapshot and may have missed the iOS case in OS detection. Let me take a look and get back to you.

Jakob

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/aa630655-4f80-4de3-9392-2d44af42c47f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Darin Dimitrov

unread,
May 27, 2019, 9:34:53 AM5/27/19
to v8-users
Hi Jakob,

Thanks for the quick reply. The following patch seems to resolve the issue with the iOS build:

diff --git a/src/snapshot/embedded/platform-embedded-file-writer-base.cc b/src/snapshot/embedded/platform-embedded-file-writer-base.cc

index 2adb041371..20af9e28e2 100644

--- a/src/snapshot/embedded/platform-embedded-file-writer-base.cc

+++ b/src/snapshot/embedded/platform-embedded-file-writer-base.cc

@@ -62,7 +62,7 @@ EmbeddedTargetArch ToEmbeddedTargetArch(const char* s) {

 EmbeddedTargetOs DefaultEmbeddedTargetOs() {

 #if defined(V8_OS_AIX)

   return EmbeddedTargetOs::kAIX;

-#elif defined(V8_OS_MACOSX)

+#elif defined(V8_OS_MACOSX) || defined(V8_OS_IOS)

   return EmbeddedTargetOs::kMac;

 #elif defined(V8_OS_WIN)

   return EmbeddedTargetOs::kWin;

@@ -83,7 +83,7 @@ EmbeddedTargetOs ToEmbeddedTargetOs(const char* s) {

     return EmbeddedTargetOs::kChromeOS;

   } else if (string == "fuchsia") {

     return EmbeddedTargetOs::kFuchsia;

-  } else if (string == "mac") {

+  } else if (string == "mac" || string == "ios") {

     return EmbeddedTargetOs::kMac;

   } else if (string == "win") {

     return EmbeddedTargetOs::kWin;



On Monday, May 27, 2019 at 2:49:42 PM UTC+3, Jakob Gruber wrote:
Hi Darin,

I've been reworking cross-compile support in mksnapshot and may have missed the iOS case in OS detection. Let me take a look and get back to you.

Jakob

To unsubscribe from this group and stop receiving emails from it, send an email to v8-u...@googlegroups.com.

Jakob Gruber

unread,
May 27, 2019, 9:38:35 AM5/27/19
to v8-u...@googlegroups.com
A fix is in-flight here: https://crrev.com/c/1631417 

To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/a2e04806-5459-4565-9444-047fda6efa52%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages