public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Adding additional system paths to a custom GCC
@ 2012-11-16  4:14 Tim Schumacher
  2012-11-16  5:36 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Schumacher @ 2012-11-16  4:14 UTC (permalink / raw)
  To: gcc-help

Hi All,

I am using Fedora linux.  I would like to build a gcc-4.7.2 with 
additional "system paths".  Meaning, I have an installation of the Boost 
C++ libraries installed at /usr/local/boost-1.52.0 and I would like to 
build a gcc that treats the boost include and lib dirs as system paths 
so that I don't have to specify -I and -L on all command lines compiling 
programs that use boost.  I'm guessing there is some easy way to do this 
at configure time for GCC?  I guess one way would be to re-build the 
boost libraries with the new compiler and specify the same --prefix that 
I used for the GCC tools.  Any thoughts on this would be greatly 
appreciated!

Thanks in advance!
Tim

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding additional system paths to a custom GCC
  2012-11-16  4:14 Adding additional system paths to a custom GCC Tim Schumacher
@ 2012-11-16  5:36 ` Ian Lance Taylor
  2012-11-16 20:07   ` Tim Schumacher
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2012-11-16  5:36 UTC (permalink / raw)
  To: Tim Schumacher; +Cc: gcc-help

On Thu, Nov 15, 2012 at 8:14 PM, Tim Schumacher <schumact@gmail.com> wrote:
>
> I am using Fedora linux.  I would like to build a gcc-4.7.2 with additional
> "system paths".  Meaning, I have an installation of the Boost C++ libraries
> installed at /usr/local/boost-1.52.0 and I would like to build a gcc that
> treats the boost include and lib dirs as system paths so that I don't have
> to specify -I and -L on all command lines compiling programs that use boost.
> I'm guessing there is some easy way to do this at configure time for GCC?  I
> guess one way would be to re-build the boost libraries with the new compiler
> and specify the same --prefix that I used for the GCC tools.  Any thoughts
> on this would be greatly appreciated!

You could use a shell script to pass the options you want.  You could
set the environment variables CPLUS_INCLUDE_PATH and LIBRARY_PATH when
running the compiler.  I don't think there is any simple way to add
directories when building GCC itself, though.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding additional system paths to a custom GCC
  2012-11-16  5:36 ` Ian Lance Taylor
@ 2012-11-16 20:07   ` Tim Schumacher
  2012-11-16 21:33     ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Schumacher @ 2012-11-16 20:07 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On 11/15/2012 10:36 PM, Ian Lance Taylor wrote:
> On Thu, Nov 15, 2012 at 8:14 PM, Tim Schumacher <schumact@gmail.com> wrote:
>> I am using Fedora linux.  I would like to build a gcc-4.7.2 with additional
>> "system paths".  Meaning, I have an installation of the Boost C++ libraries
>> installed at /usr/local/boost-1.52.0 and I would like to build a gcc that
>> treats the boost include and lib dirs as system paths so that I don't have
>> to specify -I and -L on all command lines compiling programs that use boost.
>> I'm guessing there is some easy way to do this at configure time for GCC?  I
>> guess one way would be to re-build the boost libraries with the new compiler
>> and specify the same --prefix that I used for the GCC tools.  Any thoughts
>> on this would be greatly appreciated!
> You could use a shell script to pass the options you want.  You could
> set the environment variables CPLUS_INCLUDE_PATH and LIBRARY_PATH when
> running the compiler.  I don't think there is any simple way to add
> directories when building GCC itself, though.
>
> Ian
>   

OK,  I can write a wrapper script that does what I want.

I also had this pretty crazy idea.  Would the following work?

I build boost with the new gcc I just built, and the same --prefix I 
used for the gcc.  Now all the includes and libraries (only static in my 
case) are placed where gcc can find them.  Next ... drum roll ... I 
unpack all the static boost libraries and also the lidstdc++.a file and 
re-archive all the resulting .o files back into libstdc++.a.  Now all 
the boost objects are magically available whenever I compile any c++ 
program.

Is that crazy enough to work?

Thanks again!
Tim


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding additional system paths to a custom GCC
  2012-11-16 20:07   ` Tim Schumacher
@ 2012-11-16 21:33     ` Ian Lance Taylor
  2012-11-16 22:08       ` Tim Schumacher
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2012-11-16 21:33 UTC (permalink / raw)
  To: Tim Schumacher; +Cc: gcc-help

On Fri, Nov 16, 2012 at 12:06 PM, Tim Schumacher <schumact@gmail.com> wrote:
>
> I build boost with the new gcc I just built, and the same --prefix I used
> for the gcc.  Now all the includes and libraries (only static in my case)
> are placed where gcc can find them.  Next ... drum roll ... I unpack all the
> static boost libraries and also the lidstdc++.a file and re-archive all the
> resulting .o files back into libstdc++.a.  Now all the boost objects are
> magically available whenever I compile any c++ program.
>
> Is that crazy enough to work?

By default GCC will link against the dynamic libstdc++, libstdc++.so.
If you override that one way or another, then, yes, your scheme should
work, until you update to the next version at which point you will
have to do it again.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding additional system paths to a custom GCC
  2012-11-16 21:33     ` Ian Lance Taylor
@ 2012-11-16 22:08       ` Tim Schumacher
  0 siblings, 0 replies; 5+ messages in thread
From: Tim Schumacher @ 2012-11-16 22:08 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On 11/16/2012 2:33 PM, Ian Lance Taylor wrote:
> On Fri, Nov 16, 2012 at 12:06 PM, Tim Schumacher <schumact@gmail.com> wrote:
>> I build boost with the new gcc I just built, and the same --prefix I used
>> for the gcc.  Now all the includes and libraries (only static in my case)
>> are placed where gcc can find them.  Next ... drum roll ... I unpack all the
>> static boost libraries and also the lidstdc++.a file and re-archive all the
>> resulting .o files back into libstdc++.a.  Now all the boost objects are
>> magically available whenever I compile any c++ program.
>>
>> Is that crazy enough to work?
> By default GCC will link against the dynamic libstdc++, libstdc++.so.
> If you override that one way or another, then, yes, your scheme should
> work, until you update to the next version at which point you will
> have to do it again.
>
> Ian

Yep it works!  I just tried it and with the one small caveat that there 
were object filename collisions (which I fix by simply renaming all the 
boost objects) it seems to work perfectly.  I built the gcc with 
--disable-shared option so there are no shared libraries to worry 
about.  Now I have a nice big 31MB libstdc++.a and I can compile and run 
programs using boost without any flags on the command line.

I tried to look at the specs file to figure out how to accomplish the 
same thing via specs but that appeared more involved than I wanted to get.

Thanks for your help!
Tim


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-16 22:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16  4:14 Adding additional system paths to a custom GCC Tim Schumacher
2012-11-16  5:36 ` Ian Lance Taylor
2012-11-16 20:07   ` Tim Schumacher
2012-11-16 21:33     ` Ian Lance Taylor
2012-11-16 22:08       ` Tim Schumacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).