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

Unable to bootstrap due to corrupted libc.inc #141

Open
ChAoSUnItY opened this issue Jul 18, 2024 · 3 comments
Open

Unable to bootstrap due to corrupted libc.inc #141

ChAoSUnItY opened this issue Jul 18, 2024 · 3 comments

Comments

@ChAoSUnItY
Copy link
Collaborator

In the latest commit (cb34939), after using command make distclean config ARCH=arm then executes make to bootstrap, the process panicks about the corrupted libc.inc generated by tools/inliner.c. The generated corrupted libc.inc could be seen here.

Here's the sneak peek of the corrupted libc.inc, notice that this corruption is caused due to unmatched string double quotation mark:

/* Created by tools/inliner - DO NOT EDIT. */
void __c(char *src) {
    for (int i = 0; src[i]; i++)
        SOURCE[source_idx++] = src[i];
}
void libc_generate() {
  __c("/*
\n");
  __c(" * shecc - Self-Hosting and Educational C Compiler.
\n");
  __c(" *
\n");
  __c(" * shecc is freely redistributable under the BSD 2 clause license. See the
\n");
  __c(" * file \"LICENSE\" for information on usage and redistribution of this file.
\n");
  __c(" */
\n");
  __c("
\n");

I can only reproduce this result on current laptop's WSL2 but on previous desktop's WSL2.

@jserv
Copy link
Collaborator

jserv commented Jul 18, 2024

Can you check CR LF, LF and CR line break characters?

@ChAoSUnItY
Copy link
Collaborator Author

Yes, this is caused by setting of git which defaults line break characters to CR LF.

Maybe we can attempt to detect files' line break character and give proper warning message in the MAKEFILE?

@jserv
Copy link
Collaborator

jserv commented Jul 18, 2024

Yes, this is caused by setting of git which defaults line break characters to CR LF.
Maybe we can attempt to detect files' line break character and give proper warning message in the MAKEFILE?

For bootstrapping, stage0 is initially compiled with a standard compiler to generate a native executable. This compiler can then function as a cross-compiler, regardless of the operating system or computer architecture. It would be great if we can deal with CR/LF issue, allowing more toolchains such as MinGW-w64.

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

No branches or pull requests

2 participants