Cross Compile Problem - wxWidgets App with flex

2 Messages Forum Options Options
Permalink
whgorder
Cross Compile Problem - wxWidgets App with flex
Reply Threaded More
Print post
Permalink
I have a number of applications devloped on linux with a corresponding version cross compiled for windows.  I am having trouble with the windows version of one of them.  The problem app uses flex and bison.

I read about the known problems with flex and compiled the pre-posix 2.5.5b version of flex for my cross compiled windows app.  I have tested it fairly extensively and it works well - except for the one case I need.

There is something about the combination of flex and wxWidgets that causes a premature return in the windows loader.  When the app is run under gdb in windows, it produces the message "Program exited normally."  A breakpoint at an early piece of code (such as OnInit()) is never hit, and is why I say it fails in initialization.

I don't think the problem is with flex-bison as I can replace wxWidgets with a C or C++ driver (a main(), for example), and the program will run.  Conversely, I can strip the flex-bison code from the wxWidgets app and it will run, albeit not as desired since function is missing.  The combination will not work.

Here is what I have:
* Fedora Core 8
* mingw-wxWidgets-2.8.7-1.fc8.i386.rpm for cross compile
* Custom compiled flex-2.5.5b libfl.a (flex library for windows)
* Custom compiled flex-2.5.5b linux program (for flex C code generation)
* "standard" cross compile tools for FC8
* a windows machine for test (Vista)
* wxWidgets 2.8.7 compiled for X11 for native linux stuff

I don't see this problem discussed on the web anywhere so I assume it is something unique to what I am doing.  I have trouble imagining I am the only person with a cross compiled wxWidgets app that uses flex and bison, so if anyone has a clue I would really appreciate it.

I should also mention that I have test cases that show that bison is not a factor.  Just wxWidgets and flex is sufficient for failure.
whgorder
Re: Cross Compile Problem - wxWidgets App with flex
Reply Threaded More
Print post
Permalink
I found the problem.  libfl.a provides a main and wxWidgets provides a main.  Apparently this causes the windows loader to abend while a unix loader somehow handles it.

The solution (at least the one I chose) is to replace libfl.a with a pair of libraries: libflwm.a and libflnm.a.  The former includes a main and the latter does not.  The application writer needs to specify which library to use and DO NOT use libflwm.a with wxWidgets applications.

It may be that not many people are cross compiling windows wxWidgets apps with flex and bison on *nix machines, but this may hopefully save someone the time it took me to find this.