[petsc-dev] Need -lfl in c2html
Satish Balay
balay at mcs.anl.gov
Sun Feb 23 12:27:23 CST 2014
On Sun, 23 Feb 2014, Jed Brown wrote:
> Barry Smith <bsmith at mcs.anl.gov> writes:
>
> > On Feb 23, 2014, at 12:47 AM, Jed Brown <jed at jedbrown.org> wrote:
> >
> >> My configure on 'master' fails with the following. I need to link with
> >> -lfl to get the symbol yywrap. I don't know why we haven't been
> >> encountering this before.
> >
> > There was one user report of this a few weeks, but in all the
> > previous years I don’t recall this ever being an issue.
> >
> > I guess you better update maint.
>
> Testing on petsc-mini.mcs, c2html's configure automatically finds -ll
> (/usr/lib/libl.a) and there is no -lfl. We could check for existence of
> -lfl and pass in LEXLIB=-lfl if it works, but that could find a libfl
> floating around from a different lex implementation. This is really
> something c2html's configure should be working out, and when I look, it
> really tries (this is why we haven't seen the issue before):
c2html's configure automatically finds -lfl on fedora and ubuntu
>>>>>>>>>>>>>>>>>>
<fedora>
$ locate libfl.
/usr/lib64/libfl.a
<ubuntu>
(next) $ locate libfl.
/usr/lib/x86_64-linux-gnu/libfl.a
/usr/lib/x86_64-linux-gnu/libfl.so
$ nm -Ao /usr/lib/x86_64-linux-gnu/libfl.a
/usr/lib/x86_64-linux-gnu/libfl.a:libmain.o:0000000000000000 T main
/usr/lib/x86_64-linux-gnu/libfl.a:libmain.o: U yylex
/usr/lib/x86_64-linux-gnu/libfl.a:libyywrap.o:0000000000000000 T yywrap
$ cat /usr/lib/x86_64-linux-gnu/libfl.so
/* GNU ld script
* -*- Mode: C -*-
* libfl.so ---
* Author : Manoj Srivastava ( srivasta at golden-gryphon.com )
* Created On : Mon Sep 11 13:25:55 2006
* Created On Node : glaurung.internal.golden-gryphon.com
* Last Modified By : Manoj Srivastava
* Last Modified On : Tue Sep 12 03:34:30 2006
* Last Machine Used: glaurung.internal.golden-gryphon.com
* Update Count : 2
* Status : Unknown, Use with caution!
* HISTORY :
* Description :
*
* GNU ld script
* When shared linking is requested, map the request to the PIC static
* library, which is the closest we come to a shared library here.
*
* arch-tag: ce35efb4-3893-42c7-bdcb-56d95beba2ac
*/
INPUT( /usr/lib/x86_64-linux-gnu/libfl_pic.a )
<<<<<<<<<<<<<<<<<<<<<<<<<
So flex doesn't like .so files? Even the .so on ubuntu is a link to a static
file.
>
> configure:1829: checking for yywrap in -lfl
> configure:1856: gcc -o conftest -g -O2 conftest.c -lfl >&5
> /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
> configure:1859: $? = 1
> configure: failed program was:
> #line 1837 "configure"
> #include "confdefs.h"
>
> /* Override any gcc2 internal prototype to avoid an error. */
> #ifdef __cplusplus
> extern "C"
> #endif
> /* We use char because int might match the return type of a gcc2
> builtin and then its argument prototype would still apply. */
> char yywrap ();
> int main ()
> {
> yywrap ();
> return 0;
> }
> configure:1876: result: no
>
>
> Huh, what could be happening here:
>
> $ nm -D /usr/lib/libfl.so | grep yy
> U yylex
> 0000000000000740 T yywrap
>
>
> libfl.so defines main, which calls yylex(). We used to have a static
> library (libfl.a) in which case linking yywrap did not depend on a
> function called yylex (which is supposed to be defined outside
> libfl.so). This causes the normal AC_CHECK_LIB(fl, yylex) to fail.
$ make
flex ./c2html.l
gcc -O -I. -I. -DCOMPRESSION=1 -o c2html lex.yy.c ./mymain.c ./colors.c -lfl
<ok - try to get .o files for sources to do nm>
$ gcc -O -I. -I. -DCOMPRESSION=1 -c lex.yy.c ./mymain.c ./colors.c
$ nm -Ao c2html lex.yy.o mymain.o colors.o |grep yylex
c2html:0000000000401393 T yylex
c2html:0000000000404603 T yylex_destroy
lex.yy.o:0000000000000463 T yylex
lex.yy.o:00000000000036d3 T yylex_destroy
Perhaps the configure test needs to define a 'yylex' symbol in the test code.
But there must be a reason why fedora/ubuntu use only .a files [and
arch switching to .so is perhaps triggering this breakage]
Satish
> Now it doesn't delight me that c2html's configure script has been edited
> From the one generated by autoconf. I'll check with flex upstream to
> figure out what they intend to be used as a configure test now.
More information about the petsc-dev
mailing list