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

libxml2: fix mingw on Linux + double quotes + libxml2 does not create cmake targets #2714

Closed
wants to merge 11 commits into from

Conversation

madebr
Copy link
Contributor

@madebr madebr commented Aug 29, 2020

Specify library name and version: libxml2/all

Fixes #2708
@SpaceIm

  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@conan-center-bot
Copy link
Collaborator

All green in build 1 (c61a2382255481a45e5b89a223a12fb5918b7cb0)! 😊

@SSE4 SSE4 requested review from uilianries and danimtb August 29, 2020 17:59
SSE4
SSE4 previously approved these changes Aug 29, 2020
@conan-io conan-io deleted a comment from madebr Aug 29, 2020
@SpaceIm
Copy link
Contributor

SpaceIm commented Aug 29, 2020

Could you also bump msys2 and icu versions please?

Comment on lines 259 to 258
if self.settings.os == "Linux" or self.settings.os == "Macos":
self.cpp_info.system_libs.append('m')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it really required for Macos?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know of another recipe that adds m for Macos.
I can't check it...

Copy link
Contributor

Choose a reason for hiding this comment

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

that's good catch, it shouldn't be needed on macOS - everything reside in libSystem.dylib

@conan-center-bot
Copy link
Collaborator

All green in build 2 (42191a9caad0c63f8daea1f6cb7ff4130bb24603)! 😊

danimtb
danimtb previously approved these changes Aug 31, 2020
uilianries
uilianries previously approved these changes Sep 3, 2020
@madebr
Copy link
Contributor Author

madebr commented Sep 24, 2020

@SpaceIm @danimtb @prince-chrismc
Can this pr receive some reviews please?

Comment on lines +207 to +250
ext = ".exe" if self.settings.os == "Windows" else ""
autotools.make(["xmllint" + ext, "xmlcatalog" + ext, "xml2-config"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be a function since it's duplicated here

Comment on lines 233 to 236
if not self.options.shared:
os.unlink(os.path.join(self.package_folder, "bin", "libxml2.dll"))
os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a_dll.lib'))
os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a.lib' if self.options.shared else 'libxml2.lib'))
os.unlink(os.path.join(self.package_folder, "lib", "libxml2_a_dll.lib"))
os.unlink(os.path.join(self.package_folder, "lib", "libxml2_a.lib" if self.options.shared else "libxml2.lib"))
Copy link
Contributor

Choose a reason for hiding this comment

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

This bit is a little confusing

shared --> remove dll
remove _a_ dll
shared --> remove _a_ lib
static--> remove lib ???

Copy link
Contributor

Choose a reason for hiding this comment

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

That's weird, but it works. After this cleanup, only relevant static or import lib remains.

@prince-chrismc
Copy link
Contributor

There's only one component which looks like the default target. Was the motivation for the CMake components the extra "FIXME"s?

@SpaceIm
Copy link
Contributor

SpaceIm commented Sep 25, 2020

On my MinGW@windows, static works, but not shared:

libxml2/2.9.10: run_in_windows_bash: C:\Users\spaceim\.conan_short\da178f\1\bin\usr\bin\bash.exe --login -c ^"cd \^"/c/users/spaceim/.conan/data/libxml2/2.9.10/_/_/build/1266ee60dda1924524275f8c386c3fd96c94fccf\^" ^&^& PATH=\^"/c/users/spaceim/.conan_short/da178f/1/bin/usr/bin:/c/users/spaceim/.conan/data/libiconv/1.16/_/_/package/bd8676182f1db70e6be16a57c45604fb7a6b0978/bin:$PATH\^" ^&^& make xmllint.exe xmlcatalog.exe xml2-config -j4 ^"
libxml2/2.9.10:   CC       xmllint.o
libxml2/2.9.10: make: « xml2-config » est à jour.
libxml2/2.9.10:   CC       xmlcatalog.o
libxml2/2.9.10:   CCLD     xmlcatalog.exe
libxml2/2.9.10:   CCLD     xmllint.exe
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmlcatalog.o:xmlcatalog.c:(.text+0x502): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmlcatalog.o:xmlcatalog.c:(.text.startup+0x1eb): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: collect2.exe: error: ld returned 1 exit status
libxml2/2.9.10: make: *** [Makefile:1148 : xmlcatalog.exe] Erreur 1
libxml2/2.9.10: make: *** Attente des tâches non terminées....
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmllint.o:xmllint.c:(.text+0xac5): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmllint.o:xmllint.c:(.text+0xc6f): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmllint.o:xmllint.c:(.text+0xd20): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmllint.o:xmllint.c:(.text+0xf2e): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmllint.o:xmllint.c:(.text+0x2f24): undefined reference to `__imp_xmlFree'
libxml2/2.9.10: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: xmllint.o:xmllint.c:(.text+0x49b9): more undefined references to `__imp_xmlFree' follow
libxml2/2.9.10: collect2.exe: error: ld returned 1 exit status
libxml2/2.9.10: make: *** [Makefile:1152 : xmllint.exe] Erreur 1
libxml2/2.9.10:

Maybe msys2/MSYS2-packages#171 or msys2/MSYS2-packages#1917 could help?

Would it work again by reverting MinGW modifications in #2149 (call Makefile.mingw again: e9e2843) ?


self.cpp_info.components["xml2lib"].names["pkg_config"] = "libxml-2.0"
self.cpp_info.filenames["cmake_find_package"] = "LibXml2"
self.cpp_info.filenames["cmake_find_package_multi"] = "LibXml2"
Copy link
Contributor

@SpaceIm SpaceIm Sep 25, 2020

Choose a reason for hiding this comment

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

So why not libxml2 (for cmake_find_package_multi only)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll remove the cmake_find_package.

Copy link
Contributor

Choose a reason for hiding this comment

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

why removing cmake_find_package? I'm a little bit lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just checked a output and the configuration creates libxml2-config.cmake.
So, as you said, it should set the cmake_find_package_multi name to libxml2.
So I think cmake_find_package should not be set.
Or should it be set to a hidden name? Like _libxml2.
Or should it be set to the same name as cmake_find_package_multi?

Copy link
Contributor

@SpaceIm SpaceIm Sep 25, 2020

Choose a reason for hiding this comment

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

LibXml2 for cmake_find_package is fine: https://cmake.org/cmake/help/latest/module/FindLibXml2.html

But all of this (module and config) doesn't require components (except if you anticipate "executable components")

So to resume:

  • cmake_find_package:
    • filename: LibXml2
    • importedtarget: LibXml2::LibXml2
  • cmake_find_package_multi:
    • filename: libxml2
    • importedtarget: whatever you want (let's say LibXml2::LibXml2)

@SpaceIm
Copy link
Contributor

SpaceIm commented Sep 25, 2020

@madebr please consider madebr#12

@madebr
Copy link
Contributor Author

madebr commented Sep 25, 2020

@SpaceIm

Does it not work on mingw@windows for you?

Maybe msys2/MSYS2-packages#171 or msys2/MSYS2-packages#1917 could help?

Would it work again by reverting MinGW modifications in #2149 (call Makefile.mingw again: e9e2843) ?

I don't think you added IN_LIBXML to cxxflags.

@conan-center-bot
Copy link
Collaborator

An unexpected error happened and has been reported. Help is on its way! 🏇

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libxml2/2.9.9' failed in build 6 (4f7f93cb0dc3c8d9fac1d796ec0680f243fef70e):

@SpaceIm
Copy link
Contributor

SpaceIm commented Oct 6, 2020

@SpaceIm
Does it not work on mingw@windows for you?

This is for #2708. For you own bug report btw.

Maybe msys2/MSYS2-packages#171 or msys2/MSYS2-packages#1917 could help?
Would it work again by reverting MinGW modifications in #2149 (call Makefile.mingw again: e9e2843) ?

I don't think you added IN_LIBXML to cxxflags.

IN_LIBXML is used for building to choose __declspec(dllexport) while building a shared build vs using __declspec(dllimport) when using a shared library.
LIBXML_STATIC should do the job.

Sorry I don't understand. With my MinGW, libxml2 shared doesn't work with autotools, this why I've restored makefile.mingw build.
Do you mean that libxml2 shared could work with autotools and some modifications based on IN_LIBXML?

@madebr
Copy link
Contributor Author

madebr commented Nov 1, 2020

Sorry I don't understand. With my MinGW, libxml2 shared doesn't work with autotools, this why I've restored makefile.mingw build.
Do you mean that libxml2 shared could work with autotools and some modifications based on IN_LIBXML?

@SpaceIm
I think you were correct. IN_LIBXML was needed + the utils linked to the wrong library (it selected the import library instead of the static library).
When looking at the c sources of libxml2, it looks like the libraries have #define IN_LIBXML defined at the top.

While trying out #3314 on mingw@Windows, I needed to apply these patches to libxml2 (libxml2 is a dependency of xmlsec)

Can you please review?

@conan-center-bot
Copy link
Collaborator

Some configurations of 'libxml2/2.9.9' failed in build 8 (cb50a554fcee34395bd8d024bd123033ef789337):

@ghost
Copy link

ghost commented Nov 16, 2020

I detected other pull requests that are modifying libxml2/all recipe:

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@stale
Copy link

stale bot commented Dec 17, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 17, 2020
@ghost ghost mentioned this pull request Dec 18, 2020
4 tasks
@stale
Copy link

stale bot commented Jan 17, 2021

This pull request has been automatically closed because it has not had recent activity. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[package] libxml2/2.9.10: fail to build with MinGW
7 participants