Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration: Split options into global and per-module configuration #3590

Merged
merged 19 commits into from
Oct 8, 2024

Conversation

RAOF
Copy link
Contributor

@RAOF RAOF commented Sep 9, 2024

This lets each module define its own options, without needing the option names to be unique across all modules.

Also organises the module-specific options into their own sections at the end of the help text.

@RAOF RAOF requested a review from a team as a code owner September 9, 2024 02:04
@RAOF RAOF force-pushed the MIRENG-653/platform-specific-options branch from 415a9c3 to 9367dc7 Compare September 9, 2024 05:42
@RAOF
Copy link
Contributor Author

RAOF commented Sep 9, 2024

Aaargh. When did those tests break?

It can be useful to know if two `SharedLibrary` instances refer to the same DSO.
The new `SharedLibrary::Handle` implements such a comparable handle. This works
because `dlopen` guarantees that loading an already-loaded DSO returns the same
handle.
This lets each module define its own options, without needing the option names
to be unique across all modules.

Also organises the module-specific options into their own sections at the end
of the help text.
Apparently this isn't necessary on 24.10? The code definitely uses it, though.
…on per module.

`mo::ProgramOption::parse_arguments()` assumes that the *first* argument in the arguments array is
`argv[0]`; that is, the name of the calling binary, and so it strips it out. This was causing us
to consume an unparsed argument for each module we had loaded.

Instead, insert `argv[0]` into the argument array before parsing.
If there aren't any unparsed tokens left then we don't need to see if
any remaining modules might consume them.
…rdered_map`

This existed for hysterical raisins, but those got evenually whittled
down over the course of development, and now `std::unordered_map` does
what we want.
@RAOF RAOF force-pushed the MIRENG-653/platform-specific-options branch from 5297983 to 7fd62d0 Compare September 10, 2024 08:04
@RAOF
Copy link
Contributor Author

RAOF commented Sep 10, 2024

Now with fewer conflicts 🤦‍♀️

Copy link
Contributor

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, I like the approach and the result.

In addition to the naming tweaks and mircommon stanza, this breaks ABI for mirplatform and mirserver

include/platform/mir/options/configuration.h Outdated Show resolved Hide resolved
include/platform/mir/options/configuration.h Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
src/platform/options/default_configuration.cpp Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
src/common/symbols.map Outdated Show resolved Hide resolved
@AlanGriffiths
Copy link
Contributor

Oops! The "Symbols Check" is failing because the symbols_map_generator isn't matching the corrected symbols.map...

INFO:__main__:symbols_map_generator is running in 'diff' mode
INFO:__main__:MIR_SYMBOLS_MAP_GENERATOR_CLANG_SO_PATH is /usr/lib/llvm-18/lib/libclang-18.so.1
INFO:__main__:MIR_SYMBOLS_MAP_GENERATOR_CLANG_LIBRARY_PATH is /usr/lib/llvm-18/lib
INFO:__main__:Symbols map generation is beginning for library=mir_common with version=2.18
INFO:__main__:Processing external headers directory: /home/runner/work/mir/mir/include/common
INFO:__main__:Processing internal headers directory: /home/runner/work/mir/mir/src/include/common
External Symbols Diff:

  New Symbols 🟢🟢🟢
    std::hash::operator*;
    typeinfo?for?std::hash;

  Deleted Symbols 🔻🔻🔻

Internal Symbols Diff:

gmake[3]: *** [src/common/CMakeFiles/check-mircommon-symbols-map.dir/build.make:70: src/common/CMakeFiles/check-mircommon-symbols-map] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:3151: src/common/CMakeFiles/check-mircommon-symbols-map.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:3158: src/common/CMakeFiles/check-mircommon-symbols-map.dir/rule] Error 2
gmake: *** [Makefile:621: check-mircommon-symbols-map] Error 2
Error: Process completed with exit code 2.

...I guess it does need fixing after all

@tarek-y-ismail
Copy link
Contributor

Oops! The "Symbols Check" is failing because the symbols_map_generator isn't matching the corrected symbols.map...

Hmm, that's weird. It seems that the code builds fine without them. I just thought I accidentally added them so I deleted them...

@AlanGriffiths
Copy link
Contributor

Hmm, that's weird. It seems that the code builds fine without them

Nothing weird about it. The Check runs --target check-mircommon-symbols-map, which isn't part of all.

The problem is that the script wrongly expects the std::hash symbols

@AlanGriffiths
Copy link
Contributor

Maybe the way forward is to inline the std::hash specialization (if it is inline it shouldn't be exporting symbols)

template<>
struct std::hash<mir::SharedLibrary::Handle>
{
    auto operator()(mir::SharedLibrary::Handle const& handle) const noexcept -> std::size_t
    {
// either
        return std::hash<void*>{}(handle.handle);
// or 
        return handle.hash(); // With a hash() implementation in `SharedLibrary::Handle`
    }
};

@AlanGriffiths
Copy link
Contributor

@tarek-y-ismail you should be able to test the symbols check with

MIR_SYMBOLS_MAP_GENERATOR_CLANG_SO_PATH=/usr/lib/llvm-18/lib/libclang-18.so.1 MIR_SYMBOLS_MAP_GENERATOR_CLANG_LIBRARY_PATH=/usr/lib/llvm-18/lib\
ninja -C build  check-mircommon-symbols-map

@tarek-y-ismail
Copy link
Contributor

you should be able to test the symbols check with

As I expected, the generator script still exports std::hash and the checking script still complains about it. Even though the project builds fine.

External Symbols Diff:

  New Symbols 🟢🟢🟢
    std::hash::operator*;
    typeinfo?for?std::hash;

  Deleted Symbols 🔻🔻🔻

Internal Symbols Diff:

@AlanGriffiths
Copy link
Contributor

As I expected, the generator script still exports std::hash and the checking script still complains about it. Even though the project builds fine.

yes, the script is doing the wrong thing. Which wouldn't matter if we didn't rely on it for symbols checking

@tarek-y-ismail tarek-y-ismail added this pull request to the merge queue Oct 8, 2024
Merged via the queue into main with commit ce7f4c6 Oct 8, 2024
25 of 26 checks passed
@tarek-y-ismail tarek-y-ismail deleted the MIRENG-653/platform-specific-options branch October 8, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants