[PING 2][PATCH v3] Add pretty printers for the NPTL lock types
Martin Galvan
martin.galvan@tallertechnologies.com
Mon Mar 21 15:05:00 GMT 2016
Hi again everyone,
I'm having some trouble when running 'make check' after placing the
pretty printers in their own directory. The Makefile looks like this:
subdir := pretty-printers
include ../Makeconfig
PYTHON := python
tests-pretty-printers := test-mutex-attributes test-mutex-printer \
test-condvar-attributes test-condvar-printer \
test-rwlock-attributes test-rwlock-printer
test-srcs := $(tests-pretty-printers)
CFLAGS-test-mutex-attributes.c := -O0 -ggdb3 -pthread
CFLAGS-test-mutex-printer.c := -O0 -ggdb3 -pthread
CFLAGS-test-condvar-attributes.c := -O0 -ggdb3 -pthread
CFLAGS-test-condvar-printer.c := -O0 -ggdb3 -pthread
CFLAGS-test-rwlock-attributes.c := -O0 -ggdb3 -pthread
CFLAGS-test-rwlock-printer.c := -O0 -ggdb3 -pthread
tests-pretty-printers-dest := $(addprefix $(objpfx), $(tests-pretty-printers))
tests-pretty-printers-pp := $(addsuffix -pp, $(tests-pretty-printers-dest))
ifeq ($(run-built-tests), yes)
tests-special += $(tests-pretty-printers-pp)
endif
include ../Rules
$(tests-pretty-printers-pp): $(objpfx)%-pp: $(objpfx)% %.py test_common.py
$(test-wrapper-env) $(PYTHON) $*.py $*.c $(objpfx)$*; \
$(evaluate-test)
I added the 'pretty-printers' subdir to the 'all-subdirs' variable in
Makeconfig. Whenever I run 'make check', however, I get the following
error:
make[2]: Entering directory `/home/martin/glibc/source/pretty-printers'
gcc test-mutex-attributes.c -c -std=gnu11 -fgnu89-inline
-fno-stack-protector -O2 -Wall -Werror -Wundef -Wwrite-strings
-fmerge-all-constants -frounding-math -g -Wstrict-prototypes
-Wold-style-definition -O0 -ggdb3 -pthread -U_FORTIFY_SOURCE
-I../include -I/home/martin/glibc/build/pretty-printers
-I/home/martin/glibc/build -I../sysdeps/unix/sysv/linux/x86_64/64
-I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86
-I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/x86_64/nptl
-I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
-I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu
-I../sysdeps/unix/inet -I../sysdeps/unix/sysv
-I../sysdeps/unix/x86_64 -I../sysdeps/unix -I../sysdeps/posix
-I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch
-I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu/include
-I../sysdeps/x86/fpu -I../sysdeps/x86_64/multiarch
-I../sysdeps/x86_64 -I../sysdeps/x86 -I../sysdeps/ieee754/ldbl-96
-I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64
-I../sysdeps/ieee754/flt-32 -I../sysdeps/wordsize-64
-I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I.
-D_LIBC_REENTRANT -include /home/martin/glibc/build/libc-modules.h
-DMODULE_NAME=nonlib -include ../include/libc-symbols.h -o
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o -MD
-MP -MF /home/martin/glibc/build/pretty-printers/test-mutex-attributes.o.dt
-MT /home/martin/glibc/build/pretty-printers/test-mutex-attributes.o
In file included from ./../include/libc-symbols.h:58:0,
from <command-line>:0:
/home/martin/glibc/build/config.h:4:3: error: #error "glibc cannot be
compiled without optimization"
# error "glibc cannot be compiled without optimization"
^
Removing the "-O0" from CFLAGS-* in turn gives me the following error
when linking:
gcc -nostdlib -nostartfiles -o
/home/martin/glibc/build/pretty-printers/test-mutex-attributes
-Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both
/home/martin/glibc/build/csu/crt1.o
/home/martin/glibc/build/csu/crti.o `gcc
--print-file-name=crtbegin.o`
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o
-Wl,-dynamic-linker=/home/martin/glibc/install/lib/ld-linux-x86-64.so.2
-Wl,-rpath-link=/home/martin/glibc/build:/home/martin/glibc/build/math:/home/martin/glibc/build/elf:/home/martin/glibc/build/dlfcn:/home/martin/glibc/build/nss:/home/martin/glibc/build/nis:/home/martin/glibc/build/rt:/home/martin/glibc/build/resolv:/home/martin/glibc/build/crypt:/home/martin/glibc/build/mathvec:/home/martin/glibc/build/nptl
/home/martin/glibc/build/libc.so.6
/home/martin/glibc/build/libc_nonshared.a -Wl,--as-needed
/home/martin/glibc/build/elf/ld.so -Wl,--no-as-needed -lgcc
-Wl,--as-needed -lgcc_s -Wl,--no-as-needed `gcc
--print-file-name=crtend.o` /home/martin/glibc/build/csu/crtn.o
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o: In
function `main':
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:42:
undefined reference to `pthread_mutexattr_init'
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o: In
function `test_settype':
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:73:
undefined reference to `pthread_mutexattr_settype'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:75:
undefined reference to `pthread_mutexattr_settype'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:77:
undefined reference to `pthread_mutexattr_settype'
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o: In
function `test_setrobust':
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:90:
undefined reference to `pthread_mutexattr_setrobust'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:92:
undefined reference to `pthread_mutexattr_setrobust'
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o: In
function `test_setpshared':
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:105:
undefined reference to `pthread_mutexattr_setpshared'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:107:
undefined reference to `pthread_mutexattr_setpshared'
/home/martin/glibc/build/pretty-printers/test-mutex-attributes.o: In
function `test_setprotocol':
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:122:
undefined reference to `pthread_mutexattr_setprotocol'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:124:
undefined reference to `pthread_mutexattr_setprotocol'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:126:
undefined reference to `pthread_mutex_setprioceiling'
/home/martin/glibc/source/pretty-printers/test-mutex-attributes.c:127:
undefined reference to `pthread_mutexattr_setprotocol'
collect2: error: ld returned 1 exit status
I know these two issues are probably unrelated to each other. However,
the weird thing here is that I had that exact same Makefile lines in
the NPTL Makefile, and there it always worked. Can anyone tell me what
exactly should I write in the new Makefile to make this work?
The alternative is to keep the printers in the NPTL subdir (which is
the only place they'll be used in anyway, at least for now), and solve
these issues in a future patch.
More information about the Libc-alpha
mailing list