3
2
make check issues
I was not able to run $ make check, see the terminal session below:
jnml@3900x:~/src/c9x.me/qbe$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
jnml@3900x:~/src/c9x.me/qbe$ git log -1
commit e493a7f23352f51acc0a1e12284ab19d7894488a (HEAD -> master,
origin/master, origin/HEAD)
Author: Alexey Yerin <yyp@disroot.org>
Date: Sun May 28 12:01:32 2023 +0300
Bump NString
jnml@3900x:~/src/c9x.me/qbe$ make clean check
rm -f *.o */*.o qbe
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c main.c -o main.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c util.c -o util.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c parse.c -o parse.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c abi.c -o abi.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c cfg.c -o cfg.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c mem.c -o mem.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c ssa.c -o ssa.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c alias.c -o alias.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c load.c -o load.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c copy.c -o copy.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c fold.c -o fold.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c simpl.c -o simpl.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c live.c -o live.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c spill.c -o spill.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c rega.c -o rega.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c emit.c -o emit.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/targ.c -o amd64/targ.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/sysv.c -o amd64/sysv.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/isel.c -o amd64/isel.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c amd64/emit.c -o amd64/emit.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/targ.c -o arm64/targ.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/abi.c -o arm64/abi.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/isel.c -o arm64/isel.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c arm64/emit.c -o arm64/emit.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/targ.c -o rv64/targ.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/abi.c -o rv64/abi.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/isel.c -o rv64/isel.o
c99 -std=c99 -g -Wall -Wextra -Wpedantic -c rv64/emit.c -o rv64/emit.o
c99 main.o util.o parse.o abi.o cfg.o mem.o ssa.o alias.o load.o
copy.o fold.o simpl.o live.o spill.o rega.o emit.o amd64/targ.o
amd64/sysv.o amd64/isel.o amd64/emit.o arm64/targ.o arm64/abi.o
arm64/isel.o arm64/emit.o rv64/targ.o rv64/abi.o rv64/isel.o
rv64/emit.o -o qbe
tools/test.sh all
tools/test.sh: 1: /home/jnml/src/c9x.me/qbe/tools: Permission denied
invalid test file /home/jnml/src/c9x.me/qbe/tools
make: *** [Makefile:71: check] Chyba 1
jnml@3900x:~/src/c9x.me/qbe$ git diff
diff --git a/tools/test.sh b/tools/test.sh
index 4412f61..319f84b 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -1,6 +1,6 @@
#!/bin/sh
- dir=`cd $(dirname "$0"); pwd`
+ dir=`dirname "$0"`
bin=$dir/../qbe
binref=$dir/../qbe.ref
jnml@3900x:~/src/c9x.me/qbe$ make check
tools/test.sh all
abi1.ssa... [ok]
abi2.ssa... [ok]
abi3.ssa... [ok]
abi4.ssa... [ok]
abi5.ssa... [ok]
abi6.ssa... [ok]
abi7.ssa... [ok]
abi8.ssa... [ok]
align.ssa... [ok]
cmp1.ssa... [ok]
collatz.ssa... [ok]
conaddr.ssa... [ok]
cprime.ssa... [ok]
cup.ssa... [ok]
dark.ssa... [ok]
double.ssa... [ok]
dynalloc.ssa... [ok]
echo.ssa... [ok]
env.ssa... [ok]
eucl.ssa... [ok]
euclc.ssa... [ok]
fixarg.ssa... [ok]
fold1.ssa... [ok]
fpcnv.ssa... [ok]
isel1.ssa... [ok]
isel2.ssa... [ok]
isel3.ssa... [ok]
ldbits.ssa... [ok]
ldhoist.ssa... [ok]
load1.ssa... [ok]
load2.ssa... [ok]
load3.ssa... [ok]
loop.ssa... [ok]
mandel.ssa... [ok]
max.ssa... [ok]
mem1.ssa... [ok]
mem2.ssa... [ok]
mem3.ssa... [ok]
philv.ssa... [ok]
prime.ssa... [ok]
puts10.ssa... [ok]
queen.ssa... [ok]
rega1.ssa... [ok]
spill1.ssa... [ok]
strcmp.ssa... [ok]
strspn.ssa... [ok]
sum.ssa... [ok]
tls.ssa... /usr/bin/ld:
/tmp/ccaHBrIA.o: in function `main':
/tmp/qbe.zzzz.s:40: undefined reference to `pthread_create'
/usr/bin/ld: /tmp/qbe.zzzz.s:43: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
[cc fail]
vararg1.ssa... [ok]
vararg2.ssa... [ok]
1 test(s) failed!
make: *** [Makefile:71: check] Chyba 1
jnml@3900x:~/src/c9x.me/qbe$ git diff
diff --git a/tools/test.sh b/tools/test.sh
index 4412f61..6e8df73 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -1,6 +1,6 @@
#!/bin/sh
- dir=`cd $(dirname "$0"); pwd`
+ dir=`dirname "$0"`
bin=$dir/../qbe
binref=$dir/../qbe.ref
@@ -154,7 +154,7 @@ once() {
src="$asm"
fi
- if ! $cc -g -o $exe $src
+ if ! $cc -g -o $exe $src -lpthread
then
echo "[cc fail]"
return 1
jnml@3900x:~/src/c9x.me/qbe$ make check
tools/test.sh all
abi1.ssa... [ok]
abi2.ssa... [ok]
abi3.ssa... [ok]
abi4.ssa... [ok]
abi5.ssa... [ok]
abi6.ssa... [ok]
abi7.ssa... [ok]
abi8.ssa... [ok]
align.ssa... [ok]
cmp1.ssa... [ok]
collatz.ssa... [ok]
conaddr.ssa... [ok]
cprime.ssa... [ok]
cup.ssa... [ok]
dark.ssa... [ok]
double.ssa... [ok]
dynalloc.ssa... [ok]
echo.ssa... [ok]
env.ssa... [ok]
eucl.ssa... [ok]
euclc.ssa... [ok]
fixarg.ssa... [ok]
fold1.ssa... [ok]
fpcnv.ssa... [ok]
isel1.ssa... [ok]
isel2.ssa... [ok]
isel3.ssa... [ok]
ldbits.ssa... [ok]
ldhoist.ssa... [ok]
load1.ssa... [ok]
load2.ssa... [ok]
load3.ssa... [ok]
loop.ssa... [ok]
mandel.ssa... [ok]
max.ssa... [ok]
mem1.ssa... [ok]
mem2.ssa... [ok]
mem3.ssa... [ok]
philv.ssa... [ok]
prime.ssa... [ok]
puts10.ssa... [ok]
queen.ssa... [ok]
rega1.ssa... [ok]
spill1.ssa... [ok]
strcmp.ssa... [ok]
strspn.ssa... [ok]
sum.ssa... [ok]
tls.ssa... [ok]
vararg1.ssa... [ok]
vararg2.ssa... [ok]
All is fine!
jnml@3900x:~/src/c9x.me/qbe$ uname -a
Linux 3900x 5.10.0-23-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12)
x86_64 GNU/Linux
jnml@3900x:~/src/c9x.me/qbe$
tl;dr: On Linux Devuan chimaera 4/x86_64 distro the 'check` Makefile
target runs only when this diff is applied:
jnml@3900x:~/src/c9x.me/qbe$ git diff
diff --git a/tools/test.sh b/tools/test.sh
index 4412f61..6e8df73 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -1,6 +1,6 @@
#!/bin/sh
- dir=`cd $(dirname "$0"); pwd`
+ dir=`dirname "$0"`
bin=$dir/../qbe
binref=$dir/../qbe.ref
@@ -154,7 +154,7 @@ once() {
src="$asm"
fi
- if ! $cc -g -o $exe $src
+ if ! $cc -g -o $exe $src -lpthread
then
echo "[cc fail]"
return 1
jnml@3900x:~/src/c9x.me/qbe$
I don't know if I have something wrong locally or if this is a bug in
test.sh. Please take a look, thanks.
- j
On Sun, Aug 13, 2023, at 13:52, Jan Mercl wrote:
> - if ! $cc -g -o $exe $src
> + if ! $cc -g -o $exe $src -lpthread
Could you check what the variable 'cc' is set to
at this point? I believe it should include -lpthread
already. Maybe the issue is that -lpthread must
come last.
Thank you for reporting the problem.
Thanks for replying!
On Fri, Aug 18, 2023 at 3:24 PM Quentin Carbonneaux <quentin@c9x.me > wrote:
>
> On Sun, Aug 13, 2023, at 13:52, Jan Mercl wrote:
> > - if ! $cc -g -o $exe $src
> > + if ! $cc -g -o $exe $src -lpthread
>
> Could you check what the variable 'cc' is set to
> at this point? I believe it should include -lpthread
> already.
On my system it seems to be not set.
0:jnml@e5-1650:~/tmp/musl$ echo $cc
0:jnml@e5-1650:~/tmp/musl$ echo $CC
0:jnml@e5-1650:~/tmp/musl$
> Maybe the issue is that -lpthread must
> come last.
Not sure about this but I think the -l<arg> libs are searched for any
referenced but not yet defined extern symbols only when that arg
appears in the list of inputs. So probably yes, it should come after
all pthred_* symbols were requested by preceding inputs (object
files).
-j
I pushed tentative fixes on the dev branch,
let me know if they work.