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

Avoid mixing GCC stage 1 content in final toolchain #36

Closed
wants to merge 3 commits into from

Conversation

fjtrujy
Copy link
Member

@fjtrujy fjtrujy commented May 28, 2024

Description

I was trying to compile https://github.com/google/googletest for PSP and I was facing some errors when finding the MAX_PATH macro.

In theory the content of MAX_PATH is in the limits.h header, coming from newlib, however, googletest even including limits.h wasn't finding the MAX_PATH variable.
This was happening because we had conflicts with headers.

pspdev/lib/gcc/psp/14.1.0/include/limits.h
pspdev/psp/include/limits.h

The very first one, was the file being used when compiling googletest, this file shouldn't exist in our toolchain, however, the file is installed afer compiling gcc stage 1.

This is why I have created this PR.
The main scope of this PR is to be sure that GCC stage 1 content is shipped to a temporal folder, trying to avoid mixing it with the final content.

Additionally, other minor changes have been made.

Maybe there is a cleaner and smarter way to do this, but I couldn't find anything better.

Cheers

@@ -52,7 +52,7 @@ fi
PROC_NR=$(getconf _NPROCESSORS_ONLN)

## Create and enter the toolchain/build directory
rm -rf build-$TARGET && mkdir build-$TARGET && cd build-$TARGET || { exit 1; }
Copy link
Member Author

Choose a reason for hiding this comment

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

All the exit 1 aren't longer needed as we have defined the onerr function

make --quiet -j $PROC_NR all || { exit 1; }
make --quiet -j $PROC_NR install-strip || { exit 1; }
make --quiet -j $PROC_NR clean || { exit 1; }
make --quiet -j $PROC_NR clean
Copy link
Member Author

Choose a reason for hiding this comment

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

Disabling the compilation of some libraries to try to speed up the stage 1

@fjtrujy fjtrujy marked this pull request as draft May 28, 2024 20:53
@sharkwouter
Copy link
Member

This does build, but I'll need to do more testing. I think I'll have to build from scratch to be able to properly test it so none of the old files from the stage 1 build will still be there.

@fjtrujy
Copy link
Member Author

fjtrujy commented May 29, 2024

This does build, but I'll need to do more testing. I think I'll have to build from scratch to be able to properly test it so none of the old files from the stage 1 build will still be there.

I have moved it to draft, as it is still generating the limits.h file which create the conflict :(

@davidgfnet
Copy link
Contributor

Allright! I tested it, and it seems that this PR does indeed generate a correct limits.h. It includes the "include_next" at the end, which properly includes newlib's limits.h, making the headers valid (hence including PATH_MAX).
Building stage1 out of tree is correct (buildroot and others also do that) but might (not sure!) not be strictly speaking necessary :)
Thanks for the PR! This was a good catch! I'm surprised we did not break any lib/port?

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.

3 participants