Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swig: migrate to Conan v2, add v4.1.1 #19058

Closed
wants to merge 33 commits into from
Closed

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Aug 5, 2023

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@ghost ghost mentioned this pull request Aug 29, 2023
3 tasks
@valgur valgur mentioned this pull request Aug 30, 2023
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@RubenRBS
Copy link
Member

@jmarrec after applying your fix in the recipe, I get

$ /root/.conan2/p/b/swig9c828377a4b2d/p/bin/swig -swiglib
//bin/swiglib

for 4.1.1. Do you know if this is expected as per #16554 (comment)?

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@jmarrec
Copy link
Contributor

jmarrec commented Sep 4, 2023

@jmarrec after applying your fix in the recipe, I get

$ /root/.conan2/p/b/swig9c828377a4b2d/p/bin/swig -swiglib
//bin/swiglib

for 4.1.1. Do you know if this is expected as per #16554 (comment)?

@RubenRBS Seems like @valgur already fixed it in a4a1c71 (thanks!)

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@valgur
Copy link
Contributor Author

valgur commented Sep 12, 2023

@uilianries @RubenRBS Can you help with ERROR: Missing prebuilt package for 'pcre/8.45'?

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@valgur valgur closed this Sep 19, 2023
@valgur valgur reopened this Sep 19, 2023
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@mmomtchev
Copy link

@valgur You can probably directly switch to 4.2.1 - take my patch from the closed PR - only the swiglib path is needed now - the other one was fixed in SWIG

@mmomtchev
Copy link

@valgur, your recipe works for me on all my platforms, I just have some horrible output that goes like this:

Click to expand
config.status: executing Examples commands
config.status: generating Examples build tree
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/android/class/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/android/extend/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/android/simple/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/arrays/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/callback/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/class/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/enum/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/extend/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/funcptr/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/nested/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/reference/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/simple/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/template/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/csharp/variables/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/callback/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/class/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/constants/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/enum/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/extend/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/funcptr/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/simple/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/d/variables/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/callback/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/class/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/constants/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/director/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/enum/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/extend/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/funcptr/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/goin/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/multimap/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/pointer/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/reference/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/simple/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/template/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/go/variables/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/class/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/constants/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/matrix/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/multimap/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/multivalue/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/port/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/simple/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/guile/std_vector/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/callback/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/class/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/constants/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/doxygen/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/enum/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/extend/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/funcptr/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/multimap/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/native/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/nested/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/pointer/Makefile: input file is output file
cat: /c/users/mmom/.conan2/p/b/swig6926ab73bcf8a/b/src/Examples/java/reference/Makefile: input file is output file
on Windows with `MSYS2` and `MSVC`, but it does not have any functional consequences.

@mmomtchev
Copy link

@valgur, I upgraded your recipe to 4.2.1 and because of this upstream change

mmom@mmom-workstation:~/src/swig$ git diff -r 9d51ce87a25e7240db477d094704d9baac82ae4f..bdaa8604cb3442803af768d569cb04c70592dd66 configure.ac
diff --git a/configure.ac b/configure.ac
index e242ac6b1..956938438 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,7 @@ echo "Checking packages required for SWIG developers."
 echo "Note : None of the following packages are required for users to compile and install SWIG from the distributed tarball"
 echo ""
 
-AC_PROG_YACC
+AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
 
 echo ""
 echo "Checking for installed target languages and other information in order to compile and run"

win-bison is not correctly detected on Windows with msvc and MSYS2 - the conan wrapper is not used and the executable is run directly which fails.

@mmomtchev
Copy link

I found the problem - there is a bison.exe both in MSYS2 and in winflexbison. I don't know what is your standard way of resolving this? Since the way SWIG does it, it simply looks for bison in the PATH.

@mmomtchev
Copy link

The other problem - the horrible output - is due to this code: https://github.com/swig/swig/blob/a7eca8b4159840801c911c0d7b2a3325c3cbfa1e/configure.ac#L2859

SWIG supports out of source builds, however conan simply copies itself the source tree and then launches an out of source build with the build directory being the new source directory. This is what produces this output. If conan always does this, you can simply patch it out, or otherwise do not run the configure script with a full path, use only ./configure and it will go away.

@mmomtchev
Copy link

@valgur I have adapted your recipe for SWIG JSE (which is compatible at the configure level with SWIG 4.2.1):
master...mmomtchev:conan-center-index:swig-jse

There are 2 configure patches - for bison and for that annoying output

SWIG JSE is a very fast moving target and I will be publishing it to my own Artifactory CE - at least until I stop doing weekly releases (which are not really point releases, since I am still adding features)

Comment on lines +113 to +117
# Rely on AutotoolsDeps instead of pcre2-config
# https://github.com/swig/swig/blob/v4.1.1/configure.ac#L70-L92
# https://github.com/swig/swig/blob/v4.0.2/configure.ac#L65-L86
replace_in_file(self, os.path.join(self.source_folder, "configure.ac"),
'AS_IF([test "x$with_pcre" != xno],', 'AS_IF([false],')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You MUST define "HAVE_PCRE=1" in that case, or you'll get errors trying to build C# bindings in particular.

PCRE regex matching is not available in this SWIG build

Comment on lines +116 to +117
replace_in_file(self, os.path.join(self.source_folder, "configure.ac"),
'AS_IF([test "x$with_pcre" != xno],', 'AS_IF([false],')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
replace_in_file(self, os.path.join(self.source_folder, "configure.ac"),
'AS_IF([test "x$with_pcre" != xno],', 'AS_IF([false],')
replace_in_file(self, os.path.join(self.source_folder, "configure.ac"),
'AS_IF([test "x$with_pcre" != xno],', 'AC_DEFINE([HAVE_PCRE], [1])\nAS_IF([false],')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum that works on mac, but not on ubuntu/windows.

/usr/bin/ld: Swig/misc.o: in function `Swig_string_regex':
  misc.c:(.text+0x263b): undefined reference to `pcre2_compile_8'
  /usr/bin/ld: misc.c:(.text+0x2651): undefined reference to `pcre2_match_data_create_from_pattern_8'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, it's also affected by:

cl : Command line warning D9002 : ignoring unknown option '-LIBPATH:D:/a/runner/runner/conan-cache/.conan2/p/pcre2d85e041fe43c5/p/lib'
cl : Command line warning D9002 : ignoring unknown option '-LIBPATH:D:/a/runner/runner/conan-cache/.conan2/p/bzip2e06444d88ab4f/p/lib'
cl : Command line warning D9002 : ignoring unknown option '-LIBPATH:D:/a/runner/runner/conan-cache/.conan2/p/zlib9d72e7d21adc5/p/lib'

@conan-center-bot conan-center-bot added Failed Missing dependencies Build failed due missing dependencies in Conan Center labels May 22, 2024
@conan-center-bot

This comment has been minimized.

@conan-center-bot conan-center-bot added Service Under Maintenance and removed Failed Missing dependencies Build failed due missing dependencies in Conan Center labels May 22, 2024
@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 5 (9a12592226d7eb9f084214c2d78feb7a1c75f2cb):

  • swig/4.1.1:
    All packages built successfully! (All logs)

  • swig/4.1.0:
    All packages built successfully! (All logs)

  • swig/4.0.2:
    All packages built successfully! (All logs)

  • swig/4.0.1:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 4 (9a12592226d7eb9f084214c2d78feb7a1c75f2cb):

  • swig/4.1.1:
    All packages built successfully! (All logs)

  • swig/4.1.0:
    All packages built successfully! (All logs)

  • swig/4.0.2:
    All packages built successfully! (All logs)

  • swig/4.0.1:
    All packages built successfully! (All logs)

@valgur
Copy link
Contributor Author

valgur commented May 23, 2024

Thanks, @jmarrec! I applied the changes you suggested. Can you verify that it works as expected now?

@valgur
Copy link
Contributor Author

valgur commented May 30, 2024

#24165

@valgur valgur closed this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[request] SWIG/4.1.1 [package] swig>/<4.1.0>: Could NOT find SWIG (missing: SWIG_DIR)
5 participants