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

Error on building agbcc ([Makefile:81: expr.o] Error 1) #69

Open
TheDarkSword opened this issue May 13, 2024 · 18 comments
Open

Error on building agbcc ([Makefile:81: expr.o] Error 1) #69

TheDarkSword opened this issue May 13, 2024 · 18 comments

Comments

@TheDarkSword
Copy link

Hello, I'm on Arch Linux (EndeavourOS distro). I installed with pacman all dependencies listed in the INSTALL.md but when i try to build agbcc it fail with:
make: *** [Makefile:81: expr.o] Error 1
make: exit from directory «/home/***/pokemon-emerald/agbcc/gcc»

Here full log file: https://pastebin.com/iWbB2jU0

The issue is similar to this

@mid-kid
Copy link
Member

mid-kid commented May 13, 2024

Try the following patch:

diff --git a/gcc/expr.h b/gcc/expr.h
index 466b4b1..e7f8f79 100755
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -356,7 +356,7 @@ typedef struct optab
 #define GEN_FCN(CODE) (*insn_gen_function[(int) (CODE)])
 #endif
 
-extern rtx (*const insn_gen_function[]) (rtx, ...);
+extern rtx (*const insn_gen_function[]) ();
 
 extern optab add_optab;
 extern optab sub_optab;

@TheDarkSword
Copy link
Author

TheDarkSword commented May 13, 2024

This resolve this issue. Thank you so much!

But there is another problem:
creating cache ./config.cache
checking LIBRARY_PATH variable... ok
checking GCC_EXEC_PREFIX variable... ok
checking host system type... i386-pc-linux-gnu
checking target system type... arm-unknown-elf
checking build system type... i386-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler (gcc ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
mv: cannot stat 'gcc_arm/cc1': No such file or directory

The build stop here

@mid-kid
Copy link
Member

mid-kid commented May 13, 2024

Fix the same thing in gcc_arm/expr.h

@TheDarkSword
Copy link
Author

TheDarkSword commented May 13, 2024

I did, but the error still the same (even with a fresh git clone and modifying these files)

@mid-kid
Copy link
Member

mid-kid commented May 13, 2024

Re-clone the repository and try this patch: https://cdn.discordapp.com/attachments/528962845648355353/1239686241608405032/0001-Fix-building-with-GCC-14-and-Clang-16.patch?ex=6643d348&is=664281c8&hm=9aad9e12c32045ddebad4eac7a7e71603ece43e89683cf48fcc1eb0e1dd22d2e&

The underlying issue is that GCC 14 broke a bunch of things but nobody has this version of the compiler yet, so if this still doesn't work, I encourage you to either downgrade GCC or try a different distribution until some of us have had time to get this new version and fix it.

@TheDarkSword
Copy link
Author

TheDarkSword commented May 13, 2024

Ok I will try, thank you very much. But Why gcc 14 broke all?

@mid-kid
Copy link
Member

mid-kid commented May 13, 2024

I don't know why, exactly, but the gcc 14 update enables some -Werror flags by default, refusing to compile older code.

@superluserdo
Copy link

@mid-kid I just got into trying out pokemon decomp and ran into this exact issue, to find that you had posted a patch 3 minutes ago! After applying this patch and fixing a couple of seemingly separate problems in the agbcc configure scripts I've successfully built a working sapphire ROM. Thanks! (gcc version 14.1.1 20240507).

@mid-kid
Copy link
Member

mid-kid commented May 13, 2024

What separate problems?

@superluserdo
Copy link

Sorry, I was about to write an issue but realised that the configure script problems were introduced by the patch itself, they weren't separate.

1: In gcc_arm, the patch introduces an error fallthrough case for the switch statement for $machine:

@@ -2905,6 +2909,11 @@ for machine in $build $host $target; do
                tmake_file=arm/t-thumb-elf
                fixincludes=Makefile.in # There is nothing to fix
                ;;
+
+       *)
+               echo "Configuration $machine not supported" 1>&2
+               exit 1
+               ;;
        esac

This is a separate case statement to the check for *-*-linux-gnu*, so a machine of this type will give an error. Either removing the error fallthrough or combining the switch statements fixes this.

2: By commenting out the body of the if statement here:

@@ -3445,12 +3455,12 @@ fi

 # If we have ld in the build tree, make a link to it.
 if test -f ../ld/Makefile; then
-       rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null
+#      rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null
 fi

The if statement fails to parse. Commenting out the whole if statement works.

My changes fixed the above patch on my machine:

index c350e76..9e64093 100755
--- a/gcc_arm/configure
+++ b/gcc_arm/configure
@@ -2892,9 +2892,7 @@ for machine in $build $host $target; do
        *-*-linux-gnu*)
                xm_defines="HAVE_ATEXIT POSIX BSTRING"
                ;;
-       esac

-       case $machine in
        # Support site-specific machine types.
        arm*-*-elf)
                tm_file=arm/unknown-elf.h
@@ -3454,9 +3452,9 @@ if test -f ../binutils/Makefile; then
 fi

 # If we have ld in the build tree, make a link to it.
-if test -f ../ld/Makefile; then
+#if test -f ../ld/Makefile; then
 #      rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null
-fi
+#fi

 # Figure out what assembler alignment features are present.
 echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6

@GiantBlargg
Copy link

@mid-kid Could you provide another source for that patch? The link seems to have timed out.

@mid-kid
Copy link
Member

mid-kid commented May 16, 2024

0001-Fix-building-with-GCC-14-and-Clang-16.patch

@danieltanfh95
Copy link

agbcc compiled on macos shows the following error at the end:

Configuration i386-pc-linux-gnu not supported
mv: rename gcc_arm/cc1 to agbcc_arm: No such file or directory

@danieltanfh95
Copy link

can confirm that @superluserdo's fix works, patch file attached
agbcc-8-23-02 PM.patch

@miamilabs
Copy link

This resolve this issue. Thank you so much!

But there is another problem: creating cache ./config.cache checking LIBRARY_PATH variable... ok checking GCC_EXEC_PREFIX variable... ok checking host system type... i386-pc-linux-gnu checking target system type... arm-unknown-elf checking build system type... i386-pc-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc ) works... no configure: error: installation or configuration problem: C compiler cannot create executables. mv: cannot stat 'gcc_arm/cc1': No such file or directory

The build stop here

Did you find a fix for your error?
I run into same problem on macbook m2.

checking for gcc... gcc
checking whether the C compiler (gcc  ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
mv: rename gcc_arm/cc1 to agbcc_arm: No such file or directory

@danieltanfh95
Copy link

@miamilabs did you apply the patch i linked above?

@miamilabs
Copy link

@miamilabs did you apply the patch i linked above?

I did apply both patches so this was the reason why it still did not work.
After reset and your patch, everything worked like a charm.

Thank you for the effort and sharing

@danieltanfh95
Copy link

@miamilabs did you apply the patch i linked above?

I did apply both patches so this was the reason why it still did not work. After reset and your patch, everything worked like a charm.

Thank you for the effort and sharing

Yes, only one final patch is needed.

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

6 participants