Hello Cliff

I too share your dislike of my suggested change to code.h:)   I do
prefer your alternative despite the duplication.  However I worry that
the copy - deep within the java bindings tree would be overlooked when
changes are made to codec.h and the two would diverge, leading to
obscure defects.

I wonder if it is possible to move your workaround into its own .i
file which would be located alongside codec.h?  java.i would then
include it using a %import.  This approach would also facilitate
sharing with the other bindings (surely they would need the same
solution??).

> I had just got this working yesterday on Linux and was trying a Windows build 
> before posting a review.  It fails in cmake scripts working with windows 
> paths (and maybe other problems).

I see an issue on Windows (Windows 7/MS Visual Studio 2010/Python
2.7.3) with the generation of protocol.h and encodings.h.  It behaves
as if the cmd-shell is ignoring the redirection (>). I see the
generated file flash by in cmd window and no .h is written.  I'm
working around by executing:

python X:/src/proton/proton-c/env.py PYTHONPATH=X:/src/proton/proton-c
python X:/src/proton/proton-c/src/protocol.h.py >
X:/src/proton/buildwin/proton-c/protocol.h
python X:/src/proton/proton-c/env.py PYTHONPATH=X:/src/proton/proton-c
python X:/src/proton/proton-c/src/codec/encodings.h.py >
X:/src/proton/buildwin/proton-c/encodings.h

Do you see this?  My windows box behaves oddly at the best of times.

On Windows I still see a number of C++ compilation errors from
javaJAVA_wrap.cxx.  Do you see these?   I haven't started to
investigate yet.

11>X:\src\proton\proton-c\include\proton/driver_extras.h(40): error
C2146: syntax error : missing ';' before identifier 'pn_socket_t'
11>X:\src\proton\proton-c\include\proton/driver_extras.h(40): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
11>X:\src\proton\proton-c\include\proton/driver_extras.h(40): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
11>X:\src\proton\proton-c\include\proton/driver_extras.h(53): error
C2061: syntax error : identifier 'pn_socket_t'
11>X:\src\proton\proton-c\include\proton/driver_extras.h(63): error
C2061: syntax error : identifier 'pn_socket_t'
11>javaJAVA_wrap.cxx(1062): warning C4018: '<' : signed/unsigned mismatch
11>javaJAVA_wrap.cxx(1089): warning C4018: '<' : signed/unsigned mismatch
11>javaJAVA_wrap.cxx(7754): error C2146: syntax error : missing ';'
before identifier 'arg2'
11>javaJAVA_wrap.cxx(7754): error C2065: 'arg2' : undeclared identifier
11>javaJAVA_wrap.cxx(7761): error C2065: 'arg2' : undeclared identifier
11>javaJAVA_wrap.cxx(7761): error C2146: syntax error : missing ';'
before identifier 'jarg2'
11>javaJAVA_wrap.cxx(7763): error C2065: 'arg2' : undeclared identifier
11>javaJAVA_wrap.cxx(7772): error C2146: syntax error : missing ';'
before identifier 'arg2'
11>javaJAVA_wrap.cxx(7772): error C2065: 'arg2' : undeclared identifier
11>javaJAVA_wrap.cxx(7779): error C2065: 'arg2' : undeclared identifier
11>javaJAVA_wrap.cxx(7779): error C2146: syntax error : missing ';'
before identifier 'jarg2'
11>javaJAVA_wrap.cxx(7781): error C2065: 'arg2' : undeclared identifier

> Let me know if you wish to tackle the remaining windows build issues.

I can't offer to take these on firstly as my focus is Engine at
present, and C/C++ it is no longer my area of expertise (12 years of
rust).  I will pitch in and help with any questions you may have with
the JNI aspects if I can.   I am also in the process of getting this
build set up on Apache Jenkins.

Kind regards, Keith


On 20 March 2013 03:49, Cliff Jansen <[email protected]> wrote:
> Hi Keith,
>
> Very nice work there, thanks.  I've been looking at this too and had
> an alternate solution to the nested union problem
> (https://issues.apache.org/jira/secure/attachment/12574482/pn254-cj-0.patch).
>
> It is based on the observation that there is nothing wrong with the
> definition in codec.h that swig complains about to begin with.  That,
> plus it irks me to change a public interface file just to satisfy the
> one C99 unfriendly compiler in the world.  So I looked for a solution
> that was specific to swig.
>
> Sadly, swig handled this just fine in the 1.X series, precisely to
> handle cases such as here.  However that apparently exacerbated
> problems elsewhere and, as far as I can tell, their new fancy
> %nestedworkaround fix in swig 2.X can't work in our case and leaves us
> high and dry.
>
> The patch I provided just restores the swig 1.X behaviour.  The
> downside is the (twice) repeated re-definition of the union (bleh, my
> swig knowledge could find no better solution).  Your patch is cleaner
> in that respect.   If my patch seems distasteful in its foibles, I
> would look to Rafi for his views on changing codec.h.  Let me know
> what you think.
>
> I had just got this working yesterday on Linux and was trying a
> Windows build before posting a review.  It fails in cmake scripts
> working with windows paths (and maybe other problems).  But it does
> compile the swig part in Visual Studio.
>
> Let me know if you wish to tackle the remaining windows build issues.
>
> Cliff
>




>
>
> On Tue, Mar 19, 2013 at 7:50 PM, Keith W <[email protected]> wrote:
>> On 1 March 2013 16:15, Cliff Jansen <[email protected]> wrote:
>>> I did all that and verified the c++ swig call was used and g++ on
>>> javaJAVA_wrap.cxx.  I also needed the fix in PROTON-249 to progress on
>>> Windows.
>>>
>>> Let me know if you have made further progress.  Otherwise, I will keep 
>>> digging.
>>>
>>> Cliff
>>
>> Hi Cliff
>>
>> I made a commit under PROTON-254 that
>>
>> a) changes bindings/java/CMakeLists.txt to use CPLUSPLUS ON directive
>> in the case where BUILD_WITH_CXX has been enabled
>> b) resolves the compilation errors that resulted from compiling the
>> swig generated C++ code.
>>
>> That leaves the problem with "Nested union not currently supported'
>> reported by Swig.  You'll remember that Swig doesn't support nested
>> types when operating in C++ mode, and so ignores the nested union
>> within pn_atom_t.  This means swig fails to generate the pn_atom_t_u
>> java class and so our hand-rolled java binding code (java) fails to
>> compile.
>>
>> I've attached a patch to PROTON-254 that works around the issue by
>> simply moving the union to the top level.  This seems to avoid the
>> swig limitation seemingly without breaking anything else.  Do you see
>> a problem with this approach?  Can you think of an neater alternative?
>>
>> The patch allows the JNI tests to pass under C++ on Ubuntu and MacOSX.
>>  I'm yet to try on Windows.
>>
>> Kind regards, Keith.

Reply via email to