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

Meta: Pass compiler's builtin includes to jakt too #25573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alimpfard
Copy link
Member

This is not an issue with clang, but when gcc is used as the c++ compiler, jakt can't know its builtin include paths; so come up with a nice and hacky cmake blob to fix the problem.

Warning: hacky!

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Dec 22, 2024
@alimpfard alimpfard requested a review from BertalanD as a code owner December 25, 2024 00:37
@alimpfard alimpfard force-pushed the jakt-includes-macos branch 4 times, most recently from fbc32fc to 5ab284f Compare December 27, 2024 11:02
@BuggieBot
Copy link
Member

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.


# Get the builtin/system includes
# Equivalent to $CXX -E test.cpp |& sed -e '/^# 1 /p;d' | sed -e 's/# 1 "//;s/"[^"]*$//'
file(WRITE ${CMAKE_BINARY_DIR}/jakt_test.cpp "#include <new>")
Copy link
Member

@ADKaster ADKaster Dec 28, 2024

Choose a reason for hiding this comment

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

I mean, this works. But would it be easier to understand if it was a python script instead?

I'm scared of regexes :)

Also why are there two commands? Surely This is good enough?

$ ./Toolchain/Local/aarch64/bin/aarch64-pc-serenity-gcc  -xc++ -E -Wp,-v - < /dev/null
ignoring nonexistent directory "/Users/andrew/Source/serenity/Toolchain/../Build/aarch64/Root/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include/c++/13.2.0
 /Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include/c++/13.2.0/aarch64-pc-serenity
 /Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include/c++/13.2.0/backward
 /Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/include
 /Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/include-fixed
 /Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include
 /Users/andrew/Source/serenity/Toolchain/../Build/aarch64/Root/usr/include
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
got_dotdotdot = False
paths = []
for path.strip() in lines:
    if not got_dotdotdot:
        if path == "#include "..." search starts here:"
            got_dotdotdot = True
         continue
    if path ==  "#include <...> search starts here:"
        continue
    if path == "End of search list."
        break    
    paths.append(pathlib.Path(path.split(" ")[0]).resolve())

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Python'd

Copy link

stale bot commented Jan 19, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jan 19, 2025
Copy link

stale bot commented Jan 26, 2025

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

@stale stale bot closed this Jan 26, 2025
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jan 26, 2025
@alimpfard alimpfard reopened this Feb 13, 2025
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Feb 13, 2025
@stale stale bot removed the stale label Feb 13, 2025
This is not an issue with clang, but when gcc is used as the c++
compiler, jakt can't know its builtin include paths; so come up with a
nice and hacky cmake blob to fix the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 pr-needs-review PR needs review from a maintainer or community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants