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

Fix shared hermetic builds on Arch linux #33153

Merged

Conversation

azat
Copy link
Collaborator

@azat azat commented Dec 24, 2021

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

On Arch linux clang uses PIE by default, and so it requires Scrt1.o:

$ /usr/bin/clang++ --target=x86_64-linux-gnu --sysroot=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc --gcc-toolchain=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64 --gcc-toolchain=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64 -std=c++20 ... -o base/base/tests/dump_variable ...
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/ld.lld" --sysroot=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc -pie -export-dynamic --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o base/base/tests/dump_variable Scrt1.o ...
         ^^^^^^^

Cc: @Algunenano
Follow-up for: #32731
Follow-up for: #32968
Refs: https://github.com/archlinux/svntogit-packages/blob/6e681aa860e65ad46a1387081482eb875c2200f2/trunk/enable-SSP-and-PIE-by-default.patch

On Arch linux clang uses PIE by default, and so it requires Scrt1.o:

    $ /usr/bin/clang++ --target=x86_64-linux-gnu --sysroot=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc --gcc-toolchain=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64 --gcc-toolchain=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64 -std=c++20 ... -o base/base/tests/dump_variable ...
    clang version 13.0.0
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    Found candidate GCC installation: /src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/lib/gcc/x86_64-linux-gnu/9
    Selected GCC installation: /src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/lib/gcc/x86_64-linux-gnu/9
    Candidate multilib: .;@m64
    Selected multilib: .;@m64
     "/usr/bin/ld.lld" --sysroot=/src/ch/clickhouse/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc -pie -export-dynamic --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o base/base/tests/dump_variable Scrt1.o ...
             ^^^^^^^
@robot-clickhouse robot-clickhouse added the pr-not-for-changelog This PR should not be mentioned in the changelog label Dec 24, 2021
@Algunenano
Copy link
Member

Would it make more sense to only enable it if hermetic builds are not off?

@alexey-milovidov alexey-milovidov self-assigned this Dec 25, 2021
@alexey-milovidov alexey-milovidov merged commit 0b6c1b5 into ClickHouse:master Dec 25, 2021
@azat
Copy link
Collaborator Author

azat commented Dec 25, 2021

Would it make more sense to only enable it if hermetic builds are not off?

I think that it is better to leave it as-is, to make it compatible with builds on other systems (who knows what may pops up)

@azat azat deleted the fix-shared-hermetic-build-pie branch December 25, 2021 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-not-for-changelog This PR should not be mentioned in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants