aMule Forum

English => Compilation problems => Topic started by: Nodsu on June 19, 2007, 05:18:43 PM

Title: flex issues
Post by: Nodsu on June 19, 2007, 05:18:43 PM
Seemingly, newer SVN versions do require newer versions of flex. Unofrtunately, configure doesn't reflect this and the LEX variable is not honoured in Makefile generation.

Attaching the fix for making the LEX variable work.
Title: Re: flex issues
Post by: skolnick on June 19, 2007, 11:08:03 PM
AFAIK, the new flex is not required. It's just suggested to have it, but nothing happens if you don't have it, aMule compiles fine. Atl least that has been my experience until SVN from May 15th 2007, no idea if something has changed in the flex area since that date.

Regards.
Title: Re: flex issues
Post by: Nodsu on June 20, 2007, 06:50:06 AM
If you compile yesterday's SVN, you get ./Scanner.l:191: error: `yylex_destroy' undeclared (first use th
is function)

I wouldn't complain or bother to do anything, if there were no problems ;)
Title: Re: flex issues
Post by: lfroen on June 20, 2007, 07:17:26 AM
Code: [Select]
-@GENERATE_FLEX_HEADER_TRUE@ $(LEX) --header-file=$(srcdir)/Scanner.h -o $@ $(srcdir)/Scanner.l
+@GENERATE_FLEX_HEADER_TRUE@ flex --header-file=$(srcdir)/Scanner.h -o $@ $(srcdir)/Scanner.l

I fail to see how this fixes anything. $LEX doesn't point on flex? You have 2 versions of lex installed? In any event, this patch is wrong. You must use $LEX and not "flex" for same reason, you using $CXX and not g++
Title: Re: flex issues
Post by: Kry on June 20, 2007, 12:47:59 PM
I bet he did the password in the wrong way, lfroen
Title: Re: flex issues
Post by: Nodsu on June 20, 2007, 01:33:06 PM
Uhm.. :blush: The patch is the wrong way around. "flex" is supposed to be replaced by $(LEX)
Title: Re: flex issues
Post by: lillesvamp on July 01, 2007, 11:14:01 AM
Patch or no patch, I still get the ./Scanner.l:191: error: 'yylex_destroy' was not declared in this scope
error.

OS X 10.4.10, aMule-CVS-20070701, wxMac 2.8.4, flex 2.5.4
Title: Re: flex issues
Post by: JusTiCe8 on July 01, 2007, 02:31:07 PM
Hi,

same error with today svn tarballs, Debian testing, i386, wx 2.8, flex 2.5.33-12 (same error with flex-old 2.5.4a-7 package, don't ask me why version number are such amazing, don't know)
Title: Re: flex issues
Post by: qwick on July 02, 2007, 11:59:24 PM
try setting the mtime for src/Parser.cpp to older than src/Scanner.cpp
or src/Scanner.cpp to newer than src/Parser.cpp
this will avoid regenerating src/Scanner.cpp,  src/Scanner.h

Between CVS tar balls 20070618 and 20070619 src/Parser.cpp was updated
causing its mtime to be newer than src/Scanner.cpp
(only the copyright comment was changed)

with flex that doesn't support --header-file the files src/Scanner.cpp,  src/Scanner.h
are regenerated incorrectly.
Title: Re: flex issues
Post by: JusTiCe8 on July 03, 2007, 10:47:16 AM
I have disable the line with missing sub call, compile is ok, and I use amule daemon with text client, it's work, and perhaps there is no link, but sometime a search lead to a crash of daemon, so it's quite good  ::) until a true fix.

here is a full bt just in case it help
Quote
#0  yylex () at Scanner.cpp:772
   yy_current_state = 38
   yy_cp = 0x0
   yy_bp = 0x0
   yy_act = 400
#1  0x082a1bdd in yyparse () at Parser.cpp:1273
   yysize = <value optimized out>
   yystate = 0
   yyn = <value optimized out>
   yyresult = <value optimized out>
   yyerrstatus = 0
   yytoken = 0
   yyssa = {0, -20559, -19812, 2066, 28019, 0, 16064, 2158, 6424, -20559, 5217, -22538, 10252, -22538,
     ... blah blah blah ...
2494, 32240, 2561, 18, 0, 6800, -20559, 100, 0, 0, 0}
   yyss = (yytype_int16 *) 0xafb118d8
   yyssp = (yytype_int16 *) 0xafb118d8
   yyvsa = {{pstr = 0xafb11868, pexpr = 0xafb11868}, {pstr = 0x8102cc4, pexpr = 0x8102cc4}, {
    ... blah blah blah ...
pexpr = 0xafb11ab8}}
   yyvs = (YYSTYPE *) 0xafb11858
   yyvsp = (YYSTYPE *) 0xafb115b8
   yystacksize = 200
   yyval = {pstr = 0xafb11a98, pexpr = 0xafb11a98}
   yylen = -1347348356
#2  0x08127f46 in CSearchList::CreateSearchData (this=0x86e3e20, params=@0xafb11bcc, type=GlobalSearch)
    at ../../src/SearchList.cpp:690
   kad = false
   parametercount = 0
   typeText = {<wxStringBase> = {static npos = 4294967295, m_pchData = 0xa7ef0e60}, <No data fields>}
   data = {_M_ptr = 0xa2caa68}
   iParseResult = <value optimized out>
   target = {m_data = 0x3, m_eStrEncode = 2947619592}
   iParameterCount = <value optimized out>
#3  0x08129da2 in CSearchList::StartNewSearch (this=0x86e3e20, searchID=0xafb11be8, type=GlobalSearch,
    params=@0xafb11bcc) at ../../src/SearchList.cpp:331
   data = {_M_ptr = 0xa237b10}
#4  0x080f06d5 in Get_EC_Response_Search (request=0x9de4d28) at ../../src/ExternalConn.cpp:742
   search_id = 4294967295
   error = {<wxStringBase> = {static npos = 4294967295, m_pchData = 0x99a7cf4}, <No data fields>}
   response = {<wxStringBase> = {static npos = 4294967295, m_pchData = 0xa7ef0e60}, <No data fields>}
   search_request = <value optimized out>
   params = {searchString = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x9c9c3ac}, <No data fields>}, typeText = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0xa7ef0e60}, <No data fields>}, extension = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0xa7ef0e60}, <No data fields>}, minSize = 0, maxSize = 0, availability = 0}
   search_type = <value optimized out>
   core_search_type = 400
   reply = <value optimized out>
#5  0x080f3e27 in ExternalConn::ProcessRequest2 (request=0x9de4d28, enc_part_map=@0x85f2070,
    enc_shared_map=@0x85f2094, objmap=@0x85f20b8) at ../../src/ExternalConn.cpp:1163
   it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x85f37f8, _M_version = 164749968,
    _M_prior = 0xafb12168, _M_next = 0x80f7202}, _M_current = {_M_current = 0xafb1217c}}
   detail_level = <value optimized out>
   servers = {<__gnu_norm::vector<const CServer*,std::allocator<const CServer*> >> = {<__gnu_norm::_Vector_base<const CServer*,std::allocator<const CServer*> >> = {
      _M_impl = {<std::allocator<const CServer*>> = {<__gnu_cxx::new_allocator<const CServer*>> = {<No data fields>}, <No data fields>}, _M_start = 0x9bd0a45, _M_finish = 0x1,
        _M_end_of_storage = 0x80f72cc}}, <No data fields>}, <__gnu_debug::_Safe_sequence<__gnu_debug_def::vector<const CServer*, std::allocator<const CServer*> > >> = {<__gnu_debug::_Safe_sequence_base> = {
      _M_iterators = 0x1, _M_const_iterators = 0x85f1f9c, _M_version = 2947621192}, <No data fields>},
  _M_guaranteed_capacity = 136939362}
   response = (CECPacket *) 0x0
#6  0x080f55a6 in CECServerSocket::OnPacketReceived (this=0x85f1f28, packet=0x190)
    at ../../src/ExternalConn.cpp:87
   reply = <value optimized out>
#7  0x0829966c in CECSocket::OnInput (this=0x85f1f28) at ../../../../../src/libs/ec/cpp/ECSocket.cpp:341
   reply = {_M_ptr = 0x83d3b48}
   packet = {_M_ptr = 0x9de4d28}
   bytes_rx = <value optimized out>
#8  0xa7e2c4af in wxAppConsole::HandleEvent () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#9  0xa7ecf23c in wxEvtHandler::ProcessEventIfMatches () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#10 0xa7ecf40e in wxEventHashTable::HandleEvent () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#11 0xa7ecf5b6 in wxEvtHandler::ProcessEvent () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#12 0xa7ecfa9f in wxEvtHandler::ProcessPendingEvents () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#13 0xa7e2c76a in wxAppConsole::ProcessPendingEvents () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#14 0x08059686 in CamuleDaemonApp::OnRun (this=0x85da150) at ../../src/amuled.cpp:427
   warning = {<wxStringBase> = {static npos = 4294967295, m_pchData = 0xa7ded590}, <No data fields>}
#15 0xa7e6655e in wxEntry () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#16 0xa7e66612 in wxEntry () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#17 0x08059730 in main (argc=Cannot access memory at address 0x1
) at ../../src/amuled.cpp:101
No locals.
Title: Re: flex issues
Post by: Nodsu on July 05, 2007, 02:46:13 PM
The patch doesn't do anything if you don't have a flex version new enough and if you don't point the LEX variable to it. The patch is here for people who have compiled a newer version themselves and are not interested in replacing the system flex.

I see that the patch still hasn't made it to SVN. Come on.. It's not that hard to run "patch -R" instead of "patch", is it?
Title: Re: flex issues
Post by: wuischke on July 05, 2007, 08:48:00 PM
Hi nodsu:

Maybe because the patch is wrong. ;) You have to patch makefile.am or your patch will be removed upon running autogen.sh.

Before changing anything: (I dislike makefiles and don't know a lot about them)

Is the $LEX-variable defined by configure? There's no such variable in my system.
Title: Re: flex issues
Post by: lfroen on July 06, 2007, 09:53:39 PM
Quote
You have to patch makefile.am or your patch will be removed upon running autogen.sh.
Correct.

Quote
Is the $LEX-variable defined by configure?
Yes. Similarly to $CXX for example.
Title: Re: flex issues
Post by: wuischke on July 06, 2007, 11:49:25 PM
Then you can regard it as patched as of tomorrow. (replaced flex by $(LEX) in src/Makefile.am and lex by $(LEX) in src/webserver/src/Makefile.am)
Title: Re: flex issues
Post by: lillesvamp on July 07, 2007, 12:49:21 AM
I've compiled the latest flex from cvs and set LEX to its path, applied the patch, tried to make the changes in the Makefile.am files. Still the same error.
Title: Re: flex issues
Post by: wuischke on July 07, 2007, 09:31:59 AM
Please try with today's tarball and execute manually: (replace 'flex' if necessary)

Code: [Select]
cd amule-cvs/src/
flex --header-file=./Scanner.h -o Scanner.cpp ./Scanner.l

If there is no error message, then it should work fine. I have versions 2.5.33 from feb 2006 and no problems at all.
Title: Re: flex issues
Post by: lillesvamp on July 07, 2007, 04:47:37 PM
I tried that and it worked! I would have been even happier if the linking had worked as well ("collect2: ld returned 1 exit status") but I suppose that's off topic.
Title: Re: flex issues
Post by: wuischke on July 07, 2007, 07:03:01 PM
Can you post this somewhere?

As Kry seems to be ultra-busy these days I might try to fix this as well.

btw: Can you build any recent aMule version on Mac? I'm searching for someone with Mac, the knowledge to build aMule and the will to test a (possible; already in cvs) fix for the boinc+aMule issue.
Title: Re: flex issues
Post by: lillesvamp on July 07, 2007, 08:21:21 PM
If you mean post about the linking problem, there already seems to be a thread dedicated to that here:
http://forum.amule.org/index.php?topic=12676.0 (http://forum.amule.org/index.php?topic=12676.0)

If you mean posting a binary, well I haven't managed to make one yet.

Even if I enjoy compiling stuff from time to time, I don't really have the knowledge or patience to figure out what to do when it doesn't work, or how to make static or universal binaries for that matter.

I'm afriaid I'm not the best choice as an "offical provider" of Mac binaries.
Title: Re: flex issues
Post by: wuischke on July 07, 2007, 10:03:37 PM
Well, I just need an "inofficial tester", no binaries. If you manage to get something running and are willing to install boinc, seti@home or something like this for testing a fix for an issue with these things, please contact me.
Title: Re: flex issues
Post by: rpog on July 10, 2007, 11:03:05 PM
i was wondering, can anyone compile the latest cvs on windows?
i get the same error as previously posted:
Code: [Select]
./Scanner.l: In function `void LexFree()':
./Scanner.l:191: error: `yylex_destroy' undeclared (first use this function)
./Scanner.l:191: error: (Each undeclared identifier is reported only once for each function it appears in.)

the main problem here lies on the fact that MinGW's flex version is 2.5.4 and it doesn't support the --header-file flag as the "./configure " commands warns :
Code: [Select]
configure: Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended Obviously, it's critical... :-\
Also, there won't be a new version so soon like it says on the MinGW website : http://www.mingw.org/MinGWiki/index.php/flex

So if anyone can compile it on windows, could you help by either updating the wiki or posting a solution ?  Thanks in advance :).
Title: Re: flex issues
Post by: centaur on July 11, 2007, 03:24:23 PM
I ran into the same problem on OpenBSD, touch  src/Scanner.cpp  as a workaround.
Title: Re: flex issues
Post by: rpog on July 11, 2007, 10:18:10 PM
centaur, thanks for the reply, indeed that's all it took to go away from the lex error.
i guess i should have read the thread a little better, the same solution was suggested but in a different way :).

however now to solve the
Code: [Select]
collect2: ld returned 1 exit status error is another matter to another thread, i guess.
Title: Re: flex issues
Post by: lionel77 on August 16, 2007, 07:52:30 AM
So I am sorta back from the dead... hopefully. ;)


When I run autogen.sh with current amule cvs, I get:
Code: [Select]
Running automake --foreign -a -c -f
configure.in:58: automake requires `AM_PROG_LEX', not `AC_PROG_LEX'
Makefile.am:1: SUBDIRS was already defined in condition TRUE, which implies condition COMPILE_NLS_TRUE

  SUBDIRS (User, where = Makefile.am:1) +=
  {
    TRUE => m4 docs src unittests
  }
Makefile.am:12: dist_icon_DATA was already defined in condition TRUE, which implies condition MONOLITHIC_TRUE

  dist_icon_DATA (User, where = Makefile.am:12) +=
  {
    TRUE =>
  }
Makefile.am:15: dist_util_DATA was already defined in condition TRUE, which implies condition MONOLITHIC_TRUE
...

I am using flex 2.5.33 installed via darwin ports.

I haven't compiled aMule in 6 months and I had a system hard drive die on me, so I had to reinstall the 3rd party libraries, etc. In other words, I am not in very good shape to pinpoint what might cause this error.


UPDATE:
I just installed a new version of automake and that seemed to have fixed the above issue.
Title: Re: flex issues
Post by: ecforum on August 25, 2007, 05:31:50 PM
I don't understand your technical discussion.
I just want to give you the information that on my slackware 11 with flex 2.5.4 which doesn't support --header-file flag I have the error when compiling aMule-CVS-20070825.
Title: Re: flex issues
Post by: wuischke on August 25, 2007, 05:45:01 PM
Hi ecforum,

Could you please upgrade flex to 2.5.33, your version is more than 10 years old.
Title: Re: flex issues
Post by: ecforum on August 25, 2007, 09:18:26 PM
Hello Wuischke,

Oh, excuse me : I read (dream...) 2.5.3.3 instead of 2.5.33....

EDIT :
I upgraded but it was not compiling.
I upgraded and it compiled ! (I had to clean all)

Thanks for your help !