From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by sourceware.org (Postfix) with ESMTPS id 29D1D3AA9C29 for ; Thu, 4 Mar 2021 14:41:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 29D1D3AA9C29 Received: by mail-yb1-xb32.google.com with SMTP id c131so28713731ybf.7 for ; Thu, 04 Mar 2021 06:41:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7CZ2oHabz/ZHDggDOqCBCGnL9O52s0S5Ar0p0PqTd7c=; b=r9lN6qoVuG5D5jjzwd+A09HIOlFYcGbPfEMDHTZRGMBWCvMJV8AOoqEFQpQWeHMq5T XBaEQFSwRTfeTjcSMlAbuNF6h9tup2LP0/8ojU9miR02t+Yp3f17G7Kixa0sxRmg7DPK 0F956WHeIKtOgZdMxxBvr8t3ymPVguiKovxT2z6rWSN/3Qy5nQSKBvVLZj1MkqPkYu+H 9ugvd+faX+LBvL3rmGlyXgBWyZZ1kzPCBEtXeRPe9diiBMRemFmx8PbB05dByn5eL74X erWz1rLQmN/6lCKn8a/tm7PVeR4o3mPvj8gg1+TZoGf7bARsav7K8ZnUK8rFKK2X4ek6 PFuQ== X-Gm-Message-State: AOAM532WbFsrj9z5h1ewF/eyOwliAk62a4AlvS0kH3I+f1mAJc+l+y42 G/EktYI1ADqo5EQuJo1ERhHQN6DQwq6w7n5gNxTm3Q== X-Google-Smtp-Source: ABdhPJxbb+jWQfhPqYQIKed6S1CEda9Q+osjaIBp6Dq0G7g9hZBXEh78wIwujp53EOF7Lc6AGZO8gBMK8xJrGipqytk= X-Received: by 2002:a25:7444:: with SMTP id p65mr7009987ybc.441.1614868911609; Thu, 04 Mar 2021 06:41:51 -0800 (PST) MIME-Version: 1.0 References: <87wnunnq3q.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Adhemerval Zanella Date: Thu, 4 Mar 2021 11:41:40 -0300 Message-ID: Subject: Re: Directory structure of glibc and header files installed on Linux To: Peng Yu Cc: Florian Weimer , Peng Yu via Libc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Mar 2021 14:41:53 -0000 On Thu, Mar 4, 2021 at 11:20 AM Peng Yu via Libc-help 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 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 '\.*:=' `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 '\' `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.