David Edelsohn via Gcc <gcc@gcc.gnu.org> writes:

> n Fri, Aug 25, 2023 at 4:16 PM Michael Welsh Duggan via Gcc <
> gcc@gcc.gnu.org> wrote:
>
>> I am attempting to debug an issue in gcc (PR 110827, if curious).  In
>> order to do this I have built a stage 1 compiler with debugging and
>> without optimization as discussed here:
>>
>> https://gcc.gnu.org/wiki/DebuggingGCC#Building_a_Debuggable_Compiler
>>
>> I would like run the compiler from its build location without installing
>> it, but I cannot determine how to have gcc look for its include files
>> and libraries from within its source and build trees.  My first problem
>> was that it looked for for cc1plus in the wrong location; my next
>> problems involved include paths.
>>
>> Is it possible to do this without extensive command-line options, or
>> does this need to be installed?  If the latter, what target do I use to
>> install the unoptimized stage 1 compiler?
>>
>
> One can use
>
> $ ./xgcc -B./
>
> to run GCC in the build directory, or wherever the driver and compiler are
> installed.
>
> To debug the compiler, it is easier to produce a preprocessed file with the
> header files included (-E command line option) and direct the compiler,
> e.g, cc1 or cc1plus, to use the preprocessed file as input.

Thanks; this worked, mostly.  I did have to include a `-L` option for:

  /usr/bin/ld: cannot find -lstdc++: No such file or directory

but that's only a single library, so that was easy to do.  The hint
about preprocessing rather than trying to get the include directories
correct was a good idea.  gcov doesn't work quite right with
preprocessed files, but I was able to hack around it.

-- 
Michael Welsh Duggan
(m...@md5i.com)

Reply via email to