From: Francesco M. <f18...@ya...> - 2008-07-12 11:24:36
|
[sending this reply to wxcode-users, too] Hi Ulrich, and all wxCode devs, Ulrich Telle ha scritto: > Although the option --enable-shared=no (or --disable-shared) is > specified when running ./configure running make does not build wxSQLite3 as a > static library but as a shared library. same here. The --enable-shared/--disable-shared options are simply ignored by wxCode component build systems (not only by wxsqlite3). I'm not sure when this bug was introduced (I tried to search in the CVS/SVN history without success)... but I'm sure it worked originally. > Is there anything wrong with my bakefile? there's nothing wrong with your bakefile... however I've found that the problem is deeper. The fact is that your component (like all other wxCode components! I've checked this!) uses WXCODE_OPTIONS([debug,unicode,shared,toolkit,wxshared,wxversion]) in the configure.ac i.e. specifies not only wxshared but also "shared" option. This is wrong. In fact, there's no SHARED option declared in the wxCode bakefile or in your component's bakefile. wx autoconf macros and wx bakefile presets in fact are affected only by the value of WX_SHARED (the --with-wxshared option in fact works as intended). This is confirmed also by the fact that the components' win32 makefiles do not show any SHARED option. I.e. in the way the wxCode presets are currently written, there's no way (both on Windows and on Unix) to build a static version of a component against a shared build of wxWidgets. Currently the configuration you give to the configure script (using the --enable-debug,--enable-unicode,--with-wxshared options) or to the win32 makefiles (using WX_DEBUG, WX_UNICODE, WX_SHARED) _must_ match the configuration of a wxWidgets build. I hope I cleared the issue :) Now there are two solutions to fix this problem: 1) remove from the configure.ac of all wxCode components the "wxshared" option and leave only the "shared" option. Then set in the WXCODE_OPTIONS macro WX_SHARED=$SHARED (just like it does for WX_DEBUG=$DEBUG and WX_UNICODE=$UNICODE). This would mean that you can build your component only with a combination of debug/unicode/shared settings matching an existing wxWidgets build. 2) add to wxCode bakefiles the declaration of an option called "SHARED", which can be used to build a wxCode component with SHARED!=WX_SHARED. So that you can build your component in static mode against a shared build of wxWidgets (the viceversa is not possible for linking reasons). Then change in the bakefiles of all components the lines: <lib ... cond="WX_SHARED=='0'"> <dll ... cond="WX_SHARED=='1'"> to: <lib ... cond="SHARED=='0'"> <dll ... cond="SHARED=='1'"> Last, add the necessary modification to wxCode autoconf macros to handle the SHARED option as a separed option from WX_SHARED. I'm unsure about the right way to proceed. Solution #1 is the simplest one and it's a "safe" route (very easy to implement). Basically it avoids added complexity to wxCode build system at the cost of excluding the build possibility: wx shared + wxCode comp static. Solution #2 is more difficult but I've already implemented it successfully for wxLua a while ago, so that I could copy the required portions of code. However it requires a change in all wxCode bakefiles and also makes them somewhat less intuitive. The question is: how useful is the ability to do a static build of a wxCode component against a shared build of wx? Under linux it may be useful: so that you can build an ELF self-contained _except_ for wx DLLs (or better "shared objects) which are included by deafult in almost all linux distro... What's your thoughts? Francesco -- |
From: Ulrich T. <ulr...@gm...> - 2008-07-12 12:17:39
|
Hi Francesco, > same here. The --enable-shared/--disable-shared options are simply > ignored by wxCode component build systems (not only by wxsqlite3). Interestingly the log messages of the configure tell exactly what the user wants (static build of the wxCode component used with a shared build of wxWidgets), only the generated makefile does not work like expected. It would be better if the configure script would complain about mismatched options instead. > Currently the configuration you give to the configure script (using the > --enable-debug,--enable-unicode,--with-wxshared options) or to the win32 > makefiles (using WX_DEBUG, WX_UNICODE, WX_SHARED) _must_ match the > configuration of a wxWidgets build. > > I hope I cleared the issue :) Well, yes, but I remember there was a discussion quite long ago regarding exactly this issue, that is, building a wxCode component with options not matching the used wxWidgets build options. And I thought the WX_SHARED option was introduced just to solve this issue. But I may be mistaken. > Now there are two solutions to fix this problem: > > 1) remove from the configure.ac of all wxCode components the "wxshared" > option and leave only the "shared" option. Then set in the > WXCODE_OPTIONS macro WX_SHARED=$SHARED (just like it does for > WX_DEBUG=$DEBUG and WX_UNICODE=$UNICODE). > This would mean that you can build your component only with a > combination of debug/unicode/shared settings matching an existing > wxWidgets build. I think this is too restrictive. At least I know there are several users using a shared wxWidgets build but a static wxCode component build. > 2) add to wxCode bakefiles the declaration of an option called "SHARED", > which can be used to build a wxCode component with SHARED!=WX_SHARED. So > that you can build your component in static mode against a shared build > of wxWidgets (the viceversa is not possible for linking reasons). > > Then change in the bakefiles of all components the lines: > > <lib ... cond="WX_SHARED=='0'"> > <dll ... cond="WX_SHARED=='1'"> > > to: > > <lib ... cond="SHARED=='0'"> > <dll ... cond="SHARED=='1'"> > > Last, add the necessary modification to wxCode autoconf macros to handle > the SHARED option as a separed option from WX_SHARED. > > Solution #2 is more difficult but I've already implemented it > successfully for wxLua a while ago, so that I could copy the required > portions of code. > However it requires a change in all wxCode bakefiles and also makes them > somewhat less intuitive. > > The question is: how useful is the ability to do a static build of a > wxCode component against a shared build of wx? > > Under linux it may be useful: so that you can build an ELF > self-contained _except_ for wx DLLs (or better "shared objects) which > are included by deafult in almost all linux distro... > > What's your thoughts? I'm a bit undecided. Up to now I myself have never used different build options for wxCode components and wxWidgets itself, but if there are users demanding this option I guess the wxCode components should offer it if it's not too difficult to implement. If you decide to change the wxCode build system accordingly it should be thoroughly tested before releasing any components using it. At least the current version of the wxCode build system is stable. A third solution would be to change only the behaviour of the configure script, that is, it should reject mismatched shared/static options. A user wishing to make a static build while using a shared wxWidgets build can always add the wxCode component's source files to his own project. Regards, Ulrich |
From: Francesco M. <f18...@ya...> - 2008-07-13 15:46:38
|
Ulrich Telle ha scritto: > Hi Francesco, > >> same here. The --enable-shared/--disable-shared options are simply >> ignored by wxCode component build systems (not only by wxsqlite3). > > Interestingly the log messages of the configure tell exactly what the > user wants (static build of the wxCode component used with a shared > build of wxWidgets), only the generated makefile does not work like > expected. > > It would be better if the configure script would complain about > mismatched options instead. this should be already done: try to give --enable-shared --without-wxshared. It doesn't complain on the opposite case since it should be allowed to give --disable-shared --with-wxshared; it's just that the bakefile part for the SHARED option is missing. >> Currently the configuration you give to the configure script (using the >> --enable-debug,--enable-unicode,--with-wxshared options) or to the win32 >> makefiles (using WX_DEBUG, WX_UNICODE, WX_SHARED) _must_ match the >> configuration of a wxWidgets build. >> >> I hope I cleared the issue :) > > Well, yes, but I remember there was a discussion quite long ago > regarding exactly this issue, that is, building a wxCode component with > options not matching the used wxWidgets build options. And I thought the > WX_SHARED option was introduced just to solve this issue. But I may be > mistaken. I think we discussed something similar (i.e. whether we should use as option names BUILD/SHARED/UNICODE as win32 wx makefiles do or rather WX_DEBUG/WX_SHARED/WX_UNICODE option names -- we decided for the latter)... but I don't think they we decided about coexistence of SHARED and WX_SHARED... >> The question is: how useful is the ability to do a static build of a >> wxCode component against a shared build of wx? >> >> Under linux it may be useful: so that you can build an ELF >> self-contained _except_ for wx DLLs (or better "shared objects) which >> are included by deafult in almost all linux distro... >> >> What's your thoughts? > > I'm a bit undecided. Up to now I myself have never used different build > options for wxCode components and wxWidgets itself, but if there are > users demanding this option I guess the wxCode components should offer > it if it's not too difficult to implement. actually I tried to implement it and it results easier than I thought. > If you decide to change the wxCode build system accordingly it should be > thoroughly tested before releasing any components using it. At least the > current version of the wxCode build system is stable. sure. I have just committed updated version of wxCode bakefiles both to CVS and SVN. I tested the changes with 'gnu' and 'autoconf' format for now and they works well. Before I proceed changing all wxCode bakefiles from <lib ... cond="WX_SHARED=='0'"> <dll ... cond="WX_SHARED=='1'"> to: <lib ... cond="SHARED=='0'"> <dll ... cond="SHARED=='1'"> I'd appreciate if other peoples tested the modified build system... Francesco |
From: Ulrich T. <ulr...@gm...> - 2008-07-13 18:03:02
|
Hi Francesco, >> It would be better if the configure script would complain about >> mismatched options instead. > this should be already done: try to give --enable-shared --without-wxshared. > > It doesn't complain on the opposite case since it should be allowed to > give --disable-shared --with-wxshared; it's just that the bakefile part > for the SHARED option is missing. You are right. > I think we discussed something similar (i.e. whether we should use as > option names BUILD/SHARED/UNICODE as win32 wx makefiles do or rather > WX_DEBUG/WX_SHARED/WX_UNICODE option names -- we decided for the > latter)... but I don't think they we decided about coexistence of SHARED > and WX_SHARED... You are right again. The discussion was about introducing WX_ prefixed options and, yes, we didn't decide the latter but the introduction. > actually I tried to implement it and it results easier than I thought. > [...] > I have just committed updated version of wxCode bakefiles both to > CVS and SVN. Great. I'll give it a try within the next few days. > I'd appreciate if other peoples tested the modified build system... I'll do that and let you know the results. Regards, Ulrich |