Getting start compiling for arm/arbitrary gcc on osx

16 views
Skip to first unread message

gra...@grahamreeves.com

unread,
Sep 19, 2018, 7:00:34 AM9/19/18
to v8-dev
I'm trying to build v8 for an arm cpu, and I have gcc/++/etc for that architecture built on osx (so I can cross compile), which currently builds my executable, all working fine.

Now I'm hoping to build v8. Whatever OS side changes I might need to make, (this is not for linux) I can do.

What I haven't managed to do yet, is get v8 compiling.
Is this possible with depot_tools/ninja ?

I've not been able to find any guides so far that aren't android focussed, eg.

From what I can tell, the gclient setup has some specific setup for when the target_os is "android".
Maybe it's using some explicit NDK based paths to find GCC executables? (This is a little hidden)
I looked at the gn --args all and couldn't really see anything about explicitly setting toolchain paths

Is convention to build as if it's android, and maybe swap out all of NDK's gcc with my own?
or set the target_os to unix, and then... where would I put the toolchain?

I've set is_clang = false

Unless I'm overthinking it? This is my error when I try to build arm.release. I have been assuming there are no rules setup to build .cc with a particular gcc executable

ninja: error: '../../src/base/bits.cc', needed by 'clang_x86_v8_arm/obj/v8_libbase/bits.o', missing and no known rule to make it


toolchain.ninja (which I assume is like a makefile, I'm very new to ninja/gclient) has entries for cc

rule cc

  command =  ../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF ${out}.d ${defines} ${include_dirs} ${cflags} ${cflags_c} -c ${in} -o ${out}

  description = CC ${out}

  depfile = ${out}.d

  deps = gcc

But I guess they're inheritly wrong?

I feel like I've just missed an obvious step with setting up the target, but the android setup is obfuscated so I'm blindly hunting around trying to see if export CC= is set somewhere :)


Jakob Kummerow

unread,
Sep 19, 2018, 12:19:42 PM9/19/18
to v8-...@googlegroups.com
I'm afraid we don't officially support cross-compiling on OSX, which means it might work, but you're on your own. We'd be happy to accept patches or documentation improvements, with community-maintained status.

That said:

I'd set is_clang=false and use_sysroot=false in args.gn, and set CC/CXX/LINK via the environment. How far does that get you?

target_os=["android"] in .gclient should not be necessary. I believe that only controls the downloading of the Android NDK, which you're not interested in using.

GN ("generate ninja") and Ninja work together to provide Make-like functionality. Ninja is designed to be simple but fast, GN does all the evaluation of flags and conditions. By inspecting the generated *.ninja files, you can check what GN did with the args you provided.
gclient is a dependency management tool (similar to git submodules); it is not involved in the build process itself.

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Graham Reeves

unread,
Sep 19, 2018, 12:30:04 PM9/19/18
to v8-...@googlegroups.com
Aha! Exactly the bits of information I need. :)

I'll give it a go shortly. If it doesn't go smoothly, I'll switch to docker and try the same for cross compiling on Linux.

Does use_sysroot=false mean it's explicitly looking for CC/CXX instead of whatever is on the PATH, or is it for something different?

I assumed the thing about gclient, but just wanted to be sure, given docs are explicit about "don't just clone" :)

You received this message because you are subscribed to a topic in the Google Groups "v8-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-dev/chLVN40jXnI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-dev+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Jakob Kummerow

unread,
Sep 19, 2018, 2:08:20 PM9/19/18
to v8-...@googlegroups.com
By default, the build (at least on Linux) uses its own bundled sysroot for system libraries (glibc etc). The idea is to have a "hermetic build" that works the same on all host machines, regardless of what's installed there. use_sysroot=false turns that off and is, I think, required to make is_clang=false work correctly. (I think our documentation mentions both flags.)
Reply all
Reply to author
Forward
Message has been deleted
0 new messages