On 1 October 2017 at 20:21, Brian Drummond wrote: > When compiling gcc, I've sometimes seen errors arise from commands > where the compiler is xgcc, even when not bootstrapping. > > Presumably this is the newly generated compiler being used as a second > stage to build essential run-time libraries, and not (as I used to > think) the --disable-bootstrap configure option being ignored. Right. libgcc, libstdc++ etc. are built using xgcc. > So far so good ... but my question is, where does the configuration > (specifically Makefile) for that second stage build come from? It's not a second stage, it's part of the same stage that builds the compiler. The configure scripts and makefiles for those libraries are in the relevant directories, like libgcc and libstdc++-v3. > To be more specific : using the Debian Stretch gcc-6 source package > (gcc-6.3.0-18), I'm seeing problems with the second stage build of > libiberty which manifest later as the appended error; > xgcc: error: ../libiberty/pic/concat.o: No such file or directory > > Indeed there is no such file in > gcc-objs/x86_64-pc-linux-gnu/libiberty/pic/ > (in fact there isn't a pic/ folder either) though it's present in the > first stage build, in > gcc-objs/libiberty/pic/ > > Why is the second stage build of libiberty so different? Well, let's > look at the Makefiles in each folder. > ----------------------------------------------------------------------- > diff '/home/brian/Projects/ghdl/2017/gcc-objs/libiberty/Makefile' > '/home/brian/Projects/ghdl/2017/gcc-objs/x86_64-pc-linux- > gnu/libiberty/Makefile' > > 57c57 > < CC = gcc > --- >> CC = /home/brian/Projects/ghdl/2017/gcc-objs/./gcc/xgcc > -B/home/brian/Projects/ghdl/2017/gcc-objs/./gcc/ > -B/opt/ghdl/gcc/x86_64-pc-linux-gnu/bin/ -B/opt/ghdl/gcc/x86_64-pc- > linux-gnu/lib/ -isystem /opt/ghdl/gcc/x86_64-pc-linux-gnu/include > -isystem /opt/ghdl/gcc/x86_64-pc-linux-gnu/sys-include -isystem > /home/brian/Projects/ghdl/2017/gcc-objs/sys-include > 64c64 > < PICFLAG = -fpic > --- >> PICFLAG = > 113c113 > < enable_shared = yes > --- >> enable_shared = no > ----------------------------------------------------------------------- > > ... well the -fpic flag went missing somehow. > > I'm not actually clear if this is intended behaviour but it seems odd. > > At this point I'm stuck, having no clear idea what derives the latter > Makefile, or why it drops -fpic, or how to control the behaviour (other > than modifying the Makefile by hand each time I run Configure. There > HAS to be a better way!). Or why it used to work with gcc-4.9 but not > gcc-6.3. > > But I'd like to know how these options get passed around and the > intended way to change them. > > -- Brian > > point of failure below... > ---------------------------------------------------------------------- > : # Make libgnatprj.so > /home/brian/Projects/ghdl/2017/gcc-objs/./gcc/xgcc > -B/home/brian/Projects/ghdl/2017/gcc-objs/./gcc/ > -B/opt/ghdl/gcc/x86_64-pc-linux-gnu/bin/ -B/opt/ghdl/gcc/x86_64-pc- > linux-gnu/lib/ -isystem /opt/ghdl/gcc/x86_64-pc-linux-gnu/include > -isystem /opt/ghdl/gcc/x86_64-pc-linux-gnu/sys-include -isystem > /home/brian/Projects/ghdl/2017/gcc-objs/sys-include -o > libgnatprj.so.6 -shared -fPIC -Wl,--soname,libgnatprj.so.6 -Wl,--no- > allow-shlib-undefined \ > obj-shared/ali.o obj-shared/ali-util.o obj-shared/butil.o obj- > shared/binderr.o obj-shared/errout.o obj-shared/erroutc.o obj- > shared/errutil.o obj-shared/err_vars.o obj-shared/fname-uf.o obj- > shared/fmap.o obj-shared/impunit.o obj-shared/lib-util.o obj- > shared/makeutl.o obj-shared/mlib.o obj-shared/mlib-fil.o obj- > shared/mlib-tgt.o obj-shared/mlib-tgt-specific.o obj-shared/mlib-utl.o > obj-shared/osint.o obj-shared/osint-c.o obj-shared/prj.o obj- > shared/prj-attr.o obj-shared/prj-attr-pm.o obj-shared/prj-com.o obj- > shared/prj-conf.o obj-shared/prj-dect.o obj-shared/prj-env.o obj- > shared/prj-err.o obj-shared/prj-ext.o obj-shared/prj-makr.o obj- > shared/prj-nmsc.o obj-shared/prj-pars.o obj-shared/prj-part.o obj- > shared/prj-pp.o obj-shared/prj-proc.o obj-shared/prj-strt.o obj- > shared/prj-tree.o obj-shared/prj-util.o obj-shared/restrict.o obj- > shared/rident.o obj-shared/scng.o obj-shared/sfn_scan.o obj- > shared/sinfo-cn.o obj-shared/sinput-c.o obj-shared/sinput-p.o obj- > shared/style.o obj-shared/styleg.o obj-shared/stylesw.o obj- > shared/switch.o obj-shared/switch-m.o obj-shared/targparm.o obj- > shared/tempdir.o obj-shared/sdefault.o obj-shared/link.o obj- > shared/prefix.o ../libiberty/pic/concat.o > ../libiberty/pic/filename_cmp.o ../libiberty/pic/lrealpath.o > ../libiberty/pic/safe-ctype.o ../libiberty/pic/xexit.o > ../libiberty/pic/xmalloc.o ../libiberty/pic/xstrdup.o \ > -L../../gcc/ada/rts -lgnat-6 \ > -L../libgnatvsn -lgnatvsn > xgcc: error: ../libiberty/pic/concat.o: No such file or directory > xgcc: error: ../libiberty/pic/filename_cmp.o: No such file or directory > xgcc: error: ../libiberty/pic/lrealpath.o: No such file or directory > xgcc: error: ../libiberty/pic/safe-ctype.o: No such file or directory > xgcc: error: ../libiberty/pic/xexit.o: No such file or directory > xgcc: error: ../libiberty/pic/xmalloc.o: No such file or directory > xgcc: error: ../libiberty/pic/xstrdup.o: No such file or directory > Makefile:76: recipe for target 'libgnatprj.so.6' failed > make[2]: *** [libgnatprj.so.6] Error 1 > make[2]: Leaving directory '/home/brian/Projects/ghdl/2017/gcc- > objs/x86_64-pc-linux-gnu/libgnatprj' > Makefile:16418: recipe for target 'all-target-libgnatprj' failed