[Gluster-users] Gluster Compilation error: undefined reference to `yylex'

Kaleb S. KEITHLEY kkeithle at redhat.com
Wed May 4 17:44:44 UTC 2016


On 04/29/2016 06:01 AM, Rob Syme wrote:
> Hi all
> 
> When compiling Gluster, make fails with:
> ...
> Making all in src
>   CC       glusterfsd-mgmt.o
>   CC       glusterfsd.o
>   CCLD     glusterfsd
> /foo/bar/lib/libfl.so: undefined reference to `yylex'
> collect2: error: ld returned 1 exit status
> Makefile:509: recipe for target 'glusterfsd' failed
> make[3]: *** [glusterfsd] Error 1
> Makefile:456: recipe for target 'all-recursive' failed
> make[2]: *** [all-recursive] Error 1
> Makefile:588: recipe for target 'all-recursive' failed
> make[1]: *** [all-recursive] Error 1
> Makefile:487: recipe for target 'all' failed
> make: *** [all] Error 2
> 
> Even though the error is coming from flex, It seems that gluster should
> supply the yylex function by auto-generated code that is the result of
> calling lex on a '.l' file
> (https://www.mail-archive.com/tools-linking@mail.opensolaris.org/msg00601.html)

Take a look at .../libglusterfs/src/Makefile. You'll see that lex and
yacc (flex and bison) are run with -p graphyy, meaning that the lexical
analyzer and parser functions' names are graphyylex() and graphyyparse()
— both contained in libglusterfs.so.

This is standard practice when building yacc-and-lex-based parsers into
libraries; it allows an application to link with other libraries that
might also contain their own yacc-and-lex-based parsers.

I don't know what /foo/bar/lib/libfl.so is, or why it expects the
lexical analyzer to be named yylex(), but that's the crux of your
problem. You could try editing the .../glusterfsd/src/Makefile to remove
--quiet options and run `make V=1` in the .../glusterfsd/src directory
for more verbose output and that may provide better hints.  All our
linux, *BSD, and Mac boxes don't have a libfl.so and don't try to link
with it.

And perhaps if we knew what platform you're trying to build on we could
give you a better answer. (But if it's OpenSolaris, well, you're
probably pretty much on your own there.)



> 
> I'm using: flex v2.6.0, bison v3.0.4, pkg-config v0.29, liburcu v0.9.2,
> python v2.7.0, gcc v4.9.3 on linux (full dependency graph
> here: http://i.imgur.com/xdn8trW.png). Any pointers are appreciated.
> 
> -r
> 
> 
> _______________________________________________
> Gluster-users mailing list
> Gluster-users at gluster.org
> http://www.gluster.org/mailman/listinfo/gluster-users
> 

-- 

Kaleb


More information about the Gluster-users mailing list