Hi. Following on from bug 99753 in my bid to get my Alcatel Speedtouch modem working I discovered that the speedtouch ebuild doesn't get along with gcc-4.0.1 either. But this one seems to be a trivial fix. The problem is that some of the programs are intended to accept a parameter to set the verbosity of logging. To that end they each declare the "verbose" variable as a static int in global scope. However, in the case of "modem_run.c", it includes "modem.h" which has the following conflicting delaration: /* Global Variables */ extern int verbose; This unit is unique in that respect; the simplest workaround seems to be to remove that declaration in the header. Of course, the CVS code looks to be in much better shape (and takes a different approach) but who knows when the next release will be? So, I'm attaching a patch against the prior ebuild revision and a patch containing the fix. Note that I cannot actually test my modem right now (my entire system is sitting on a chroot at a remote location). I don't anticipate any problems but I'll post back in any case just to state whether things work out OK.
Created attachment 63950 [details, diff] speedtouch-1.3.1-r2.ebuild -> speedtouch-1.3.1-r3.ebuild (patch)
Created attachment 63951 [details, diff] files/speedtouch-1.3.1-gcc4.patch
I think it should be done the other way around - verbose should be declared as global instead as static. does removal of static keywords solve compilation problem on gcc-4?
OK, I've migrated to the new system. The modem is working fine with these packages. As your suggested approach apropos of this bug, I'll post back as soon as I can with news (and probably a revised patch).
I've tried changing the "static int verbose = 0;" declaration at modem_run.c:94 to "int verbose = 0;" as you suggested and yes, that does fix it as well. But after thinking about it (and seeking some other opinions) I believe that the way I suggested is best practice in this case. Please allow me to explain why I think that: 1) The extern implies that the variable is shared between multiple C files which are compiled into one binary. 2) But ... that isn't actually the case here with the speedtouch code. If you search for "verbose" in the source tree, it is apparent that each file has its own method of setting it. It's statically scoped for each program which makes sense in this case - there should be no sharing. 3) Any C file that /were/ to include that header would in this case end up redefining it in another scope anyway, after including the header (because of the use of static modifiers throughout). Indeed, the only C file that does include the modem.h header is modem_run.c itself so there is no point. Basically I think the use of static accomplishes what the author had intended and that the extern declaration is a mistake. They're each independent tools accepting their own independent parameter to set verbosity within the scope of themselves only. If the intentions (and code) were different then it would be the other way around of course. My feeling is that, for the sake of only 2 extra diff lines one may as well put in the logically correct fix even if it there happens to be no effective difference between either approach for this particular case (in terms of getting it generally working).
you're right. fixed without bumping the revision - no need for it since it only makes the package installable on systems with gcc-4.