Re: CPATH, LIBRARY_PATH, and cross-compilers
Ralf Corsepius skribis: > On 02/13/2013 03:49 PM, Ludovic Courtès wrote: [...] >> At any rate, there’s a need for similar env. vars for cross-compilers. WDYT? > I am having difficulties to imagine such a need. Well, for the same reason that CPATH & co. are sometimes needed, or at least convenient. Ludo’.
Re: CPATH, LIBRARY_PATH, and cross-compilers
On 02/14/2013 04:37 PM, Ralf Corsepius wrote: >> At any rate, there’s a need for similar env. vars for cross-compilers. WDYT? > I am having difficulties to imagine such a need. Indeed: I've experienced that environment variables are fine to test something out, but open a can of worms when used in production. It turned out to be much saner to have some wrappers around the compiler/linker which add the additional include- and library-paths - even for native toolchains. /haubi/
Re: CPATH, LIBRARY_PATH, and cross-compilers
On 02/13/2013 03:49 PM, Ludovic Courtès wrote: Richard Biener skribis: On Wed, Feb 13, 2013 at 12:13 PM, Richard Biener wrote: On Tue, Feb 12, 2013 at 9:41 PM, Ludovic Courtès wrote: Joel Sherrill skribis: But it still doesn't address the situation where you have multiple cross compilers in your PATH all for different targets. Yeah, I thought about it, but couldn’t come up with a practical use case where you’d need to use different cross-compilers in a single build. When you create fat binaries. That is, a more pragmatic approach would be to not honor these environments in a cross compiler at all. Agreed. Possibly, though that’d be an incompatible change. At any rate, there’s a need for similar env. vars for cross-compilers. WDYT? I am having difficulties to imagine such a need. Ralf
Re: CPATH, LIBRARY_PATH, and cross-compilers
Richard Biener skribis: > On Wed, Feb 13, 2013 at 12:13 PM, Richard Biener > wrote: >> On Tue, Feb 12, 2013 at 9:41 PM, Ludovic Courtès wrote: >>> Joel Sherrill skribis: >>> But it still doesn't address the situation where you have multiple cross compilers in your PATH all for different targets. >>> >>> Yeah, I thought about it, but couldn’t come up with a practical use case >>> where you’d need to use different cross-compilers in a single build. >> >> When you create fat binaries. > > That is, a more pragmatic approach would be to not honor these environments > in a cross compiler at all. Possibly, though that’d be an incompatible change. At any rate, there’s a need for similar env. vars for cross-compilers. WDYT? Ludo’.
Re: CPATH, LIBRARY_PATH, and cross-compilers
On Wed, Feb 13, 2013 at 12:13 PM, Richard Biener wrote: > On Tue, Feb 12, 2013 at 9:41 PM, Ludovic Courtès wrote: >> Joel Sherrill skribis: >> >>> But it still doesn't address the situation where you have multiple >>> cross compilers in your PATH all for different targets. >> >> Yeah, I thought about it, but couldn’t come up with a practical use case >> where you’d need to use different cross-compilers in a single build. > > When you create fat binaries. That is, a more pragmatic approach would be to not honor these environments in a cross compiler at all. Richard. > Richard. > >> Ludo’.
Re: CPATH, LIBRARY_PATH, and cross-compilers
On Tue, Feb 12, 2013 at 9:41 PM, Ludovic Courtès wrote: > Joel Sherrill skribis: > >> But it still doesn't address the situation where you have multiple >> cross compilers in your PATH all for different targets. > > Yeah, I thought about it, but couldn’t come up with a practical use case > where you’d need to use different cross-compilers in a single build. When you create fat binaries. Richard. > Ludo’.
Re: CPATH, LIBRARY_PATH, and cross-compilers
Joel Sherrill skribis: > But it still doesn't address the situation where you have multiple > cross compilers in your PATH all for different targets. Yeah, I thought about it, but couldn’t come up with a practical use case where you’d need to use different cross-compilers in a single build. Ludo’.
Re: CPATH, LIBRARY_PATH, and cross-compilers
On 2/12/2013 12:48 PM, Ludovic Courtès wrote: Hi, GCC honors CPATH, LIBRARY_PATH, & co. regardless of whether it’s built as a cross-compiler. Consequently, when cross-compiling a package that contains both support tools to be compiled natively and the main code to be cross-compiled, these variables are useless because they don’t allow host and build headers and libraries to be distinguished. To fix that, I’d build the cross-compiler with something like: This is a long standing issue with gcc. Whether your solution is OK with the other developers, I don't know. It is a step in the right direction. But it still doesn't address the situation where you have multiple cross compilers in your PATH all for different targets. It addresses the most common use case though. -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherr...@oarcorp.comOn-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available(256) 722-9985
CPATH, LIBRARY_PATH, and cross-compilers
Hi, GCC honors CPATH, LIBRARY_PATH, & co. regardless of whether it’s built as a cross-compiler. Consequently, when cross-compiling a package that contains both support tools to be compiled natively and the main code to be cross-compiled, these variables are useless because they don’t allow host and build headers and libraries to be distinguished. To fix that, I’d build the cross-compiler with something like: --- gcc-4.7.2/gcc/incpath.c 2012-01-27 00:34:58.0 +0100 +++ gcc-4.7.2/gcc/incpath.c 2013-02-12 10:11:27.0 +0100 @@ -452,7 +452,7 @@ register_include_chains (cpp_reader *pfi /* CPATH and language-dependent environment variables may add to the include chain. */ - add_env_var_paths ("CPATH", BRACKET); + add_env_var_paths ("CROSS_CPATH", BRACKET); add_env_var_paths (lang_env_vars[idx], SYSTEM); target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc); --- gcc-4.7.2/gcc/system.h 2012-02-17 00:16:28.0 +0100 +++ gcc-4.7.2/gcc/system.h 2013-02-12 10:22:17.0 +0100 @@ -1023,4 +1023,6 @@ helper_const_non_const_cast (const char #define DEBUG_VARIABLE #endif +#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH" + #endif /* ! GCC_SYSTEM_H */ What about changing GCC to honor CROSS_CPATH (& co.) and CROSS_LIBRARY_PATH when built as a cross-compiler? The behavior would be to honor the CROSS_ variable when it’s defined, and to discard its non-CROSS_ variant. Native compilers would still behave the same. I can prepare a patch if there’s interest. Thanks, Ludo’.