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

compile error when building --with-unixodbc (libfl.so: undefined reference to `yylex') #47

Closed
okanisis opened this issue Feb 23, 2014 · 10 comments
Labels

Comments

@okanisis
Copy link

Is this a bison/flex issue?

Linux archasus 3.12.13-1-ck #1 SMP PREEMPT Sat Feb 22 18:08:42 EST 2014 x86_64 GNU/Linux
bison (GNU Bison) 3.0.2
flex 2.5.38
unixodbc 2.3.2

I've tried compiling using --with-unixodbc=/usr/include, --with-unixodbc=/usr/lib and just --with-unixodbc but they result in same error.

Making all in odbc
make[2]: Entering directory '/tmp/makepkg/mdbtools-git/src/mdbtools/src/odbc'
  CC       odbc.lo
  CC       connectparams.lo
  CCLD     libmdbodbc.la
  CC       libmdbodbcW_la-odbc.lo
  CC       libmdbodbcW_la-connectparams.lo
  CCLD     libmdbodbcW.la
  CC       unittest.o
  CCLD     unittest
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libfl.so: undefined reference to `yylex'
collect2: error: ld returned 1 exit status```
@nirgal
Copy link
Collaborator

nirgal commented Feb 24, 2014

On Debian, I'm using --with-unixodbc=/usr

libfl.so comes with flex.

Did you try running autoreconf -i -f then ./configure --with-unixodbc=/usr --disable-scrollkeeper ?

@okanisis
Copy link
Author

@nirgal Thanks for those, I made those changes now and it still gives me the flex error, but it looks nicer:

Making all in odbc
make[2]: Entering directory '/tmp/makepkg/mdbtools-git/src/mdbtools/src/odbc'
  CC       odbc.lo
  CC       connectparams.lo
  CCLD     libmdbodbc.la
  CC       libmdbodbcW_la-odbc.lo
  CC       libmdbodbcW_la-connectparams.lo
  CCLD     libmdbodbcW.la
  CC       unittest.o
  CCLD     unittest
/usr/lib/libfl.so: undefined reference to `yylex'
collect2: error: ld returned 1 exit status
Makefile:452: recipe for target 'unittest' failed
make[2]: *** [unittest] Error 1

@okanisis
Copy link
Author

FYI: I tried compiling against 0.7.1 and got the same error.

@enjolras
Copy link

Downgrading flex to 2.5.37 seems to work, per a comment in: https://aur.archlinux.org/packages/mdbtools/

@nirgal nirgal added the bug label Jul 24, 2014
@nirgal
Copy link
Collaborator

nirgal commented Oct 17, 2014

It looks like a common problem with flex:
http://sourceforge.net/p/flex/mailman/search/?q=undefined+reference+to+%60yylex%27

I can't reproduce the bug here, but it might be related to g++ compilation.

  • Can you add "--disable-silent-rules" to your configure line and post the log of the make here, please?
  • If this is indeed a c vs c++ compiler related problem, adding extern "C" block in the prototypes at the begining of src/sql/parser.y might help...

If downgrading flex fixes the issue helps, maybe this problem should be repported against flex?

@LukeShu
Copy link

LukeShu commented May 5, 2015

The correct solution is to remove all references to @LEXLIB@ from the Makefiles.

The references to @LEXLIB@ have been wrong since ChangeLog entry 2001-09-29 Brian Bruns <camber@ais.org> (which was imported from CVS to Git in ea8fd2a). Since then, it should not link against -lfl. The Makefiles were linking it against -lfl anyway, which until now apparently didn't mess anything up.

@adamcrown
Copy link

I'm getting this same error on Arch Linux. Any updates on this?

@nirgal
Copy link
Collaborator

nirgal commented Jul 2, 2015

LukeShu: I don't understand. The Makefile's no longer are part of the project, you need to use autoreconf -i. They were generated files anyway. There no longer is any -lfl in the code. It's only added by autoreconf.

Can you elaborate?

@LukeShu
Copy link

LukeShu commented Jul 5, 2015

Sorry I was unclear. By "Makefiles", I meant src/*/Makefile.am. The lex Autoconf macros automatically set @LEXLIB@ to the appropriate value for your system; with Flex that's -lfl. The Automake files include @LEXLIB@ in $LIBS even though they shouldn't.

Here's how the Parabola distro handles it: https://projects.parabola.nu/abslibre.git/tree/pcr/mdbtools/PKGBUILD#n26 (look at the prepare() function)

@adamcrown: Parabola is compatible with Arch; feel free to grab the binary or the PKGBUILD. I'll go ahead and add it to AUR4, but there's a solid chance that I'll forget to keep it up to date.

@evanmiller
Copy link
Contributor

Duplicate of #81, fix included in #162

MerlijnWajer added a commit to maemo-leste/libdres-ohm that referenced this issue Aug 8, 2021
With the flags in place, compilation fails with:

    Undefined reference to `yylex' in yyparse()

Also see mdbtools/mdbtools#47 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants