C++ Logo

sg15

Advanced search

Re: Scenarios for consumin libraries with modules

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Wed, 9 Feb 2022 01:15:14 +0000
BMI in an archive is still a file on disk, but not necessarily the familiar layout -- it might be familiar to Java programmers, though.

So "file on disk" by itself does not specifically dictate the layout. I think we need to accommodate for that in our search for solutions.

-- Gaby

-----Original Message-----
From: SG15 <sg15-bounces_at_[hidden]> On Behalf Of Olga Arkhipova via SG15
Sent: Tuesday, February 8, 2022 4:01 PM
To: Daniel Ruoso <daniel_at_[hidden]>; sg15_at_[hidden]
Cc: Olga Arkhipova <olgaark_at_[hidden]>
Subject: Re: [SG15] Scenarios for consumin libraries with modules

>>The main thing missing here is that when libraries are distributed as prebuilt artifacts (using the various package management systems, such as dpkg, rpm, vcpkg, conan, etc) in the end they need to be representable as files on disk, those files need to be installable on a single system in a way that a build system that is not aware of the package manager can consume them (e.g.: CMake doesn't know how boost got to the system, it just knows how to use the files that were made available).

This sounds more like a possible way to achieve the above scenarios (i.e. end goals) rather than a scenario itself.
Or do you want to add an assumption to #2 (or #1 as well? Though I guess it will be strange) that integration with package manager cannot be used there?

Thanks,
Olga


-----Original Message-----
From: Daniel Ruoso <daniel_at_[hidden]>
Sent: Tuesday, February 8, 2022 3:07 PM
To: sg15_at_[hidden]
Cc: Olga Arkhipova <olgaark_at_[hidden]>
Subject: Re: [SG15] Scenarios for consumin libraries with modules

[You don't often get email from daniel_at_ruoso.com. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]

On Tue, Feb 8, 2022 at 5:02 PM Olga Arkhipova via SG15 <sg15_at_[hidden]> wrote:
> 1.1 The build needs to have Module B's and Module A's BMIs to be able to compile the source using it.
> The build needs to either
> 1.1.1. find BMIs (assuming it can read them)
> or
> 1.1.2. somehow build the BMIs (assuming it cannot read them).

Correct. The "compatibility surface" for BMI files is radically smaller than the "compatibility surface" of the language ABI and runtime. It's very likely that a library that was originally built with gcc will then be consumed by a codebase being compiled in clang.
Or, even when using the same compiler, they will very likely be using different versions. None of those share the same BMI.

Having to create build rules for Module B and Module A is the fundamental change introduced by modules.

> 1.2. The build also needs to find and link static lib of Library B (which contains implementation of Module B), as well as static lib of Library A (which contains implementation of Module A).

Correct. However, this is not something that changes by the introduction of modules. Build and package management systems that already link libraries together today will be able to continue doing what they are doing.

Modules don't change how that works.

> Tools outside of the main build (IDE, static analysis, etc.) need to compile/parse C.
> Assumption: the main build of C succeeds on the same machine.
> For that they need to be able to rebuild Module A and Module B (the assumption is that they never can read BMIs).

Correct. In the world pre-modules, it is possible to perform static analysis in a translation unit by observing the compiler command for that translation unit (usually encoded in compile_commands.json). With the introduction of modules, the static analysis pass needs to somehow be able to reproduce the same additional steps that the build system did.

> Does this sound right and are there any other scenarios/assumptions?

The main thing missing here is that when libraries are distributed as prebuilt artifacts (using the various package management systems, such as dpkg, rpm, vcpkg, conan, etc) in the end they need to be representable as files on disk, those files need to be installable on a single system in a way that a build system that is not aware of the package manager can consume them (e.g.: CMake doesn't know how boost got to the system, it just knows how to use the files that were made available).

But yes, I am moderately confident that most other scenarios are indirectly covered by this scenario.

daniel
_______________________________________________
SG15 mailing list
SG15_at_[hidden]
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.isocpp.org%2Fmailman%2Flistinfo.cgi%2Fsg15&amp;data=04%7C01%7Cgdr%40microsoft.com%7C7d6fdafc49564b6ddf4b08d9eb5f41d7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637799616640846328%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=Xq37X7%2F2c59v1ELtNKtaaUhUFklh5jy78szVtXEQ%2FkY%3D&amp;reserved=0

Received on 2022-02-09 01:15:18