Problem with shared build

Kit Bishop kit at bishop.net.nz
Tue Oct 16 16:00:41 PDT 2007


Vadim Zeitlin wrote:
> On Tue, 16 Oct 2007 14:15:13 +1300 Kit Bishop <kit at bishop.net.nz> wrote:
>
> KB> However, the bit that makes a difference is that `wx-config --static=no
> KB> --ld` gives "g++ -shared -fPIC -o" - if I remove the -shared, all is OK.
>
>  "-shared" is clearly unwanted here as it produces a shared library instead
> of executable file on output.
>
> KB> Should this problem be fixed in the build, or is it a problem with my
> KB> system and components?
>
>  No, it's definitely a problem of wx-config. Unfortunately I'm not sure
> about how to fix it in the best way...
>
>  Regards,
> VZ
>
>   
I have figured out where this is coming from:

The value of --ld from wx-config is obtained from EXE_LINKER as set in
configure
For a shared build, EXE_LINKER is set from SHARED_LD_CXX
SHARED_LD_CXX is set as $(CXX) -shared $(PIC_FLAG) -o

Now, this might be appropriate for building a shared library - it does
not seem appropriate for using the shared library.

I believe I can sort out a fix for this, however, it raises another issue:
wx-config may be used to just build an application, or it may also be
used to build a dynamic library (.so).
So, the question is: do we want wx-config to just return the values for
building the application, or do we want it to be able to be used for
eiher an application or a dynamic library?

In the first case, it would be up to the user to add the -shared option
when needed when building a dynamic library.
In the second case, we would need an additional option to wx-config to
indicate whether we were building an application or a dynamic library.

Further, I note that the sample Makefiles for the shared case have
-DWXUSINGDLL in the compile flags, whereas the wx-config flags output do
not include this.
This of course leads on to the question: should -DWXUSINGDLL be included
in the wx-config compile flags for shared case?  Should we
correspondingly have -DWXMAKINGDLL if we were building a dynamic library?

Unless you indicate otherwise, it is my intention to try to create a
patch that will: omit the -shared in wx-config --ld for shared build

>From my testing, this is the minimum that is required to be able to
build an app using shared libraries with wx-config.

Perhaps, later, I may look at the other issues.

Best regards,
Kit





More information about the wx-users mailing list