You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ri...@apache.org on 2024/08/10 19:25:38 UTC

svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Author: rinrab
Date: Sat Aug 10 19:25:38 2024
New Revision: 1919799

URL: http://svn.apache.org/viewvc?rev=1919799&view=rev
Log:
On the 'cmake' branch: Support compilation of Perl SWIG bindings.

For finding the Perl dev-kit, the FindPerlLibs.cmake built-in CMake module
will be utilized. This module doesn't actually create a target, so we will
do it manually and will just setup the external-perl target properties with
values from FindPerlLibs. The targets for the Perl SWIG bindings are already
created by gen-cmake while other Perl-specific options will be handled by the
UseSWIG module.

* CMakeLists.txt
  (swig.perl): Create the external-perl target for the Perl bindings.

Modified:
    subversion/branches/cmake/CMakeLists.txt

Modified: subversion/branches/cmake/CMakeLists.txt
URL: http://svn.apache.org/viewvc/subversion/branches/cmake/CMakeLists.txt?rev=1919799&r1=1919798&r2=1919799&view=diff
==============================================================================
--- subversion/branches/cmake/CMakeLists.txt (original)
+++ subversion/branches/cmake/CMakeLists.txt Sat Aug 10 19:25:38 2024
@@ -284,6 +284,21 @@ if(SVN_ENABLE_SWIG_PYTHON)
   )
 endif()
 
+if(SVN_ENABLE_SWIG_PERL)
+  find_package(Perl REQUIRED)
+  find_package(PerlLibs REQUIRED)
+
+  add_library(external-perl IMPORTED INTERFACE)
+  target_include_directories(external-perl INTERFACE
+    ${PERL_INCLUDE_PATH}
+    ${SWIG_INCLUDE_DIRECTORIES}
+    ${CMAKE_CURRENT_SOURCE_DIR}/subversion/bindings/swig/perl/libsvn_swig_perl
+  )
+  target_compile_definitions(external-perl INTERFACE "__inline__=__inline")
+  target_compile_options(external-perl INTERFACE ${PERL_EXTRA_C_FLAGS})
+  target_link_libraries(external-perl INTERFACE ${PERL_LIBRARY})
+endif()
+
 function(target_exports target_name)
   if (WIN32)
     set(def_file_path "${CMAKE_BINARY_DIR}/${target_name}.def")



Re: svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Posted by Timofei Zhakov <ti...@chemodax.net>.
On Sun, Aug 11, 2024 at 3:17 PM Daniel Sahlberg
<da...@gmail.com> wrote:
>
> Den sön 11 aug. 2024 kl 11:38 skrev Timofei Zhakov <ti...@chemodax.net>:
>>
>>
>> I think setting of the most of these options will resolve the issue
>> and make the build with CMake more similar to other build systems.
>> However, by excluding some options and testing, I noticed that setting
>> only of the _GNU_SOURCE definition also worked.
>
>
> Confirmed _GNU_SOURCE also seems to work.
>
> By the way; when working on the Swig Ruby-bindings, you might want to check r1915235 on /trunk:
>
> [[[
> SWIG Ruby bindings cannot build with SWIG 4.2.0 because it produces
> a broken external runtime code[1]. So we note it is broken and
> block users from building swig-rb with it.
>
> [1] https://github.com/swig/swig/issues/2751
> ]]]

I studied the issue a bit more, and the reason was funny, because we
were retrieving the list of flags from a module already, but it was in
incorrect form. I committed the fix as the revision 1919813 and
explained the problem in its log message.

Thanks!

-- 
Timofei Zhakov

Re: svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Posted by Daniel Sahlberg <da...@gmail.com>.
Den sön 11 aug. 2024 kl 11:38 skrev Timofei Zhakov <ti...@chemodax.net>:

>
> I think setting of the most of these options will resolve the issue
> and make the build with CMake more similar to other build systems.
> However, by excluding some options and testing, I noticed that setting
> only of the _GNU_SOURCE definition also worked.
>

Confirmed _GNU_SOURCE also seems to work.

By the way; when working on the Swig Ruby-bindings, you might want to check
r1915235 on /trunk:

[[[
SWIG Ruby bindings cannot build with SWIG 4.2.0 because it produces
a broken external runtime code[1]. So we note it is broken and
block users from building swig-rb with it.

[1] https://github.com/swig/swig/issues/2751
]]]

Kind regards,
Daniel

Re: svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Posted by Timofei Zhakov <ti...@chemodax.net>.
On Sat, Aug 10, 2024 at 10:37 PM Daniel Sahlberg
<da...@gmail.com> wrote:
>
> Den lör 10 aug. 2024 kl 21:25 skrev <ri...@apache.org>:
>>
>> Author: rinrab
>> Date: Sat Aug 10 19:25:38 2024
>> New Revision: 1919799
>>
>> URL: http://svn.apache.org/viewvc?rev=1919799&view=rev
>> Log:
>> On the 'cmake' branch: Support compilation of Perl SWIG bindings.
>>
>> For finding the Perl dev-kit, the FindPerlLibs.cmake built-in CMake module
>> will be utilized. This module doesn't actually create a target, so we will
>> do it manually and will just setup the external-perl target properties with
>> values from FindPerlLibs. The targets for the Perl SWIG bindings are already
>> created by gen-cmake while other Perl-specific options will be handled by the
>> UseSWIG module.
>>
>> * CMakeLists.txt
>>   (swig.perl): Create the external-perl target for the Perl bindings.
>
>
> Great work!
>
> Hate to crash the party but it didn't work for me.
>
> Had to do the obvious header:
> $ python ./build/generator/swig/external_runtime.py ./build.conf swig perl
>
> But still got
> [[[
> [ 68%] Building C object CMakeFiles/libsvn_swig_perl.dir/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c.o
> In file included from /home/dsg/svn_cmake/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c:32:
> /usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:252:15: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
>   252 | PERL_CALLCONV Off_t PerlIO_tell(PerlIO *);
>       |               ^~~~~
> /usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:255:41: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
>   255 | PERL_CALLCONV int PerlIO_seek(PerlIO *, Off_t, int);
>       |                                         ^~~~~
> ]]]
>
> It seems off64_t require #define _LARGEFILE64_SOURCE
>
> Again, sorry, out of time for tonight but I couldn't help checking this exciting commit! =)

Hi,

Thanks for the feedback!

Let me check it on Linux... Oh, yeah, I reproduced it. I took a look
at the commands that compiles this from the autoconf build system and
I found the following options:

[[[
-DLINUX -D_REENTRANT -D_GNU_SOURCE  -D_REENTRANT -D_GNU_SOURCE
-DDEBIAN -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION=\"\"
-DXS_VERSION=\"\" -DLINUX -D_REENTRANT -D_GNU_SOURCE
]]]

I think setting of the most of these options will resolve the issue
and make the build with CMake more similar to other build systems.
However, by excluding some options and testing, I noticed that setting
only of the _GNU_SOURCE definition also worked.

-- 
Timofei Zhakov

Re: svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Posted by Timofei Zhakov <ti...@chemodax.net>.
On Sat, Aug 10, 2024 at 10:37 PM Daniel Sahlberg
<da...@gmail.com> wrote:
>
> Den lör 10 aug. 2024 kl 21:25 skrev <ri...@apache.org>:
>>
>> Author: rinrab
>> Date: Sat Aug 10 19:25:38 2024
>> New Revision: 1919799
>>
>> URL: http://svn.apache.org/viewvc?rev=1919799&view=rev
>> Log:
>> On the 'cmake' branch: Support compilation of Perl SWIG bindings.
>>
>> For finding the Perl dev-kit, the FindPerlLibs.cmake built-in CMake module
>> will be utilized. This module doesn't actually create a target, so we will
>> do it manually and will just setup the external-perl target properties with
>> values from FindPerlLibs. The targets for the Perl SWIG bindings are already
>> created by gen-cmake while other Perl-specific options will be handled by the
>> UseSWIG module.
>>
>> * CMakeLists.txt
>>   (swig.perl): Create the external-perl target for the Perl bindings.
>
>
> Great work!
>
> Hate to crash the party but it didn't work for me.
>
> Had to do the obvious header:
> $ python ./build/generator/swig/external_runtime.py ./build.conf swig perl
>
> But still got
> [[[
> [ 68%] Building C object CMakeFiles/libsvn_swig_perl.dir/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c.o
> In file included from /home/dsg/svn_cmake/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c:32:
> /usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:252:15: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
>   252 | PERL_CALLCONV Off_t PerlIO_tell(PerlIO *);
>       |               ^~~~~
> /usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:255:41: error: unknown type name ‘off64_t’; did you mean ‘off_t’?
>   255 | PERL_CALLCONV int PerlIO_seek(PerlIO *, Off_t, int);
>       |                                         ^~~~~
> ]]]
>
> It seems off64_t require #define _LARGEFILE64_SOURCE
>
> Again, sorry, out of time for tonight but I couldn't help checking this exciting commit! =)

Hi,

Thanks for the feedback!

Let me check it on Linux... Oh, yeah, I reproduced it. I took a look
at the commands that compiles this from the autoconf build system and
I found the following options:

[[[
-DLINUX -D_REENTRANT -D_GNU_SOURCE  -D_REENTRANT -D_GNU_SOURCE
-DDEBIAN -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION=\"\"
-DXS_VERSION=\"\" -DLINUX -D_REENTRANT -D_GNU_SOURCE
]]]

I think setting of the most of these options will resolve the issue
and make the build with CMake more similar to other build systems.
However, by excluding some options and testing, I noticed that setting
only of the _GNU_SOURCE definition also worked.

-- 
Timofei Zhakov

Re: svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Posted by Daniel Sahlberg <da...@gmail.com>.
Den lör 10 aug. 2024 kl 21:25 skrev <ri...@apache.org>:

> Author: rinrab
> Date: Sat Aug 10 19:25:38 2024
> New Revision: 1919799
>
> URL: http://svn.apache.org/viewvc?rev=1919799&view=rev
> Log:
> On the 'cmake' branch: Support compilation of Perl SWIG bindings.
>
> For finding the Perl dev-kit, the FindPerlLibs.cmake built-in CMake module
> will be utilized. This module doesn't actually create a target, so we will
> do it manually and will just setup the external-perl target properties with
> values from FindPerlLibs. The targets for the Perl SWIG bindings are
> already
> created by gen-cmake while other Perl-specific options will be handled by
> the
> UseSWIG module.
>
> * CMakeLists.txt
>   (swig.perl): Create the external-perl target for the Perl bindings.
>

Great work!

Hate to crash the party but it didn't work for me.

Had to do the obvious header:
$ python ./build/generator/swig/external_runtime.py ./build.conf swig perl

But still got
[[[
[ 68%] Building C object
CMakeFiles/libsvn_swig_perl.dir/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c.o
In file included from
/home/dsg/svn_cmake/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c:32:
/usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:252:15: error: unknown
type name ‘off64_t’; did you mean ‘off_t’?
  252 | PERL_CALLCONV Off_t PerlIO_tell(PerlIO *);
      |               ^~~~~
/usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:255:41: error: unknown
type name ‘off64_t’; did you mean ‘off_t’?
  255 | PERL_CALLCONV int PerlIO_seek(PerlIO *, Off_t, int);
      |                                         ^~~~~
]]]

It seems off64_t require #define _LARGEFILE64_SOURCE

Again, sorry, out of time for tonight but I couldn't help checking this
exciting commit! =)

Cheers,
Daniel

>
>

Re: svn commit: r1919799 - /subversion/branches/cmake/CMakeLists.txt

Posted by Daniel Sahlberg <da...@gmail.com>.
Den lör 10 aug. 2024 kl 21:25 skrev <ri...@apache.org>:

> Author: rinrab
> Date: Sat Aug 10 19:25:38 2024
> New Revision: 1919799
>
> URL: http://svn.apache.org/viewvc?rev=1919799&view=rev
> Log:
> On the 'cmake' branch: Support compilation of Perl SWIG bindings.
>
> For finding the Perl dev-kit, the FindPerlLibs.cmake built-in CMake module
> will be utilized. This module doesn't actually create a target, so we will
> do it manually and will just setup the external-perl target properties with
> values from FindPerlLibs. The targets for the Perl SWIG bindings are
> already
> created by gen-cmake while other Perl-specific options will be handled by
> the
> UseSWIG module.
>
> * CMakeLists.txt
>   (swig.perl): Create the external-perl target for the Perl bindings.
>

Great work!

Hate to crash the party but it didn't work for me.

Had to do the obvious header:
$ python ./build/generator/swig/external_runtime.py ./build.conf swig perl

But still got
[[[
[ 68%] Building C object
CMakeFiles/libsvn_swig_perl.dir/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c.o
In file included from
/home/dsg/svn_cmake/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c:32:
/usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:252:15: error: unknown
type name ‘off64_t’; did you mean ‘off_t’?
  252 | PERL_CALLCONV Off_t PerlIO_tell(PerlIO *);
      |               ^~~~~
/usr/lib/x86_64-linux-gnu/perl/5.38/CORE/perlio.h:255:41: error: unknown
type name ‘off64_t’; did you mean ‘off_t’?
  255 | PERL_CALLCONV int PerlIO_seek(PerlIO *, Off_t, int);
      |                                         ^~~~~
]]]

It seems off64_t require #define _LARGEFILE64_SOURCE

Again, sorry, out of time for tonight but I couldn't help checking this
exciting commit! =)

Cheers,
Daniel

>
>