[libcxx] r226237 - [libc++] Add support for cross compiling.

Dan Albert danalbert at google.com
Tue Jan 20 10:44:14 PST 2015


The -target flag only gets appended if you've passed in
`-DLIBCXX_TARGET_TRIPLE=foo`. If you don't it won't be used.

If you're seeing issues, the problem is likely that LIBCXX_TARGET_TRIPLE is
still set from a previous cmake run. That used to be set automatically (and
incorrectly), and old values will still be cached. AFAIK there isn't a good
rule by which to clear an old cached value (some people will want it to
stay as the old manually configured value, whereas others want to clear the
default value), so it requires manual intervention.

On Tue, Jan 20, 2015 at 8:07 AM, Eric Fiselier <eric at efcs.ca> wrote:

> Hey Dan,
>
> the -target flag isn't supported with GCC so we can't test against
> GCC. Also we do some weird transformations to the target_triple value.
> Could we be more selective as to when we use the -target flag?
>
> /Eric
>
> On Thu, Jan 15, 2015 at 10:21 PM, Pete Cooper <peter_cooper at apple.com>
> wrote:
> > Great! Thanks for the quick response and fix.
> >
> > I'll keep an eye on the bot.
> >
> > Thanks
> > Pete
> >
> > Sent from my iPhone
> >
> > On Jan 15, 2015, at 6:29 PM, Dan Albert <danalbert at google.com> wrote:
> >
> > I removed the dead code with r226243, which should solve the issue. I
> don't
> > actually have a Darwin machine to test on, but this still behaves as
> > expected for Linux.
> >
> > On Thu, Jan 15, 2015 at 6:19 PM, Dan Albert <danalbert at google.com>
> wrote:
> >>
> >> Was just asking about this on IRC. I think I can actually just remove
> the
> >> offending cmake code though, it doesn't appear to actually do anything.
> >>
> >> On Thu, Jan 15, 2015 at 6:13 PM, Pete Cooper <peter_cooper at apple.com>
> >> wrote:
> >>>
> >>> Hi Dan
> >>>
> >>> I think this commit broke the buildbot.  I can’t see any others in the
> >>> blame list that look likely.
> >>>
> >>> Can you please take a look?
> >>>
> >>>
> >>>
> http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_build/807/console
> >>>
> >>> Thanks,
> >>> Pete
> >>> > On Jan 15, 2015, at 4:55 PM, Dan Albert <danalbert at google.com>
> wrote:
> >>> >
> >>> > Author: danalbert
> >>> > Date: Thu Jan 15 18:55:15 2015
> >>> > New Revision: 226237
> >>> >
> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=226237&view=rev
> >>> > Log:
> >>> > [libc++] Add support for cross compiling.
> >>> >
> >>> > Reviewers: EricWF, jroelofs
> >>> >
> >>> > Reviewed By: jroelofs
> >>> >
> >>> > Subscribers: cfe-commits
> >>> >
> >>> > Differential Revision: http://reviews.llvm.org/D6990
> >>> >
> >>> > Modified:
> >>> >    libcxx/trunk/CMakeLists.txt
> >>> >    libcxx/trunk/test/libcxx/test/config.py
> >>> >    libcxx/trunk/test/lit.site.cfg.in
> >>> >
> >>> > Modified: libcxx/trunk/CMakeLists.txt
> >>> > URL:
> >>> >
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=226237&r1=226236&r2=226237&view=diff
> >>> >
> >>> >
> ==============================================================================
> >>> > --- libcxx/trunk/CMakeLists.txt (original)
> >>> > +++ libcxx/trunk/CMakeLists.txt Thu Jan 15 18:55:15 2015
> >>> > @@ -57,6 +57,8 @@ option(LIBCXX_ENABLE_MONOTONIC_CLOCK
> >>> >    This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
> >>> > option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
> >>> > option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support
> headers."
> >>> > ON)
> >>> > +set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
> >>> > +set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC
> >>> > toolchain.")
> >>> > if (LIBCXX_BUILT_STANDALONE)
> >>> >   set(LLVM_USE_SANITIZER "" CACHE STRING
> >>> >       "Define the sanitizer used to build the library and tests")
> >>> > @@ -277,6 +279,11 @@ if (LIBCXX_BUILT_STANDALONE)
> >>> >   endif()
> >>> > endif()
> >>> >
> >>> > +list(APPEND LIBCXX_CXX_FLAGS "-target ${LIBCXX_TARGET_TRIPLE}")
> >>> > +append_if(LIBCXX_CXX_FLAGS LIBCXX_SYSROOT "--sysroot
> >>> > ${LIBCXX_SYSROOT}")
> >>> > +append_if(LIBCXX_CXX_FLAGS LIBCXX_GCC_TOOLCHAIN
> >>> > +          "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
> >>> > +
> >>> > string(REPLACE ";" " " LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS}")
> >>> > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FLAGS}")
> >>> >
> >>> >
> >>> > Modified: libcxx/trunk/test/libcxx/test/config.py
> >>> > URL:
> >>> >
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=226237&r1=226236&r2=226237&view=diff
> >>> >
> >>> >
> ==============================================================================
> >>> > --- libcxx/trunk/test/libcxx/test/config.py (original)
> >>> > +++ libcxx/trunk/test/libcxx/test/config.py Thu Jan 15 18:55:15 2015
> >>> > @@ -230,9 +230,9 @@ class Configuration(object):
> >>> >         locale.setlocale(locale.LC_ALL, default_locale)
> >>> >
> >>> >         # Write an "available feature" that combines the triple when
> >>> > -        # use_system_cxx_lib is enabled. This is so that we can
> easily
> >>> > write XFAIL
> >>> > -        # markers for tests that are known to fail with versions of
> >>> > libc++ as
> >>> > -        # were shipped with a particular triple.
> >>> > +        # use_system_cxx_lib is enabled. This is so that we can
> easily
> >>> > write
> >>> > +        # XFAIL markers for tests that are known to fail with
> versions
> >>> > of
> >>> > +        # libc++ as were shipped with a particular triple.
> >>> >         if self.use_system_cxx_lib:
> >>> >             self.config.available_features.add(
> >>> >                 'with_system_cxx_lib=%s' % self.config.target_triple)
> >>> > @@ -288,7 +288,7 @@ class Configuration(object):
> >>> >         if not enable_threads:
> >>> >             self.configure_compile_flags_no_threads()
> >>> >             if not enable_monotonic_clock:
> >>> > -                self.configure_compile_flags_no_monotonic_clock()
> >>> > +                self.configure_compile_flags_no_monotonic_clock()
> >>> >         elif not enable_monotonic_clock:
> >>> >             self.lit_config.fatal('enable_monotonic_clock cannot be
> >>> > false when'
> >>> >                                   ' enable_threads is true.')
> >>> > @@ -298,6 +298,15 @@ class Configuration(object):
> >>> >         compile_flags_str = self.get_lit_conf('compile_flags', '')
> >>> >         self.compile_flags += shlex.split(compile_flags_str)
> >>> >
> >>> > +        sysroot = self.get_lit_conf('sysroot')
> >>> > +        if sysroot:
> >>> > +            self.compile_flags += ['--sysroot', sysroot]
> >>> > +        gcc_toolchain = self.get_lit_conf('gcc_toolchain')
> >>> > +        if gcc_toolchain:
> >>> > +            self.compile_flags += ['-gcc-toolchain', gcc_toolchain]
> >>> > +
> >>> > +        self.compile_flags += ['-target', self.config.target_triple]
> >>> > +
> >>> >     def configure_compile_flags_header_includes(self):
> >>> >         self.compile_flags += ['-I' + self.libcxx_src_root +
> >>> > '/test/support']
> >>> >         libcxx_headers = self.get_lit_conf('libcxx_headers',
> >>> >
> >>> > Modified: libcxx/trunk/test/lit.site.cfg.in
> >>> > URL:
> >>> >
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.site.cfg.in?rev=226237&r1=226236&r2=226237&view=diff
> >>> >
> >>> >
> ==============================================================================
> >>> > --- libcxx/trunk/test/lit.site.cfg.in (original)
> >>> > +++ libcxx/trunk/test/lit.site.cfg.in Thu Jan 15 18:55:15 2015
> >>> > @@ -14,6 +14,9 @@ config.cxx_abi                  = "@LIBC
> >>> > config.use_sanitizer            = "@LLVM_USE_SANITIZER@"
> >>> > config.abi_library_path         = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
> >>> > config.configuration_variant    = "@LIBCXX_LIT_VARIANT@"
> >>> > +config.target_triple            = "@LIBCXX_TARGET_TRIPLE@"
> >>> > +config.sysroot                  = "@LIBCXX_SYSROOT@"
> >>> > +config.gcc_toolchain            = "@LIBCXX_GCC_TOOLCHAIN@"
> >>> >
> >>> > # Let the main config do the real work.
> >>> > lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > cfe-commits mailing list
> >>> > cfe-commits at cs.uiuc.edu
> >>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >>>
> >>
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150120/0111d211/attachment.html>


More information about the cfe-commits mailing list