Re: [Flex-help] Error in most testsuite Makefile.am files
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Aaron S. <aa...@se...> - 2008-03-14 07:32:25
|
For completeness sake, though, it is certainly necessary to provide the library, and ensure it builds correctly when various flags are tossed around in the environment. Aaron On Mar 13, 2008, at 10:13 PM, Aaron Jackson wrote: > I went through this process a few months ago and ran into the same > problem: the -m64 flag was not properly being passed throughout the > build. However, after fooling around with the build, I realized that > there is really no reason to have a 64 bit version of flex. The > only function in the flex library is the default main, so you never > really have to link to it. > > On Mar 13, 2008, at 9:52 PM, Dennis Clarke wrote: > >> >> I was in the process of building a 64-bit toolchain on Solaris 10 >> with AMD >> Opteron processors and the build of flex 2.5.35 seems to be fine : >> >> bash-3.2$ ./flex --version >> flex 2.5.35 >> >> bash-3.2$ file ./flex >> ./flex: ELF 64-bit LSB executable AMD64 Version 1 [SSE2 SSE FXSR >> CMOV FPU], >> dynamically linked, not stripped >> >> However when I run "make check" almost every test fails. I tested >> with a >> 32-bit build on the same machine and I get a perfect build with a >> perfect >> set of test results. Or at least, nearly perfect. >> >> The issue, as it turns out, seems to be the absence of the correct >> $CFLAGS >> in the Makefile.am files for the various test. >> >> Consider the first test in ./tests/test-lineno-nr where I see the >> following >> test OUTPUT : >> >> make[5]: Entering directory >> `/opt/build/dclarke/build/first/flex-2.5.35/tests/test-lineno-nr' >> ../../flex scanner.l >> cc -c -o scanner.o -I. -I../.. -I../.. -I/opt/build/dclarke/local/ >> include >> -erroff=%all -fsimple=0 -g -m64 -xO1 -Qy -Xa -xbuiltin=%none >> -xdebugformat=dwarf -xmodel=medium -xnolibmil -xnolibmopt -xregs=no% >> frameptr >> -xs -xstrconst -xtarget=opteron -xtemp=/tmp/dclarke scanner.c >> cc -o test-lineno-nr scanner.o >> ld: fatal: file scanner.o: wrong ELF class: ELFCLASS64 >> ld: fatal: File processing errors. No output written to test- >> lineno-nr >> make[5]: *** [test-lineno-nr] Error 1 >> make[5]: Leaving directory >> `/opt/build/dclarke/build/first/flex-2.5.35/tests/test-lineno-nr' >> >> >> Notice the distint "wrong ELF class: ELFCLASS64" which points to a >> mismatch >> in the ld linking stage. >> >> With scanner.o we see a correct object file : >> >> bash-3.2$ file scanner.o >> scanner.o: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE CMOV] >> >> If I link manually then I get a correct output binary : >> >> bash-3.2$ file test-lineno-nr >> test-lineno-nr: ELF 64-bit LSB executable AMD64 Version 1 [SSE FXSR >> CMOV >> FPU], dynamically linked, not stripped >> >> Which seems to do what it should : >> >> bash-3.2$ ./test-lineno-nr < test.input >> 20 >> >> So there appears to be a $CFLAGS missing from the linking stage of >> Makefile.am : >> >> FLEX = $(top_builddir)/flex >> >> EXTRA_DIST = scanner.l test.input >> CLEANFILES = scanner.c $(testname)$(EXEEXT) OUTPUT $(OBJS) >> OBJS = scanner.o >> >> AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) >> >> testname = test-lineno-nr >> >> scanner.c: $(srcdir)/scanner.l >> $(FLEX) $(LFLAGS) $< >> >> >> $(testname)$(EXEEXT): $(OBJS) >> $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) >> >> test: $(testname)$(EXEEXT) >> test `./$(testname)$(EXEEXT) < $(srcdir)/test.input` -eq \ >> `./$(testname)$(EXEEXT) 1 < $(srcdir)/test.input` || >> exit 1 >> >> .c.o: >> $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< >> >> >> Somewhere in there .. is the problem. Any thoughts ? >> >> Dennis Clarke >> >> --------------------------------------------------------------------- >> - >> --- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Flex-help mailing list >> Fle...@li... >> https://lists.sourceforge.net/lists/listinfo/flex-help >> > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Flex-help mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-help |