On Tue, Sep 17, 2024 at 7:55 PM Timofei Zhakov <t...@chemodax.net> wrote:
>
> Hi,
>
> On Tue, Sep 17, 2024 at 6:45 AM Jun Omae <jun6...@gmail.com> wrote:
> >
> > On 2024/09/16 21:41, rin...@apache.org wrote:
> > > Author: rinrab
> > > Date: Mon Sep 16 12:41:13 2024
> > > New Revision: 1920717
> > >
> > > URL: http://svn.apache.org/viewvc?rev=1920717&view=rev
> > > Log:
> > > Merge the `cmake` branch to trunk.
> >
> > I'm trying to build all programs, tools, tests, swig-* bindings and apache
> > modules with cmake on Windows. However, building swig-pl stopped with the
> > following errors:
> >
> > [[[
> >     22>Link:
> >             Creating library 
> > C:/usr/src/subversion/trunk-py312/out/Release/libperl_core.lib and object 
> > C:/usr/src/subversion/trunk-py312/out/Release/libperl_core.exp
> >     22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
> > svn_swig_pl_thunk_ssl_server_trust_prompt referenced in function 
> > _wrap_svn_auth_get_ssl_server_trust_prompt_provider 
> > [C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
> >     22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
> > svn_swig_pl_thunk_ssl_client_cert_prompt referenced in function 
> > _wrap_svn_auth_get_ssl_client_cert_prompt_provider 
> > [C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
> >     22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
> > svn_swig_pl_thunk_ssl_client_cert_pw_prompt referenced in function 
> > _wrap_svn_auth_get_ssl_client_cert_pw_prompt_provider 
> > [C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
> > ]]]
>
> Wait... Oh, I've reproduced it.
>
> > It is caused by that libsvn_swig_perl.def is not same between vcnet and 
> > cmake.
> > The .def files directly are generated from CMakeLists.txt instead of
> > build/generator/extractor.py, but the pattern for the exported symbols is
> > changed. It is the root cause. The pattern should be same.
> >
> > In CMakeLists.txt:
> > [[[
> >     set(func_regex "^([A-Za-z0-9_][A-Za-z0-9_* ]+[ 
> > *])?(svn[A-Za-z0-9_]+)\\(")
> > ]]]
> >
> > In build/generator/extractor.py:
> > [[[
> > _funcs = re.compile(r'^(?:(?:(?:\w+|\*) 
> > )+\*?)?((?:svn|apr)_[a-z_0-9]+)\s*\(', re.M)
> > ]]]
> >
> > The REGEX feature in cmake is poor but we could revise like the following
> > changes, otherwise we should use extractor.py:
>
> Yeah, it is incomplete, so I rewrote this regex from a blank when
> implementing the extractor in CMake, and forgot to check for Perl
> bindings.
>
> > [[[
> > Index: CMakeLists.txt
> > ===================================================================
> > --- CMakeLists.txt      (revision 1920717)
> > +++ CMakeLists.txt      (working copy)
> > @@ -412,15 +412,16 @@
> >      set(def_file_path ${CMAKE_BINARY_DIR}/${target_name}.def)
> >
> >      # see build/generator/extractor.py
> > -    set(func_regex "^([A-Za-z0-9_][A-Za-z0-9_* ]+[ 
> > *])?(svn[A-Za-z0-9_]+)\\(")
> > +    set(func_regex "(^|\n)((([A-Za-z0-9_]+|[*]) 
> > )+[*]?)?((svn|apr)_[a-z_0-9]+)[ \t\r\n]*\\(")
> >
> >      set(defs)
> >      foreach(file ${ARGN})
> > -      file(STRINGS ${file} funcs REGEX "${func_regex}")
> > +      file(READ ${file} contents)
> > +      string(REGEX MATCHALL "${func_regex}" funcs ${contents})
> >
> >        foreach(func_string ${funcs})
> > -        string(REGEX REPLACE "${func_regex}.*$" "\\2" func_name 
> > ${func_string})
> > -
> > +        string(REGEX MATCH "[A-Za-z0-9_]+[ \t\r\n]*\\($" func_name 
> > ${func_string})
> > +        string(REGEX REPLACE "[ \t\r\n]*\\($" "" func_name ${func_name})
> >          list(APPEND defs "${func_name}")
> >        endforeach()
> >
> > ]]]
> >
> > Thoughts?
>
> This patch seems to be working and it resolves the issue. I think it's
> okay to commit it. Would you like to do it, or should I commit it?

I have an additional resolution to the problem:

I think those three functions are the last, where the opening brackets
are placed on a new line, separate from the function name. How about
reformatting them to match the style used in other functions?
Additionally, their implementations have the opening brackets on the
same line as the function name.

I’ve attached a patch as svn-fix-declaration-wrapping.patch.txt.

-- 
Timofei Zhakov
Index: subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
===================================================================
--- subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h        
(revision 1920754)
+++ subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h        
(working copy)
@@ -184,30 +184,30 @@
                                                apr_pool_t *pool);
 
 /* thunked ssl_server_trust_prompt callback function */
-svn_error_t *svn_swig_pl_thunk_ssl_server_trust_prompt
-  (svn_auth_cred_ssl_server_trust_t **cred,
-   void *baton,
-   const char *realm,
-   apr_uint32_t failures,
-   const svn_auth_ssl_server_cert_info_t *cert_info,
-   svn_boolean_t may_save,
-   apr_pool_t *pool);
+svn_error_t *svn_swig_pl_thunk_ssl_server_trust_prompt(
+                              svn_auth_cred_ssl_server_trust_t **cred,
+                              void *baton,
+                              const char *realm,
+                              apr_uint32_t failures,
+                              const svn_auth_ssl_server_cert_info_t *cert_info,
+                              svn_boolean_t may_save,
+                              apr_pool_t *pool);
 
 /* thunked ssl_client_cert callback function */
-svn_error_t *svn_swig_pl_thunk_ssl_client_cert_prompt
-  (svn_auth_cred_ssl_client_cert_t **cred,
-   void *baton,
-   const char *realm,
-   svn_boolean_t may_save,
-   apr_pool_t *pool);
+svn_error_t *svn_swig_pl_thunk_ssl_client_cert_prompt(
+                svn_auth_cred_ssl_client_cert_t **cred,
+                void *baton,
+                const char * realm,
+                svn_boolean_t may_save,
+                apr_pool_t *pool);
 
 /* thunked ssl_client_cert_pw callback function */
-svn_error_t *svn_swig_pl_thunk_ssl_client_cert_pw_prompt
-  (svn_auth_cred_ssl_client_cert_pw_t **cred,
-   void *baton,
-   const char *realm,
-   svn_boolean_t may_save,
-   apr_pool_t *pool);
+svn_error_t *svn_swig_pl_thunk_ssl_client_cert_pw_prompt(
+                                     svn_auth_cred_ssl_client_cert_pw_t **cred,
+                                     void *baton,
+                                     const char *realm,
+                                     svn_boolean_t may_save,
+                                     apr_pool_t *pool);
 
 /* Thunked version of svn_wc_notify_func_t callback type */
 void svn_swig_pl_notify_func(void * baton,

Reply via email to