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

undefined reference to `yywrap' #21

Closed
mweinelt opened this issue May 26, 2019 · 6 comments
Closed

undefined reference to `yywrap' #21

mweinelt opened this issue May 26, 2019 · 6 comments

Comments

@mweinelt
Copy link

I've tried building pim6sd on another debian buster machine and it will not link, I'm not sure why. It works, when I try building it in a fresh debian:buster docker container.

  CCLD     pim6sd
/usr/bin/ld: pim6sd-cftoken.o: in function `yylex':
/usr/src/pim6sd/src/cftoken.c:2390: undefined reference to `yywrap'
collect2: error: ld returned 1 exit status

I have installed

  • build-essential
  • autoreconf
  • flex
  • bison
autogen.sh
# ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=portability 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force --warnings=portability
autoreconf: running: /usr/bin/autoheader --force --warnings=portability
autoreconf: running: automake --add-missing --force-missing --warnings=portability
configure.ac:14: installing './compile'
configure.ac:4: installing './install-sh'
configure.ac:4: installing './missing'
src/Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
autoreconf: no config.status: cannot re-make
autoreconf: Leaving directory `.'
configure
# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for bison... bison -y
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for main in -lfl... no
checking for main in -ll... no
checking for main in -ly... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/queue.h... yes
checking for netinet/in.h... (cached) yes
checking for net/if.h... yes
checking for net/if_var.h... no
checking for netinet6/in6_var.h... no
checking for sys/types.h... (cached) yes
checking for netinet6/pim6.h... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for ANSI C header files... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking return type of signal handlers... void
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for ANSI C header files... (cached) yes
checking for fcntl.h... (cached) yes
checking for paths.h... (cached) yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for sys/file.h... (cached) yes
checking for sys/ioctl.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for syslog.h... (cached) yes
checking for unistd.h... (cached) yes
checking if you have struct mld_hdr in your system... yes
checking for bzero... yes
checking for dup2... yes
checking for gettimeofday... yes
checking for isascii... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strrchr... yes
checking for strncpy... yes
checking for strlcpy... no
checking for strlcat... no
checking if you have a length field in struct sockaddr*... no
checking if you enabled router-side mldv2... yes
checking if you enabled host-side mldv2... no
checking userland-kernel interface for routing information... netlink
checking for inet6_opt_init in -lc... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating man/Makefile
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating include/config.h
config.status: executing depfiles commands

------------------ Summary ------------------
 pim6sd version 2.1.0-beta1
  Prefix................: /usr/local
  Sysconfdir............: /usr/local/etc
  Localstatedir.........: /usr/local/var
  C Compiler............: gcc -g -O2   -ly 

Optional features:
  Router-side MLDv2.....: yes
  Host-side MLDv2.......: no

------------- Compiler version --------------
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
---------------------------------------------

Check the above options and compile with:
 make
make
# make -j4
Making all in include
make[1]: Entering directory '/usr/src/pim6sd/include'
make  all-am
make[2]: Entering directory '/usr/src/pim6sd/include'
make[2]: Leaving directory '/usr/src/pim6sd/include'
make[1]: Leaving directory '/usr/src/pim6sd/include'
Making all in src
make[1]: Entering directory '/usr/src/pim6sd/src'
  YACC     cfparse.c
updating cfparse.h
make  all-am
make[2]: Entering directory '/usr/src/pim6sd/src'
  CC       pim6sd-callout.o
  LEX      cftoken.c
  CC       pim6sd-cfparse.o
  CC       pim6sd-config.o
  CC       pim6sd-crc.o
  CC       pim6sd-debug.o
  CC       pim6sd-inet6.o
  CC       pim6sd-kern.o
  CC       pim6sd-main.o
  CC       pim6sd-mld6.o
  CC       pim6sd-mld6_proto.o
  CC       pim6sd-mld6v2.o
  CC       pim6sd-mld6v2_proto.o
  CC       pim6sd-mrt.o
  CC       pim6sd-netlink.o
  CC       pim6sd-routesock.o
  CC       pim6sd-pim6.o
  CC       pim6sd-pim6_proto.o
  CC       pim6sd-route.o
  CC       pim6sd-rp.o
  CC       pim6sd-timer.o
  CC       pim6sd-trace.o
  CC       pim6sd-vif.o
  CC       pim6sd-cftoken.o
  CC       ../lib/strlcpy.o
  CC       ../lib/strlcat.o
  CCLD     pim6sd
/usr/bin/ld: pim6sd-cftoken.o: in function `yylex':
/usr/src/pim6sd/src/cftoken.c:2390: undefined reference to `yywrap'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:456: pim6sd] Error 1
make[2]: Leaving directory '/usr/src/pim6sd/src'
make[1]: *** [Makefile:370: all] Error 2
make[1]: Leaving directory '/usr/src/pim6sd/src'
make: *** [Makefile:397: all-recursive] Error 1
@troglobit
Copy link
Owner

troglobit commented May 26, 2019

That's odd, have you tried a make distclean?

(Edit: I've fired up my Debian workstation and started upgrading it to the latest Buster. I'll see if I can reproduce and pinpoint the issue.)

@mweinelt
Copy link
Author

Not even after make distclean.

root@router:/usr/src/pim6sd# make distclean
Making distclean in include
make[1]: Entering directory '/usr/src/pim6sd/include'
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f config.h stamp-h1
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -f Makefile
make[1]: Leaving directory '/usr/src/pim6sd/include'
Making distclean in src
make[1]: Entering directory '/usr/src/pim6sd/src'
test -z "pim6sd" || rm -f pim6sd
rm -f *.o
rm -f ../lib/strlcat.o
rm -f ../lib/strlcpy.o
rm -f *.tab.c
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f ../lib/.dirstamp
test -z "cftoken.c cfparse.c cfparse.h" || rm -f cftoken.c cfparse.c cfparse.h
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -f ../lib/.deps/strlcat.Po
rm -f ../lib/.deps/strlcpy.Po
rm -f ./.deps/pim6sd-callout.Po
rm -f ./.deps/pim6sd-cfparse.Po
rm -f ./.deps/pim6sd-cftoken.Po
rm -f ./.deps/pim6sd-config.Po
rm -f ./.deps/pim6sd-crc.Po
rm -f ./.deps/pim6sd-debug.Po
rm -f ./.deps/pim6sd-inet6.Po
rm -f ./.deps/pim6sd-kern.Po
rm -f ./.deps/pim6sd-main.Po
rm -f ./.deps/pim6sd-mld6.Po
rm -f ./.deps/pim6sd-mld6_proto.Po
rm -f ./.deps/pim6sd-mld6v2.Po
rm -f ./.deps/pim6sd-mld6v2_proto.Po
rm -f ./.deps/pim6sd-mrt.Po
rm -f ./.deps/pim6sd-netlink.Po
rm -f ./.deps/pim6sd-pim6.Po
rm -f ./.deps/pim6sd-pim6_proto.Po
rm -f ./.deps/pim6sd-route.Po
rm -f ./.deps/pim6sd-routesock.Po
rm -f ./.deps/pim6sd-rp.Po
rm -f ./.deps/pim6sd-timer.Po
rm -f ./.deps/pim6sd-trace.Po
rm -f ./.deps/pim6sd-vif.Po
rm -f Makefile
make[1]: Leaving directory '/usr/src/pim6sd/src'
Making distclean in man
make[1]: Entering directory '/usr/src/pim6sd/man'
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f Makefile
make[1]: Leaving directory '/usr/src/pim6sd/man'
make[1]: Entering directory '/usr/src/pim6sd'
test -z "" || rm -f 
test . = "." || test -z "" || rm -f 
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -f cscope.out cscope.in.out cscope.po.out cscope.files
make[1]: Leaving directory '/usr/src/pim6sd'
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -f Makefile
(reverse-i-search)`make -j': ^Cke -j$(nproc)
root@router:/usr/src/pim6sd# ./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=portability 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force --warnings=portability
autoreconf: running: /usr/bin/autoheader --force --warnings=portability
autoreconf: running: automake --add-missing --force-missing --warnings=portability
autoreconf: no config.status: cannot re-make
autoreconf: Leaving directory `.'
root@router:/usr/src/pim6sd# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for bison... bison -y
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for main in -lfl... no
checking for main in -ll... no
checking for main in -ly... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking paths.h usability... yes
checking paths.h presence... yes
checking for paths.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/queue.h... yes
checking for netinet/in.h... (cached) yes
checking for net/if.h... yes
checking for net/if_var.h... no
checking for netinet6/in6_var.h... no
checking for sys/types.h... (cached) yes
checking for netinet6/pim6.h... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for ANSI C header files... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking return type of signal handlers... void
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for ANSI C header files... (cached) yes
checking for fcntl.h... (cached) yes
checking for paths.h... (cached) yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for sys/file.h... (cached) yes
checking for sys/ioctl.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for syslog.h... (cached) yes
checking for unistd.h... (cached) yes
checking if you have struct mld_hdr in your system... yes
checking for bzero... yes
checking for dup2... yes
checking for gettimeofday... yes
checking for isascii... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strrchr... yes
checking for strncpy... yes
checking for strlcpy... no
checking for strlcat... no
checking if you have a length field in struct sockaddr*... no
checking if you enabled router-side mldv2... yes
checking if you enabled host-side mldv2... no
checking userland-kernel interface for routing information... netlink
checking for inet6_opt_init in -lc... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating man/Makefile
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating include/config.h
config.status: executing depfiles commands

------------------ Summary ------------------
 pim6sd version 2.1.0-beta1
  Prefix................: /usr/local
  Sysconfdir............: /usr/local/etc
  Localstatedir.........: /usr/local/var
  C Compiler............: gcc -g -O2   -ly 

Optional features:
  Router-side MLDv2.....: yes
  Host-side MLDv2.......: no

------------- Compiler version --------------
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
---------------------------------------------

Check the above options and compile with:
 make

root@router:/usr/src/pim6sd# make
Making all in include
make[1]: Entering directory '/usr/src/pim6sd/include'
make  all-am
make[2]: Entering directory '/usr/src/pim6sd/include'
make[2]: Leaving directory '/usr/src/pim6sd/include'
make[1]: Leaving directory '/usr/src/pim6sd/include'
Making all in src
make[1]: Entering directory '/usr/src/pim6sd/src'
  YACC     cfparse.c
updating cfparse.h
make  all-am
make[2]: Entering directory '/usr/src/pim6sd/src'
  CC       pim6sd-callout.o
  LEX      cftoken.c
  CC       pim6sd-cftoken.o
  CC       pim6sd-cfparse.o
  CC       pim6sd-config.o
  CC       pim6sd-crc.o
  CC       pim6sd-debug.o
  CC       pim6sd-inet6.o
  CC       pim6sd-kern.o
  CC       pim6sd-main.o
  CC       pim6sd-mld6.o
  CC       pim6sd-mld6_proto.o
  CC       pim6sd-mld6v2.o
  CC       pim6sd-mld6v2_proto.o
  CC       pim6sd-mrt.o
  CC       pim6sd-netlink.o
  CC       pim6sd-routesock.o
  CC       pim6sd-pim6.o
  CC       pim6sd-pim6_proto.o
  CC       pim6sd-route.o
  CC       pim6sd-rp.o
  CC       pim6sd-timer.o
  CC       pim6sd-trace.o
  CC       pim6sd-vif.o
  CC       ../lib/strlcpy.o
  CC       ../lib/strlcat.o
  CCLD     pim6sd
/usr/bin/ld: pim6sd-cftoken.o: in function `yylex':
/usr/src/pim6sd/src/cftoken.c:2390: undefined reference to `yywrap'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:456: pim6sd] Error 1
make[2]: Leaving directory '/usr/src/pim6sd/src'
make[1]: *** [Makefile:370: all] Error 2
make[1]: Leaving directory '/usr/src/pim6sd/src'
make: *** [Makefile:397: all-recursive] Error 1

@troglobit
Copy link
Owner

Hmm, could you show me the output of make clean; make V=1?

Maybe you don't have libfl-dev installed ... it's the first time I notice this being installed on my systems.

@troglobit
Copy link
Owner

Ah, now I get it! I forget how old the pim6sd sources really are :-)

I'll see what I can do about adding %option noyywrap to the lexer. We only have one .conf file so that seems to be a good solution.

@mweinelt
Copy link
Author

Spot on, I was missing libfl-dev.

@troglobit
Copy link
Owner

The latest commit on master should fix the issue as well. Thank you for reporting this! :)

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

2 participants