Skip to content

Add glibc as a library#2119

Open
narpfel wants to merge 5 commits into
mainfrom
glibc-as-a-library
Open

Add glibc as a library#2119
narpfel wants to merge 5 commits into
mainfrom
glibc-as-a-library

Conversation

@narpfel
Copy link
Copy Markdown
Member

@narpfel narpfel commented May 11, 2026

I’m not quite sure how libraries work, so this only adds two versions of glibc as a test. If the build configuration works, I’d like to add more versions.

For compiler-explorer/compiler-explorer#3103.

@narpfel
Copy link
Copy Markdown
Member Author

narpfel commented May 11, 2026

Locally, this seems to produce a functioning installation of glibc, but I haven’t tested it thoroughly.

Also, I didn’t test on Ubuntu 22.04; there might be some differences to a more up-to-date system.

Comment thread bin/yaml/libraries.yaml Outdated
after_stage_script:
- mkdir -p build
- cd build
- '../{{untar_dir}}/configure --prefix=/opt/compiler-explorer/libs/glibc/glibc-{{name}}'
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

glibc hardcodes its prefix into the installed libraries, so an installation can’t be moved. Is this an issue for CE?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sort of, libraries get installed at /tmp/compiler-exp-etc-1245-25324-random/<libraryid> which is /app/<libraryid> under nsjail

It cannot be under /opt/compiler-explorer, the library build and usage process can't write files to that location.

So my suggestion would be --prefix=/app/glibc if we wanna go this route

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is this true for libraries that are installed via after_stage_script? I basically copied the openssl config here, and the shared libs for that seem to be installed to /opt/compiler-explorer/libs/openssl/...: https://godbolt.org/z/aThPj6ME5

	libssl.so.1.1 => /opt/compiler-explorer/libs/openssl/openssl_1_1_1g/x86_64/opt/lib/libssl.so.1.1 (0x00007f5a37800000)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah you're right. no, this works, forget what i said

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am wondering though if this will work with CEFS, possibly not. @mattgodbolt can you help

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it’s also possible to install into the staging dir and then let the usual installation logic handle putting it into the prefix, though I’d have to fiddle with the paths a bit more to make sure everything’s correct.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

With 7f4e2d5 glibc is installed into the staging_dir and ce_install handles moving it to /opt/compiler-explorer/libs/glibc/....

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.

2 participants