Open QuestionPython opened 6 years ago
I have the same problem:
make test output -> **./8cc -w -o test/builtin.o -c test/builtin.c ./8cc -w -o test/testmain.o -c test/testmain.c cc -o test/builtin.bin test/builtin.o test/testmain.o /usr/bin/ld: test/builtin.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Makefile:20: recipe for target 'test/builtin.bin' failed make: * [test/builtin.bin] Error 1 rm test/builtin.o test/testmain.o
This is what I get:
Ingwie@Ingwies-Macbook-Pro.local ~/W/g/8cc $ make
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o main.o main.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o cpp.o cpp.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o debug.o debug.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o dict.o dict.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o gen.o gen.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o lex.o lex.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o vector.o vector.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o parse.o parse.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o buffer.o buffer.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o map.o map.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o error.o error.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o path.o path.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o file.o file.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o set.o set.c
cc -Wall -Wno-strict-aliasing -std=gnu11 -g -I. -O0 -DBUILD_DIR='"/Users/Ingwie/Work/git/8cc"' -c -o encoding.o encoding.c
cc -o 8cc main.o cpp.o debug.o dict.o gen.o lex.o vector.o parse.o buffer.o map.o error.o path.o file.o set.o encoding.o
Ingwie@Ingwies-Macbook-Pro.local ~/W/g/8cc $ make test
./8cc -w -o test/align.o -c test/align.c
[ERROR] cpp.c:711: /Users/Ingwie/Work/Git/8cc/test/test.h:3:1: cannot find header file: stdio.h
make: *** [test/align.o] Error 1
Ingwie@Ingwies-Macbook-Pro.local ~/W/g/8cc $ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.3
BuildVersion: 18D42
@QuestionPython Your bug is for my C compiler, this is the wrong repository.
@QuestionPython Your bug is for my C compiler, this is the wrong repository.
This is the right repository (8cc) afaik and I get the same linker error when runnning 'make test':
rob@ubuntu-dev:~/Source/github/8cc$ make test
./8cc -w -o test/line.o -c test/line.c
./8cc -w -o test/testmain.o -c test/testmain.c
cc -o test/line.bin test/line.o test/testmain.o
./8cc -w -o test/decl.o -c test/decl.c
cc -o test/decl.bin test/decl.o test/testmain.o
./8cc -w -o test/assign.o -c test/assign.c
cc -o test/assign.bin test/assign.o test/testmain.o
./8cc -w -o test/oldstyle.o -c test/oldstyle.c
cc -o test/oldstyle.bin test/oldstyle.o test/testmain.o
./8cc -w -o test/struct.o -c test/struct.c
cc -o test/struct.bin test/struct.o test/testmain.o
./8cc -w -o test/control.o -c test/control.c
cc -o test/control.bin test/control.o test/testmain.o
/usr/bin/ld: test/control.o: relocation R_X86_64_32S against `.text' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:20: recipe for target 'test/control.bin' failed
make: *** [test/control.bin] Error 1
rm test/struct.o test/assign.o test/line.o test/control.o test/oldstyle.o test/decl.o test/testmain.o
I have this error on alpine.
$ make test
./8cc -w -o test/includeguard.o -c test/includeguard.c
[ERROR] parse.c:2196: /usr/include/bits/alltypes.h:6:27: ';' or ',' are expected, but got va_list
Makefile:17: recipe for target 'test/includeguard.o' failed
make: *** [test/includeguard.o] Error 1
This is my Dockerfile.
FROM alpine:3.3
RUN apk update
RUN apk add make
RUN apk add --no-cache gcc libc-dev
COPY ./ /home/working
WORKDIR /home/working/8cc
And this error happened on MacOS.
8cc git:(master) make test
./8cc -w -o test/align.o -c test/align.c
[ERROR] parse.c:2196: /usr/include/sys/cdefs.h:590:41: ';' or ',' are expected, but got __asm
make: *** [test/align.o] Error 1
guest@Base:~/Gits/c-andrewchambers$ make test