* Directory structure of glibc and header files installed on Linux @ 2021-03-04 2:37 Peng Yu 2021-03-04 10:57 ` Florian Weimer 0 siblings, 1 reply; 12+ messages in thread From: Peng Yu @ 2021-03-04 2:37 UTC (permalink / raw) To: libc-help Hi, I'd like to know the complete list header files installed on Linux. The directory structure is a little complicated. Could anybody help me understand what they are? And what headers files are installed on Linux? Some files have the same name. What is their difference? $ find -name stdlib.h ./include/stdlib.h ./include/bits/stdlib.h ./stdlib/stdlib.h ./stdlib/bits/stdlib.h $ ls -gG --time-style=+"" total 12216 -rw-r--r-- 1 18092 COPYING -rw-r--r-- 1 26530 COPYING.LIB drwxr-xr-x 43 1376 ChangeLog.old -rw-r--r-- 1 33584 INSTALL -rw-r--r-- 1 18943 LICENSES -rw-r--r-- 1 50 MAINTAINERS -rw-r--r-- 1 49221 Makeconfig -rw-r--r-- 1 22147 Makefile -rw-r--r-- 1 1390 Makefile.help -rw-r--r-- 1 566 Makefile.in -rw-r--r-- 1 54260 Makerules -rw-r--r-- 1 301071 NEWS -rw-r--r-- 1 3151 README -rw-r--r-- 1 12888 Rules -rw-r--r-- 1 1230 abi-tags -rw-r--r-- 1 9813 aclocal.m4 drwxr-xr-x 23 736 argp drwxr-xr-x 13 416 assert drwxr-xr-x 135 4320 benchtests drwxr-xr-x 84 2688 bits drwxr-xr-x 18 576 catgets -rw-r--r-- 1 7850 config.h.in -rw-r--r-- 1 4053 config.make.in -rwxr-xr-x 1 240311 configure -rw-r--r-- 1 56879 configure.ac drwxr-xr-x 9 288 conform drwxr-xr-x 35 1120 crypt drwxr-xr-x 18 576 csu drwxr-xr-x 13 416 ctype drwxr-xr-x 120 3840 debug drwxr-xr-x 38 1216 dirent drwxr-xr-x 69 2208 dlfcn drwxr-xr-x 628 20096 elf -rw-r--r-- 1 3937 extra-lib.mk -rw-r--r-- 1 940 gen-locales.mk drwxr-xr-x 18 576 gmon drwxr-xr-x 4 128 gnulib drwxr-xr-x 27 864 grp drwxr-xr-x 17 544 gshadow drwxr-xr-x 10 320 hesiod drwxr-xr-x 38 1216 htl drwxr-xr-x 88 2816 hurd drwxr-xr-x 46 1472 iconv drwxr-xr-x 404 12928 iconvdata drwxr-xr-x 157 5024 include drwxr-xr-x 110 3520 inet drwxr-xr-x 51 1632 intl drwxr-xr-x 150 4800 io -rw-r--r-- 1 2025 libc-abis drwxr-xr-x 224 7168 libio -rw-r--r-- 1 291 libof-iterator.mk drwxr-xr-x 75 2400 locale drwxr-xr-x 145 4640 localedata drwxr-xr-x 51 1632 login drwxr-xr-x 41 1312 mach drwxr-xr-x 94 3008 malloc drwxr-xr-x 70 2240 manual drwxr-xr-x 507 16224 math drwxr-xr-x 4 128 mathvec drwxr-xr-x 182 5824 misc drwxr-xr-x 49 1568 nis drwxr-xr-x 362 11584 nptl drwxr-xr-x 51 1632 nptl_db drwxr-xr-x 48 1536 nscd drwxr-xr-x 87 2784 nss -rw-r--r-- 1 358 o-iterator.mk drwxr-xr-x 43 1376 po drwxr-xr-x 307 9824 posix drwxr-xr-x 17 544 pwd drwxr-xr-x 98 3136 resolv drwxr-xr-x 20 640 resource drwxr-xr-x 72 2304 rt drwxr-xr-x 55 1760 scripts drwxr-xr-x 19 608 setjmp drwxr-xr-x 17 544 shadow -rw-r--r-- 1 2409 shlib-versions drwxr-xr-x 57 1824 signal drwxr-xr-x 31 992 socket drwxr-xr-x 92 2944 soft-fp drwxr-xr-x 206 6592 stdio-common drwxr-xr-x 245 7840 stdlib drwxr-xr-x 159 5088 string drwxr-xr-x 71 2272 sunrpc drwxr-xr-x 214 6848 support drwxr-xr-x 33 1056 sysdeps drwxr-xr-x 22 704 sysvipc drwxr-xr-x 18 576 termios -rw-r--r-- 1 3067 test-skeleton.c drwxr-xr-x 80 2560 time drwxr-xr-x 34 1088 timezone -rw-r--r-- 1 125 version.h drwxr-xr-x 124 3968 wcsmbs drwxr-xr-x 20 640 wctype -- Regards, Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 2:37 Directory structure of glibc and header files installed on Linux Peng Yu @ 2021-03-04 10:57 ` Florian Weimer 2021-03-04 14:19 ` Peng Yu 0 siblings, 1 reply; 12+ messages in thread From: Florian Weimer @ 2021-03-04 10:57 UTC (permalink / raw) To: Peng Yu via Libc-help * Peng Yu via Libc-help: > I'd like to know the complete list header files installed on Linux. The easiest way is to run build-many-glibcs.py and look at the install trees. The answer varies from architecture to architecture. Thanks, Florian ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 10:57 ` Florian Weimer @ 2021-03-04 14:19 ` Peng Yu 2021-03-04 14:41 ` Adhemerval Zanella 0 siblings, 1 reply; 12+ messages in thread From: Peng Yu @ 2021-03-04 14:19 UTC (permalink / raw) To: Florian Weimer; +Cc: Peng Yu via Libc-help I can see what files are in the ubuntu package libc6-dev. But that does not help with where they come from and what the structure of the glibc is. An explanation of the source tree would be helpful. On 3/4/21, Florian Weimer <fweimer@redhat.com> wrote: > * Peng Yu via Libc-help: > >> I'd like to know the complete list header files installed on Linux. > > The easiest way is to run build-many-glibcs.py and look at the install > trees. The answer varies from architecture to architecture. > > Thanks, > Florian > > -- Regards, Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 14:19 ` Peng Yu @ 2021-03-04 14:41 ` Adhemerval Zanella 2021-03-04 16:56 ` Peng Yu 0 siblings, 1 reply; 12+ messages in thread From: Adhemerval Zanella @ 2021-03-04 14:41 UTC (permalink / raw) To: Peng Yu; +Cc: Florian Weimer, Peng Yu via Libc-help On Thu, Mar 4, 2021 at 11:20 AM Peng Yu via Libc-help <libc-help@sourceware.org> wrote: > > I can see what files are in the ubuntu package libc6-dev. But that > does not help with where they come from and what the structure of the > glibc is. An explanation of the source tree would be helpful. > > On 3/4/21, Florian Weimer <fweimer@redhat.com> wrote: > > * Peng Yu via Libc-help: > > > >> I'd like to know the complete list header files installed on Linux. > > > > The easiest way is to run build-many-glibcs.py and look at the install > > trees. The answer varies from architecture to architecture. The installed headers are defined by the rule 'headers' in the Makefile: $ grep -w '\<headers\>.*:=' `find . -iname Makefile` ./dirent/Makefile:headers := dirent.h bits/dirent.h bits/dirent_ext.h ./pwd/Makefile:headers := pwd.h ./math/Makefile:headers := math.h bits/mathcalls.h \ ./resource/Makefile:headers := sys/resource.h bits/resource.h sys/vlimit.h \ [...] However each system can add extra installed headers with the 'sysdep_headers' rule: grep -w '\<sysdep_headers\>' `find . -iname Makefile` ./sysdeps/aarch64/Makefile:sysdep_headers += sys/ifunc.h ./sysdeps/x86/Makefile:sysdep_headers += sys/platform/x86.h ./sysdeps/powerpc/Makefile:sysdep_headers += sys/platform/ppc.h ./sysdeps/mach/hurd/Makefile:sysdep_headers += nfs/nfs.h [...] And each architecture can still override the header using the sysdeps folders. For instance, the sysdeps/unix/sysv/linux/Makefile add the bits/struct_stat.h, and some architectures override it: $ find . -iname struct_stat.h ./sysdeps/unix/sysv/linux/generic/bits/struct_stat.h ./sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h ./sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h ./sysdeps/unix/sysv/linux/s390/bits/struct_stat.h ./sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h ./sysdeps/unix/sysv/linux/x86/bits/struct_stat.h ./sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h ./sysdeps/unix/sysv/linux/ia64/bits/struct_stat.h ./sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h ./sysdeps/unix/sysv/linux/bits/struct_stat.h ./sysdeps/unix/sysv/linux/mips/bits/struct_stat.h That's why the simplest solution is as Florian has put it to build a glibc to the target you want to inspect and check the installed headers. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 14:41 ` Adhemerval Zanella @ 2021-03-04 16:56 ` Peng Yu 2021-03-04 19:58 ` Adhemerval Zanella 0 siblings, 1 reply; 12+ messages in thread From: Peng Yu @ 2021-03-04 16:56 UTC (permalink / raw) To: Adhemerval Zanella; +Cc: Florian Weimer, Peng Yu via Libc-help Hi Adhemerval and Florian, > That's why the simplest solution is as Florian has put it to build a > glibc to the target you want to > inspect and check the installed headers. I don't understand this part. When it is installed, it does copies or symlinks? If it is just copies, how to tell where they are originally from? How to avoid the conflict between user installed libc vs the system default installed libc (as. libc6-dev in debian lineage)? Do you have to build glibc before running build-many-glibcs.py? How to run build-many-glibcs.py? It seems that it have options. I am not sure what options I should use. Could you show me the complete command? Does macOS use glibc? On macOS, I see this. $ gcc -E -dD - <<< '#include <sys/socket.h>' |grep '^#define SOL_' #define SOL_SOCKET 0xffff On Linux, I see this. Is that macOS uses a completely different libc library? Or glibc has a specific target for macOS? $ gcc -E -dD - <<< '#include <sys/socket.h>' |grep '^#define SOL_' #define SOL_RAW 255 #define SOL_DECNET 261 #define SOL_X25 262 #define SOL_PACKET 263 #define SOL_ATM 264 #define SOL_AAL 265 #define SOL_IRDA 266 #define SOL_NETBEUI 267 #define SOL_LLC 268 #define SOL_DCCP 269 #define SOL_NETLINK 270 #define SOL_TIPC 271 #define SOL_RXRPC 272 #define SOL_PPPOL2TP 273 #define SOL_BLUETOOTH 274 #define SOL_PNPIPE 275 #define SOL_RDS 276 #define SOL_IUCV 277 #define SOL_CAIF 278 #define SOL_ALG 279 #define SOL_NFC 280 #define SOL_KCM 281 #define SOL_TLS 282 #define SOL_XDP 283 #define SOL_SOCKET 1 -- Regards, Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 16:56 ` Peng Yu @ 2021-03-04 19:58 ` Adhemerval Zanella 2021-03-04 22:37 ` Peng Yu 0 siblings, 1 reply; 12+ messages in thread From: Adhemerval Zanella @ 2021-03-04 19:58 UTC (permalink / raw) To: Peng Yu; +Cc: Florian Weimer, Peng Yu via Libc-help On Thu, Mar 4, 2021 at 1:56 PM Peng Yu <pengyu.ut@gmail.com> wrote: > > Hi Adhemerval and Florian, > > > That's why the simplest solution is as Florian has put it to build a > > glibc to the target you want to > > inspect and check the installed headers. > > I don't understand this part. When it is installed, it does copies or > symlinks? If it is just copies, how to tell where they are originally > from? How to avoid the conflict between user installed libc vs the > system default installed libc (as. libc6-dev in debian lineage)? It always copy, there is no symlink involved in the installation. Also, there is nothing preventing you to wreck your system by installing a glibc over the system one (you should not do it unless you know *exactly* what you are doing). The usual process of installing the glibc is during either a work rebuild on a sysroot (like Linux From Scratch does) or within a sysroot (like build-many-glibcs.py does). > > Do you have to build glibc before running build-many-glibcs.py? How to > run build-many-glibcs.py? It seems that it have options. I am not sure > what options I should use. Could you show me the complete command? The build-many-glibcs.py requires some tools, like a working gcc, python3, bison, and the other usual tools required to build gcc and glibc. The simplest way to use is: (1) glibc-git$ ./scripts/build-many-glibcs.py checkout /path/to/place/source/and/binaries (2) glibc-git$ ./scripts/build-many-glibcs.py host-libraries (3) glibc-git$ ./scripts/build-many-glibcs.py compilers x86_64-linux-gnu (4) glibc-git$ ./scripts/build-many-glibcs.py glibcs x86_64-linux-gnu The (1) will download the required source (binutils, linux, gcc, glibc, math libraries), (2) will build the math libraries used in gcc built, (3) will build a bootstrap compiler targetting x86_64-linux-gnu, and finally (4) will build a glibc using the bootstrap compiler built. > > Does macOS use glibc? No, macOS uses its own libc implementation. And there is no glibc support for macOS, neither in plan. > > On macOS, I see this. > > $ gcc -E -dD - <<< '#include <sys/socket.h>' |grep '^#define SOL_' > #define SOL_SOCKET 0xffff > > On Linux, I see this. Is that macOS uses a completely different libc > library? Or glibc has a specific target for macOS? Yes, macOS uses https://opensource.apple.com/source/Libc/ > > $ gcc -E -dD - <<< '#include <sys/socket.h>' |grep '^#define SOL_' > #define SOL_RAW 255 > #define SOL_DECNET 261 > #define SOL_X25 262 > #define SOL_PACKET 263 > #define SOL_ATM 264 > #define SOL_AAL 265 > #define SOL_IRDA 266 > #define SOL_NETBEUI 267 > #define SOL_LLC 268 > #define SOL_DCCP 269 > #define SOL_NETLINK 270 > #define SOL_TIPC 271 > #define SOL_RXRPC 272 > #define SOL_PPPOL2TP 273 > #define SOL_BLUETOOTH 274 > #define SOL_PNPIPE 275 > #define SOL_RDS 276 > #define SOL_IUCV 277 > #define SOL_CAIF 278 > #define SOL_ALG 279 > #define SOL_NFC 280 > #define SOL_KCM 281 > #define SOL_TLS 282 > #define SOL_XDP 283 > #define SOL_SOCKET 1 > > -- > Regards, > Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 19:58 ` Adhemerval Zanella @ 2021-03-04 22:37 ` Peng Yu 2021-03-04 23:01 ` Konstantin Kharlamov 2021-03-05 0:07 ` Adhemerval Zanella 0 siblings, 2 replies; 12+ messages in thread From: Peng Yu @ 2021-03-04 22:37 UTC (permalink / raw) To: Adhemerval Zanella; +Cc: Florian Weimer, Peng Yu via Libc-help Hi Adhemerval, > The usual process of installing the glibc is during either a work rebuild on > a > sysroot (like Linux From Scratch does) or within a sysroot (like > build-many-glibcs.py > does). These are too complicated at this moment. I do think that a verbal explanation of the directory structure (target Linux as an example) is more helpful. >> Do you have to build glibc before running build-many-glibcs.py? How to >> run build-many-glibcs.py? It seems that it have options. I am not sure >> what options I should use. Could you show me the complete command? > > The build-many-glibcs.py requires some tools, like a working gcc, python3, > bison, and the other usual tools required to build gcc and glibc. The > simplest > way to use is: This also could be a problem due to the dependencies. Is there a walkthrough with the exact set of commands based on a vanilla ubuntu system? For example, you mentioned sysroot. I am not familiar with it. An exact sequence of commands should be helpful as the goal here is not to learn sysroot. > (1) glibc-git$ ./scripts/build-many-glibcs.py checkout > /path/to/place/source/and/binaries > (2) glibc-git$ ./scripts/build-many-glibcs.py host-libraries > (3) glibc-git$ ./scripts/build-many-glibcs.py compilers x86_64-linux-gnu > (4) glibc-git$ ./scripts/build-many-glibcs.py glibcs x86_64-linux-gnu > > The (1) will download the required source (binutils, linux, gcc, > glibc, math libraries), (2) will > build the math libraries used in gcc built, (3) will build a bootstrap > compiler targetting > x86_64-linux-gnu, and finally (4) will build a glibc using the > bootstrap compiler built. -- Regards, Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 22:37 ` Peng Yu @ 2021-03-04 23:01 ` Konstantin Kharlamov 2021-03-05 2:38 ` Peng Yu 2021-03-05 0:07 ` Adhemerval Zanella 1 sibling, 1 reply; 12+ messages in thread From: Konstantin Kharlamov @ 2021-03-04 23:01 UTC (permalink / raw) To: Peng Yu, Adhemerval Zanella; +Cc: Florian Weimer, Peng Yu via Libc-help On Thu, 2021-03-04 at 16:37 -0600, Peng Yu via Libc-help wrote: > Hi Adhemerval, > > > The usual process of installing the glibc is during either a work rebuild on > > a > > sysroot (like Linux From Scratch does) or within a sysroot (like > > build-many-glibcs.py > > does). > > These are too complicated at this moment. I do think that a verbal > explanation of the directory structure (target Linux as an example) is > more helpful. > > > > Do you have to build glibc before running build-many-glibcs.py? How to > > > run build-many-glibcs.py? It seems that it have options. I am not sure > > > what options I should use. Could you show me the complete command? > > > > The build-many-glibcs.py requires some tools, like a working gcc, python3, > > bison, and the other usual tools required to build gcc and glibc. The > > simplest > > way to use is: > > This also could be a problem due to the dependencies. Is there a > walkthrough with the exact set of commands based on a vanilla ubuntu > system? > > For example, you mentioned sysroot. I am not familiar with it. An > exact sequence of commands should be helpful as the goal here is not > to learn sysroot. > > > (1) glibc-git$ ./scripts/build-many-glibcs.py checkout > > /path/to/place/source/and/binaries > > (2) glibc-git$ ./scripts/build-many-glibcs.py host-libraries > > (3) glibc-git$ ./scripts/build-many-glibcs.py compilers x86_64-linux-gnu > > (4) glibc-git$ ./scripts/build-many-glibcs.py glibcs x86_64-linux-gnu > > > > The (1) will download the required source (binutils, linux, gcc, > > glibc, math libraries), (2) will > > build the math libraries used in gcc built, (3) will build a bootstrap > > compiler targetting > > x86_64-linux-gnu, and finally (4) will build a glibc using the > > bootstrap compiler built. FWIW, whenever I need to build a project I don't know how to build yet, I often look at how my distro does that. If it's something complicated (which seems to be the case with glibc), I use the configuration provided by my distro. You said you're using Ubuntu. I found that Ubuntu provides a way to build a package from source by using `apt source …` and then `dpkg-buildpackage …`, see: https://askubuntu.com/a/246721/266507 (unless I misunderstand something, the `dpkg-buildpackage` will probably run a script that in turn runs `configure`, `make`, etc, and at the end would package a deb file). Side note: apt will download sources for the version of glibc that is installed in your Ubuntu. Ubuntu is mostly known as a distro providing ancient software (except perhaps browsers), so the glibc you'll get will likely be very old. It may or may not be what you want. However, even if it's not what you want, you could just replace the sources that apt downloaded for you with the actual latest version of glibc, and make it build them. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 23:01 ` Konstantin Kharlamov @ 2021-03-05 2:38 ` Peng Yu 2021-03-05 11:19 ` Adhemerval Zanella 0 siblings, 1 reply; 12+ messages in thread From: Peng Yu @ 2021-03-05 2:38 UTC (permalink / raw) To: Konstantin Kharlamov Cc: Adhemerval Zanella, Florian Weimer, Peng Yu via Libc-help > FWIW, whenever I need to build a project I don't know how to build yet, I > often look at how my distro does that. If it's something complicated (which > seems to be the case with glibc), I use the configuration provided by my > distro. > > You said you're using Ubuntu. I found that Ubuntu provides a way to build a > package from source by using `apt source …` and then `dpkg-buildpackage …`, > see: https://askubuntu.com/a/246721/266507 (unless I misunderstand > something, the `dpkg-buildpackage` will probably run a script that in turn > runs `configure`, `make`, etc, and at the end would package a deb file). > > Side note: apt will download sources for the version of glibc that is > installed in your Ubuntu. Ubuntu is mostly known as a distro providing > ancient software (except perhaps browsers), so the glibc you'll get will > likely be very old. It may or may not be what you want. Debian packages are old. It just creates a .deb file. It introduces another sets of tools which I don't know the details. If there are any problems, I will not know how to fix along the way. It is still too complicated. The original question is to understand the directory structure. Then, the question became, compile glibc, installing system from scratch ... I don't think approaches like this makes sense. it makes a simple thing more complicated than necessary. I think the main problem is that there is not a doc for the directory structure of glibc. That should have been done. -- Regards, Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-05 2:38 ` Peng Yu @ 2021-03-05 11:19 ` Adhemerval Zanella 0 siblings, 0 replies; 12+ messages in thread From: Adhemerval Zanella @ 2021-03-05 11:19 UTC (permalink / raw) To: Peng Yu; +Cc: Konstantin Kharlamov, Florian Weimer, Peng Yu via Libc-help > Il giorno 4 mar 2021, alle ore 23:38, Peng Yu <pengyu.ut@gmail.com> ha scritto: > > >> >> FWIW, whenever I need to build a project I don't know how to build yet, I >> often look at how my distro does that. If it's something complicated (which >> seems to be the case with glibc), I use the configuration provided by my >> distro. >> >> You said you're using Ubuntu. I found that Ubuntu provides a way to build a >> package from source by using `apt source …` and then `dpkg-buildpackage …`, >> see: https://askubuntu.com/a/246721/266507 (unless I misunderstand >> something, the `dpkg-buildpackage` will probably run a script that in turn >> runs `configure`, `make`, etc, and at the end would package a deb file). >> >> Side note: apt will download sources for the version of glibc that is >> installed in your Ubuntu. Ubuntu is mostly known as a distro providing >> ancient software (except perhaps browsers), so the glibc you'll get will >> likely be very old. It may or may not be what you want. > > Debian packages are old. It just creates a .deb file. It introduces > another sets of tools which I don't know the details. If there are any > problems, I will not know how to fix along the way. > > It is still too complicated. The original question is to understand > the directory structure. Then, the question became, compile glibc, > installing system from scratch ... I don't think approaches like this > makes sense. it makes a simple thing more complicated than necessary. > The problem here is we giving you the readily available information and steps on how you can proceed and obtain what you initially want, but you instead want *us* to spend time compiling and summarizes games instead of do yourself the research. > I think the main problem is that there is not a doc for the directory > structure of glibc. That should have been done. I do not disagree, if you want to contribute I can give you access to glibc wiki and help you document this properly. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-04 22:37 ` Peng Yu 2021-03-04 23:01 ` Konstantin Kharlamov @ 2021-03-05 0:07 ` Adhemerval Zanella 2021-03-05 2:30 ` Peng Yu 1 sibling, 1 reply; 12+ messages in thread From: Adhemerval Zanella @ 2021-03-05 0:07 UTC (permalink / raw) To: Peng Yu; +Cc: Florian Weimer, Peng Yu via Libc-help On 04/03/2021 19:37, Peng Yu wrote: > Hi Adhemerval, > >> The usual process of installing the glibc is during either a work rebuild on >> a >> sysroot (like Linux From Scratch does) or within a sysroot (like >> build-many-glibcs.py >> does). > > These are too complicated at this moment. I do think that a verbal > explanation of the directory structure (target Linux as an example) is > more helpful. Sorry, but you will need to get used to some terminology and how toolchain work. You can either read the build-many-glibcs.py script and see how it accomplish the bootstrap you check with multiple online resources on how this is done (for instance on how crosstool-ng does it [1] or how Linux from Scratch work [2]). > >>> Do you have to build glibc before running build-many-glibcs.py? How to >>> run build-many-glibcs.py? It seems that it have options. I am not sure >>> what options I should use. Could you show me the complete command? >> >> The build-many-glibcs.py requires some tools, like a working gcc, python3, >> bison, and the other usual tools required to build gcc and glibc. The >> simplest >> way to use is: > > This also could be a problem due to the dependencies. Is there a > walkthrough with the exact set of commands based on a vanilla ubuntu > system? I just gave you the simplest way on how to create a bootstrap compiler, did at least try and checked the results? > > For example, you mentioned sysroot. I am not familiar with it. An > exact sequence of commands should be helpful as the goal here is not > to learn sysroot. A sysroot is a folder which contains a minimal filesystem (especially libraries, the C library and header files). I just paste the *exactly* sequence of command using build-many-glibcs.py to create one using gcc targeting glibc. You will need to read build-many-glibcs.py [3] to check exactly on how it accomplish it, > >> (1) glibc-git$ ./scripts/build-many-glibcs.py checkout >> /path/to/place/source/and/binaries >> (2) glibc-git$ ./scripts/build-many-glibcs.py host-libraries >> (3) glibc-git$ ./scripts/build-many-glibcs.py compilers x86_64-linux-gnu >> (4) glibc-git$ ./scripts/build-many-glibcs.py glibcs x86_64-linux-gnu >> >> The (1) will download the required source (binutils, linux, gcc, >> glibc, math libraries), (2) will >> build the math libraries used in gcc built, (3) will build a bootstrap >> compiler targetting >> x86_64-linux-gnu, and finally (4) will build a glibc using the >> bootstrap compiler built. > > [1] https://crosstool-ng.github.io/docs/toolchain-construction/ [2] http://www.linuxfromscratch.org/ [3] https://sourceware.org/git/?p=glibc.git;a=blob;f=scripts/build-many-glibcs.py;h=580d25e8ee4b3ff5f99fb957e6e533035bcc4ebc;hb=HEAD ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Directory structure of glibc and header files installed on Linux 2021-03-05 0:07 ` Adhemerval Zanella @ 2021-03-05 2:30 ` Peng Yu 0 siblings, 0 replies; 12+ messages in thread From: Peng Yu @ 2021-03-05 2:30 UTC (permalink / raw) To: Adhemerval Zanella; +Cc: Florian Weimer, Peng Yu via Libc-help > A sysroot is a folder which contains a minimal filesystem (especially > libraries, the C library and header files). I just paste the *exactly* > sequence of command using build-many-glibcs.py to create one using > gcc targeting glibc. You will need to read build-many-glibcs.py [3] > to check exactly on how it accomplish it, I am referring to the exact sequence of commands to make sysroot. Basically, all commands need for vanilla ubuntu are needed (only sysroot is need before running build-many-glibcs.py ?). Google search of sysroot is not very helpful on how to use it. https://stackoverflow.com/questions/39920712/what-is-a-sysroot-exactly-and-how-do-i-create-one So once sysroot is create, then the following commands can be used? All the original glibc installed in the system will not be affected? >>> (1) glibc-git$ ./scripts/build-many-glibcs.py checkout >>> /path/to/place/source/and/binaries >>> (2) glibc-git$ ./scripts/build-many-glibcs.py host-libraries >>> (3) glibc-git$ ./scripts/build-many-glibcs.py compilers x86_64-linux-gnu >>> (4) glibc-git$ ./scripts/build-many-glibcs.py glibcs x86_64-linux-gnu >>> >>> The (1) will download the required source (binutils, linux, gcc, >>> glibc, math libraries), (2) will >>> build the math libraries used in gcc built, (3) will build a bootstrap >>> compiler targetting >>> x86_64-linux-gnu, and finally (4) will build a glibc using the >>> bootstrap compiler built. >> >> > > [1] https://crosstool-ng.github.io/docs/toolchain-construction/ I don't need cross compilation. Why is this relevant? > [2] http://www.linuxfromscratch.org/ What is the relation of the above instruction to arch linux? > [3] > https://sourceware.org/git/?p=glibc.git;a=blob;f=scripts/build-many-glibcs.py;h=580d25e8ee4b3ff5f99fb957e6e533035bcc4ebc;hb=HEAD There are almost two thousand lines of code with too much code about dealing with command-line options. It is definitely not minimal for learning purposes. Does it really take so many lines of code. If the target is just for intel architecture, It sounds like a bash script with barely minimal code should be much shorter. -- Regards, Peng ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-03-05 11:19 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-03-04 2:37 Directory structure of glibc and header files installed on Linux Peng Yu 2021-03-04 10:57 ` Florian Weimer 2021-03-04 14:19 ` Peng Yu 2021-03-04 14:41 ` Adhemerval Zanella 2021-03-04 16:56 ` Peng Yu 2021-03-04 19:58 ` Adhemerval Zanella 2021-03-04 22:37 ` Peng Yu 2021-03-04 23:01 ` Konstantin Kharlamov 2021-03-05 2:38 ` Peng Yu 2021-03-05 11:19 ` Adhemerval Zanella 2021-03-05 0:07 ` Adhemerval Zanella 2021-03-05 2:30 ` Peng Yu
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).