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

[question] libcurl/8.4.0: build fails - can't run m4 on msys2 gcc #26405

Open
RudolfRendier opened this issue Jan 17, 2025 · 4 comments
Open
Assignees
Labels
question Further information is requested

Comments

@RudolfRendier
Copy link

What is your question?

Hi! I have a problem with libcurl when trying to build it with conan 2.11. It worked before on conan 1.x
I have a CI-agent that has msys2 pre-installed with the compiler to run our builds.

-------- Installing package libcurl/8.11.1 (15 of 16) --------
libcurl/8.11.1: Building from source
libcurl/8.11.1: Package libcurl/8.11.1:f4dce8faf67fa2457b5dd4080902e114dab98fef
libcurl/8.11.1: Copying sources to build folder
libcurl/8.11.1: Building your package in D:\agent-vocamdev\_work\7\conan_cache\p\b\libcu6edaacfacc2e1\b
libcurl/8.11.1: Calling generate()
libcurl/8.11.1: Generators folder: D:\agent-vocamdev\_work\7\conan_cache\p\b\libcu6edaacfacc2e1\b\build-release\conan
libcurl/8.11.1: Generating aggregated env files
libcurl/8.11.1: Generated aggregated env files: ['conanbuild.sh', 'conanrun.bat']
libcurl/8.11.1: Calling build()
libcurl/8.11.1: RUN: autoreconf --force --install

autom4te: error: need GNU m4 1.4 or later: /d/agent-vocamdev/_work/7/conan_cache/p/b/m489829311a5955/p/bin/m4.exe
aclocal: error: /d/agent-vocamdev/_work/7/conan_cache/p/autocf2af015330354/p/bin/autom4te failed with exit status: 1
autoreconf: error: aclocal failed with exit status: 1

libcurl/8.11.1: ERROR: 
Package 'f4dce8faf67fa2457b5dd4080902e114dab98fef' build failed
libcurl/8.11.1: WARN: Build folder D:\agent-vocamdev\_work\7\conan_cache\p\b\libcu6edaacfacc2e1\b\build-release
ERROR: libcurl/8.11.1: Error in build() method, line 245
	autotools.autoreconf()
	ConanException: Error 1 while executing
##[error]Cmd.exe exited with code '1'.

It resembles this issue from 2023, but that has a workaround with building m4 from source.
I tried that and it doesn't work. (and the issue is something with glibc too)

conan install --requires=libcurl/8.11.1@ -pr:h=pr_mingw32.txt -pr:b=pr_mingw64.txt --build=libcurl* -build=automake* --build=m4*

Here's my profiles that cross-build for Windows x86:
Build:

[settings]
# We are cross building to x86
os=Windows
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=14
compiler.exception=dwarf2
os.subsystem=msys2
compiler.threads=posix

[options]

[tool_requires]
cmake/3.25.3
[buildenv]
CONAN_CMAKE_SYSTEM_NAME=Windows
CONAN_CMAKE_GENERATOR=MSYS Makefiles
# Workaround for https://github.com/msys2/msys2-runtime/issues/145
MSYS2_ARG_CONV_EXCL=--import=TYPES#
# Workaround for https://github.com/msys2/msys2-runtime/issues/109
MSYS=disable_pcon

# Prepend to path to find msys tooling first
PATH=+(path)c:/msys64/mingw64/bin/
[conf]
tools.build:compiler_executables={"cpp": "C:/msys64/mingw64/bin/g++.exe", "c": "C:/msys64/mingw64/bin/gcc.exe"}
tools.cmake.cmaketoolchain:generator=MSYS Makefiles

Host:

[settings]
# We are cross building to x86
os=Windows
arch=x86
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=14
compiler.cppstd=gnu17
compiler.exception=dwarf2
compiler.threads=mcf
os.subsystem=msys2

[options]

[tool_requires]
cmake/3.25.3
[buildenv]
CONAN_CMAKE_SYSTEM_NAME=Windows
CONAN_CMAKE_GENERATOR=MSYS Makefiles
# Workaround for https://github.com/msys2/msys2-runtime/issues/145
MSYS2_ARG_CONV_EXCL=--import=TYPES#
# Workaround for https://github.com/msys2/msys2-runtime/issues/109
MSYS=disable_pcon

# Prepend to path to find msys tooling first
PATH=+(path)c:/tools/mingw32/bin/
[conf]
tools.build:compiler_executables={"cpp": "C:/tools/mingw32/bin/g++.exe", "c": "C:/tools/mingw32/bin/gcc.exe"}
tools.cmake.cmaketoolchain:generator=MSYS Makefiles

When I try to run m4.exe manually it shows an error-dialog.
Image
This is probably because it finds the x86 libraries on the path first.

depends.exe shows this in red:
Image

Pre-pending the folder to the path resolves that (and that's how it's setup in the conan-profile too)

Image

But when I do that in a terminal, m4 freezes:

Image

What could be the issue here?

@RudolfRendier RudolfRendier added the question Further information is requested label Jan 17, 2025
@RudolfRendier
Copy link
Author

Adding this to my x64-build-profile didn't help:

[runenv]
PATH=+(path)c:/msys64/mingw64/bin/

@RudolfRendier
Copy link
Author

I believe the settings for MSYS Makefiles is incorrect here:

CONAN_CMAKE_GENERATOR=MSYS Makefiles
tools.cmake.cmaketoolchain:generator=MSYS Makefiles

Although I'm using msys2 with a mingw32-compiler; I don't think the msys2-shell is used by conan.
The build is executed using a regular command prompt, and thus the default; MinGW Makefiles is the correct option.

@memsharded
Copy link
Member

Hi @RudolfRendier

I am having a look, a couple of quick questions/comments:

  • Is the location c:/tools/mingw32/bin/ correct? Sure it is not c:/msys64/mingw32/bin/, like the other one? msys64 comes with both flavors 32/64 inside it, not sure why using 2 separate msys64 environments
  • The CONAN_XXX environment variables are no longer used in Conan 2 or even modern generators in Conan 1, can be dropped.
  • It seems the generator should be MinGW Makefiles. But when I am changing this, I get build errors in other packages like zlib that also needs to build (but it seems you removed them from your command line, I have to use a --build=missing, because there are no precompiled binaries for those packages either.
  • Note that ConanCenter recipes have something like:
            if self._settings_build.os == "Windows":
                  self.win_bash = True
                  if not self.conf.get("tools.microsoft.bash:path", check_type=str):
                      self.tool_requires("msys2/cci.latest")
    That means that packages are bringing their own msys2 environment from a Conan package, not the one you are defining. So the build of the dependencies and your own builds might be using different msys2 environments.

I am trying to reproduce, but it is taking some time to build everything. If the failure is in m4, it would be great to reduce the issue to something minimal, like a simple conanfile.py that has a tool_requires to m4, to remove all the possible moving pieces, and making sure there is a clean build from scratch too, with reproducible results.

@memsharded
Copy link
Member

Note the:

[tool_requires]
cmake/3.25.3

in profiles can be counter-productive when using ConanCenter recipes, as it effectively overrides possible recipes tool_requires("cmake/anyversion"), so if some package really needs a more modern version, it might fail. If some of the dependencies declared they need cmake/3.29, then the build of that recipe would most likely fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants