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

/usr/include/stdio.h:253: too many errors #31

Open
reb311ion opened this issue Feb 3, 2019 · 10 comments
Open

/usr/include/stdio.h:253: too many errors #31

reb311ion opened this issue Feb 3, 2019 · 10 comments

Comments

@reb311ion
Copy link

host info

Linux rebellion 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

running build.sh

/home/rebellion/tools/movfuscator-master/build/movcc -c -I. -I.. -o timesoftfloat.o -Wf--q timesoftfloat.c
timesoftfloat.c: /usr/include/stdlib.h:117: syntax error; found `__nptr' expecting `)'
timesoftfloat.c: /usr/include/stdlib.h:117: skipping `__nptr' `,'
timesoftfloat.c: /usr/include/stdlib.h:118: syntax error; found `char' expecting `{'
timesoftfloat.c: /usr/include/stdlib.h:118: redeclaration of `restrict' previously declared at /usr/include/stdlib.h:117
timesoftfloat.c: /usr/include/stdlib.h:118: syntax error; found `__endptr' expecting `;'
timesoftfloat.c: /usr/include/stdlib.h:118: undeclared identifier `__endptr'
timesoftfloat.c: /usr/include/stdlib.h:118: warning: expression with no effect elided
timesoftfloat.c: /usr/include/stdlib.h:118: syntax error; found `)' expecting `;'
timesoftfloat.c: /usr/include/stdlib.h:118: illegal statement termination
timesoftfloat.c: /usr/include/stdlib.h:118: skipping `)'
timesoftfloat.c: /usr/include/stdlib.h:123: illegal statement termination
timesoftfloat.c: /usr/include/stdlib.h:123: skipping `extern' `float'
timesoftfloat.c: /usr/include/stdlib.h:123: illegal expression
timesoftfloat.c: /usr/include/stdlib.h:123: syntax error; found `char' expecting `)'
timesoftfloat.c: /usr/include/stdlib.h:123: syntax error; found `char' expecting `;'
timesoftfloat.c: /usr/include/stdlib.h:123: illegal statement termination
timesoftfloat.c: /usr/include/stdlib.h:123: skipping `char'
timesoftfloat.c: /usr/include/stdlib.h:123: warning: expression with no effect elided
timesoftfloat.c: /usr/include/stdlib.h:123: syntax error; found `__nptr' expecting `;'
timesoftfloat.c: /usr/include/stdlib.h:123: undeclared identifier `__nptr'
timesoftfloat.c: /usr/include/stdlib.h:124: illegal expression
timesoftfloat.c: /usr/include/stdlib.h:124: operands of * have illegal types `int' and `pointer to char'
timesoftfloat.c: /usr/include/stdlib.h:124: warning: expression with no effect elided
timesoftfloat.c: /usr/include/stdlib.h:124: warning: expression with no effect elided
timesoftfloat.c: /usr/include/stdlib.h:124: too many errors
Makefile:21: recipe for target 'timesoftfloat.o' failed
make: *** [timesoftfloat.o] Error 1
make: Leaving directory '/home/rebellion/tools/movfuscator-master/softfloat'
@easyaspi314
Copy link

easyaspi314 commented Mar 9, 2019

This is because of __restrict not being accepted by lcc. Defining it to empty fixes the issue.

@fubuki8087
Copy link

This is because of __restrict not being accepted by lcc. Defining it to empty fixes the issue.

Could you please introduce the steps more detail? I don't know how to operate. Thanks!

@easyaspi314
Copy link

diff --git a/etc/linux.c b/etc/linux.c
index 5df6059..e9e4a82 100755
--- a/etc/linux.c
+++ b/etc/linux.c
@@ -12,23 +12,23 @@ char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
 char inputs[256] = "";
 char *cpp[] = { LCCDIR "gcc/cpp",
        "-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
-       "-Dunix", "-Di386", "-Dlinux",
+       "-Dunix", "-Di386", "-Dlinux", "-D__restrict=", "-std=c89", "-Drestrict=",
        "-D__unix__", "-D__i386__", "-D__linux__", "-D__signed__=signed",
        "$1", "$2", "$3", 0 };
 char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include", 0 };

You have to modify the build.sh to keep it from resetting lcc.

diff --git a/build.sh b/build.sh
index a5daed1..a38669c 100755
--- a/build.sh
+++ b/build.sh
@@ -3,8 +3,8 @@
 set -v
 
 # grab the frontend
[ ! -d "lcc" ] && git clone https://github.com/drh/lcc
-cd lcc && git reset --hard 3b3f01b4103cd7b519ae84bd1122c9b03233e687 && cd -
+# cd lcc && git reset --hard 3b3f01b4103cd7b519ae84bd1122c9b03233e687 && cd -
 
 # create a build directory
 export BUILDDIR=`pwd`/build

@fubuki8087
Copy link

I've tried to operate as you said, but the problem still exists. However, when I use movcc to compile my source file by manually adding parameter -D__restrict= and -Drestrict=, it can works.

@easyaspi314
Copy link

diff --git a/etc/lcc.c b/etc/lcc.c
index 95b621a..04a80c3 100755
--- a/etc/lcc.c
+++ b/etc/lcc.c
@@ -100,6 +100,8 @@ main(int argc, char *argv[]) {
                exit(0);
        }
        plist = append("-D__LCC__", 0);
+       plist = append("-D__restrict=", 0);
+       plist = append("-Drestrict=", 0);
        initinputs();
        if (getenv("LCCDIR"))
                option(stringf("-lccdir=%s", getenv("LCCDIR")));

@fubuki8087
Copy link

OK, it works! Thank you very much!

@MrAureliusR
Copy link

MrAureliusR commented Apr 13, 2019

Having this error still. After issue #19 was resolved, if I follow the steps here to fix this error, any binary built with movcc segfaults. Before #19 was fixed, I could follow the steps here and get a working compiler, but I just couldn't use --no-mov-flow. Now, even when not using --no-mov-flow, I'm just getting segfaults with anything I try and compile.

@fionafibration
Copy link

I've tried to fix this, but I can't find the files for the DIFF you're referencing.

@MrAureliusR
Copy link

MrAureliusR commented Apr 16, 2019

@ThePlasmaRailgun They are in the lcc/ subfolder, except for build.sh which is in the top folder.

@fionafibration
Copy link

Ok, I found them, they're in movfuscator/lcc/etc/lcc.c for anyone else looking for them.

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

5 participants