AdaCore / gprbuild

GPRbuild is an advanced build system designed to help automate the construction of multi-language systems.
Other
65 stars 21 forks source link

Build failure on clean system #113

Closed bib1963 closed 2 years ago

bib1963 commented 2 years ago

I think this, with regards to a previous issue goes back to 38ebfdf.

I have a newly installed opensuse 15.4 system. It has gcc 11.3.0. gcc is able to build c code just fine, no problems regardless whether static or linked to shared libs.

Building gprbuild now fails on many levels...

Running bootstrap builds fine, and building xmlada is also fine.

When you begin building gprbuild proper, all hell breaks loose.

It's trying to build static versions, which means static libc has to be installed.

The errors are produced (small selection):

Link
   [link]         gprconfig-main.adb
   [link]         gprbuild-main.adb
   [link]         gprclean-main.adb
   [link]         gprinstall-main.adb
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -ldl
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -ldl
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lc
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lrt
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lpthread
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -ldl
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lrt
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lpthread
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -ldl
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
   link of gprconfig-main.adb failed
   failed command was: /usr/bin/gcc gprconfig-main.o b__gprconfig-main.o /home/src/build/Ada/gprbuild/obj/production/gprconfig.o /home/src/build/Ada/gprbuild/gpr/lib/production/static/libgpr.a /opt/ada/202206/lib/xmlada/xmlada_schema.static/libxmlada_schema.a /opt/ada/202206/lib/xmlada/xmlada_dom.static/libxmlada_dom.a /opt/ada/202206/lib/xmlada/xmlada_sax.static/libxmlada_sax.a /opt/ada/202206/lib/xmlada/xmlada_input.static/libxmlada_input_sources.a /opt/ada/202206/lib/xmlada/xmlada_unicode.static/libxmlada_unicode.a -L/home/src/build/Ada/gprbuild/obj/production/ -L/home/src/build/Ada/gprbuild/obj/production/ -L/opt/ada/202206/lib/xmlada/xmlada_unicode.static/ -L/opt/ada/202206/lib/xmlada/xmlada_sax.static/ -L/opt/ada/202206/lib/xmlada/xmlada_input.static/ -L/opt/ada/202206/lib/xmlada/xmlada_dom.static/ -L/opt/ada/202206/lib/xmlada/xmlada_schema.static/ -L/home/src/build/Ada/gprbuild/gpr/lib/production/static/ -L/usr/lib64/gcc/x86_64-suse-linux/11/adalib/ -static /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a -ldl -Wl,-rpath-link,/usr/lib64/gcc/x86_64-suse-linux/11//adalib -Wl,-z,origin,-rpath,$ORIGIN/../..//obj/production:/opt/ada/202206/lib/xmlada/xmlada_unicode.static:/opt/ada/202206/lib/xmlada/xmlada_sax.static:/opt/ada/202206/lib/xmlada/xmlada_input.static:/opt/ada/202206/lib/xmlada/xmlada_dom.static:/opt/ada/202206/lib/xmlada/xmlada_schema.static:$ORIGIN/../..//gpr/lib/production/static:/usr/lib64/gcc/x86_64-suse-linux/11/adalib -o /home/src/build/Ada/gprbuild/exe/production//gprconfig 

Okay, so we install libc static and now the following warnings are generated (small selection again):

Link
   [link]         gprconfig-main.adb
   [link]         gprbuild-main.adb
   [link]         gprclean-main.adb
   [link]         gprinstall-main.adb
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_getaddrinfo':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:715: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_gethostbyaddr':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:227: warning: Using 'gethostbyaddr_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_gethostbyname':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:210: warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_getservbyname':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:243: warning: Using 'getservbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: : /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_getservbyport':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:259: warning: Using 'getservbyport_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_getaddrinfo':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:715: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_getaddrinfo':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:715: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_gethostbyaddr':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:227: warning: Using 'gethostbyaddr_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_gethostbyname':

Okay, at least it builds, but it does not work...

So, what type of files has it actually built?

file ./gprbuild ./bootstrap/bin/gprbuild ./exe/production/gprbuild
./gprbuild:                ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f7515df15e5497e862ddf069d28ce6d210fa103a, for GNU/Linux 3.2.0, with debug_info, not stripped
./bootstrap/bin/gprbuild:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f7515df15e5497e862ddf069d28ce6d210fa103a, for GNU/Linux 3.2.0, with debug_info, not stripped
./exe/production/gprbuild: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=6776caefc90f1e3383eafed02d51bafd198e8579, for GNU/Linux 3.2.0, with debug_info, not stripped

So lets try and build a relocatable version.

make LIBRARY_TYPE=relocatable
gprbuild -p -m   -j0 -XBUILD=production  gprbuild.gpr -XLIBRARY_TYPE=static -XXMLADA_BUILD=static
Setup
   [mkdir]        object directory for project GPR
   [mkdir]        library directory for project GPR
Compile
   [Ada]          gprconfig-main.adb
   [Ada]          gprbuild-main.adb
   [Ada]          gprclean-main.adb
   [Ada]          gprinstall-main.adb
   [Ada]          gprslave.adb
[...]
Link
   [link]         gprconfig-main.adb
   [link]         gprbuild-main.adb
   [link]         gprclean-main.adb
   [link]         gprinstall-main.adb
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_getaddrinfo':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:715: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_gethostbyaddr':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:227: warning: Using 'gethostbyaddr_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a(socket.o): in function `__gnat_gethostbyname':
/home/abuild/rpmbuild/BUILD/gcc-11.3.0+git1637/obj-x86_64-suse-linux/gcc/ada/rts/socket.c:210: warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
[...]

And lets test the files again:

file ./gprbuild ./bootstrap/bin/gprbuild ./exe/production/gprbuild
./gprbuild:                ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f7515df15e5497e862ddf069d28ce6d210fa103a, for GNU/Linux 3.2.0, with debug_info, not stripped
./bootstrap/bin/gprbuild:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=f7515df15e5497e862ddf069d28ce6d210fa103a, for GNU/Linux 3.2.0, with debug_info, not stripped
./exe/production/gprbuild: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=2889a8b489c79e4bdccada7451a38080fa16c167, for GNU/Linux 3.2.0, with debug_info, not stripped

Uh, why when relocatable version requested, it did static ones only?

I am guessing the changes have not been fully tested on a clean system, from bootstrap right through to full installation and were only checked with an already previously built system which has masked problems.

If I install the gnat community version and use the supplied gprbuild from it, it all works.

As it stands, gprbuild is wholly broken.

anisimkov commented 2 years ago

I can guess it is a problem with your Linux config. In my side both bootstrup and regular build is OK on Ubuntu 20.04. It is also tested with success on SUSE 15 as I can see. Looks like error messages is truncated in your posts, it is hard to guess what is really happen.

bib1963 commented 2 years ago

Yes, but are you using GCC 11.3.0? And are you sure you are calling the bootstrap version of gprbuild to build the install version of gprbuild?

I cannot see what would be wrong with my install given that it is suse supplied. I also tried it with my own built gcc 11.3.0 version with the same failures.

I truncated the error messages as they are just much of the same. They do not give any further help.

anisimkov commented 2 years ago

11.3.1

anisimkov commented 2 years ago

<<And are you sure you are calling the bootstrap version of gprbuild to build the install version of gprbuild?>> Yes

bib1963 commented 2 years ago

I've now gone through this.

I am looking at these 2 changes:

2022-04-06 New attribute Bindfile_Option_Substitution processing e96be0361bcf3c532f0f9beb13b595164ccfb57a 2022-04-06 Process Config_Concatenable flag for associative arrays d4dff8ed2eb425450ef77a81f5d379f23111a510

With d4dff8ed2e, gprbuild builds just fine.

with e96be0361, gprbuild then has linking problems.

This is what it calls.. Why on earth does it have a -static switch set?

gcc gprconfig-main.o b__gprconfig-main.o /home/src/build/Ada/gprbuild/obj/production/gprconfig.o /home/src/build/Ada/gprbuild/gpr/lib/production/static/libgpr.a /opt/ada/202206/lib/xmlada/xmlada_schema.static/libxmlada_schema.a /opt/ada/202206/lib/xmlada/xmlada_dom.static/libxmlada_dom.a /opt/ada/202206/lib/xmlada/xmlada_sax.static/libxmlada_sax.a /opt/ada/202206/lib/xmlada/xmlada_input.static/libxmlada_input_sources.a /opt/ada/202206/lib/xmlada/xmlada_unicode.static/libxmlada_unicode.a -L/home/src/build/Ada/gprbuild/obj/production/ -L/home/src/build/Ada/gprbuild/obj/production/ -L/opt/ada/202206/lib/xmlada/xmlada_unicode.static/ -L/opt/ada/202206/lib/xmlada/xmlada_sax.static/ -L/opt/ada/202206/lib/xmlada/xmlada_input.static/ -L/opt/ada/202206/lib/xmlada/xmlada_dom.static/ -L/opt/ada/202206/lib/xmlada/xmlada_schema.static/ -L/home/src/build/Ada/gprbuild/gpr/lib/production/static/ -L/opt/gcc/11.2.0/202206/lib64/gcc/x86_64-suse-linux/11/adalib/ -static /opt/gcc/11.2.0/202206/lib64/gcc/x86_64-suse-linux/11/adalib/libgnat.a -ldl -Wl,-rpath-link,/opt/gcc/11.2.0/202206/lib64/gcc/x86_64-suse-linux/11//adalib -Wl,-z,origin,-rpath,$ORIGIN/../..//obj/production:/opt/ada/202206/lib/xmlada/xmlada_unicode.static:/opt/ada/202206/lib/xmlada/xmlada_sax.static:/opt/ada/202206/lib/xmlada/xmlada_input.static:/opt/ada/202206/lib/xmlada/xmlada_dom.static:/opt/ada/202206/lib/xmlada/xmlada_schema.static:$ORIGIN/../..//gpr/lib/production/static:/opt/gcc/11.2.0/202206/lib64/gcc/x86_64-suse-linux/11/adalib -o /home/src/build/Ada/gprbuild/exe/production//gprconfig

anisimkov commented 2 years ago

I guess you did not provide fresh knowlege base on build. It is located at https://github.com/AdaCore/gprconfig_kb repository and xml file from it should be installed into share/gprconfig of the same tree where is gprtools is in the bin directory.

bib1963 commented 2 years ago

Sigh... you're right. In my defence though this is due to me battling the broken gprconfig_kb system.

I've asked you to pull a change which will allow it to be built on many most Linux x86_64 systems which has not been done, and now I am battling to build it on AArch64/opensuse.

We should not need to do this.

And what really gets me, is that building this means we have 3 identical versions of gprconfig_kb in place when built, gprbuild/share/gprconfig/linker.xml, gprbuild/bootstrap/share/gprconfig/linker.xml & the base gprconfig_kb/db/linker.xml.

Why these could not be done with symlinks so we only deal with a single copy, I do not know.