question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[package] libiconv/1.15: Fails to cross compile on windows

See original GitHub issue

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: libiconv/1.15
  • Operating System+version: Windows 10
  • Compiler+version: Visual Studio 2017 15.9.14
  • Conan version: conan 1.20.3
  • Python version: Python 3.8.0

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings]
os=Windows
os_build=Windows
arch=x86
arch_build=x86_64
compiler=Visual Studio
compiler.version=15
build_type=RelWithDebInfo
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

  1. conan remote add bincrafters "https://api.bintray.com/conan/bincrafters/public-conan"

  2. git clone https://github.com/bincrafters/conan-qt.git

  3. cd conan-qt

  4. git checkout stable/5.13.2

  5. conan create . qt/5.13.2@bincrafters/stable --build missing

Logs (Include/Attach if Applicable)

Click to expand log
libiconv/1.15: Applying build-requirement: msys2/20161025
libiconv/1.15: Copying sources to build folder
libiconv/1.15: Building your package in C:\projects\.conan\data\libiconv\1.15\_\_\build\d3c57f1b4faa70d5d60e94d8531667d77c8367ac
libiconv/1.15: Generator txt created conanbuildinfo.txt
libiconv/1.15: Calling build()
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.14
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'
libiconv/1.15: run_in_windows_bash: C:\projects\.conan\data\msys2\20161025\_\_\package\3cbd862cb7a3ea47ed1220dc027f344262d5224f\bin\usr\bin\bash.exe --login -c ^"cd \^"/c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder\^" ^&^& PATH=\^"/c/projects/.conan/data/msys2/20161025/_/_/package/3cbd862cb7a3ea47ed1220dc027f344262d5224f/bin/usr/bin:$PATH\^" ^&^& chmod +x build-aux/ar-lib build-aux/compile ^"
libiconv/1.15: Calling:
 > /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/configure --prefix=C:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac --enable-static --disable-shared CPPFLAGS=-IC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/include LDFLAGS=-LC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/lib RANLIB=: "CC=$PWD/build-aux/compile cl -nologo" CFLAGS=-MD "CXX=$PWD/build-aux/compile cl -nologo" CXXFLAGS=-MD "CPPFLAGS=-D_WIN32_WINNT=0x0600 -IC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/include" LDFLAGS=-LC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/lib LD=link "NM=dumpbin -symbols" STRIP=: "AR=$PWD/build-aux/ar-lib lib" RANLIB=: --host=i686-windows-msvc
libiconv/1.15: run_in_windows_bash: C:\projects\.conan\data\msys2\20161025\_\_\package\3cbd862cb7a3ea47ed1220dc027f344262d5224f\bin\usr\bin\bash.exe --login -c ^"cd \^"/c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder\^" ^&^& PATH=\^"/c/projects/.conan/data/msys2/20161025/_/_/package/3cbd862cb7a3ea47ed1220dc027f344262d5224f/bin/usr/bin:$PATH\^" ^&^& /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/configure --prefix=C:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac --enable-static --disable-shared CPPFLAGS=-IC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/include LDFLAGS=-LC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/lib RANLIB=: \^"CC=$PWD/build-aux/compile cl -nologo\^" CFLAGS=-MD \^"CXX=$PWD/build-aux/compile cl -nologo\^" CXXFLAGS=-MD \^"CPPFLAGS=-D_WIN32_WINNT=0x0600 -IC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/include\^" LDFLAGS=-LC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/lib LD=link \^"NM=dumpbin -symbols\^" STRIP=: \^"AR=$PWD/build-aux/ar-lib lib\^" RANLIB=: --host=i686-windows-msvc ^"
libiconv/1.15: configure: loading site script /mingw32/etc/config.site
libiconv/1.15: checking for a BSD-compatible install... /usr/bin/install -c
libiconv/1.15: checking whether build environment is sane... yes
libiconv/1.15: checking for i686-windows-msvc-strip... :
libiconv/1.15: checking for a thread-safe mkdir -p... /c/projects/.conan/data/msys2/20161025/_/_/package/3cbd862cb7a3ea47ed1220dc027f344262d5224f/bin/usr/bin/mkdir -p
libiconv/1.15: checking for gawk... gawk
libiconv/1.15: checking whether make sets $(MAKE)... yes
libiconv/1.15: checking whether make supports nested variables... yes
libiconv/1.15: checking whether make sets $(MAKE)... (cached) yes
libiconv/1.15: checking for i686-windows-msvc-gcc... /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/build-aux/compile cl -nologo
libiconv/1.15: checking whether the C compiler works... yes
libiconv/1.15: checking for C compiler default output file name... conftest.exe
libiconv/1.15: checking for suffix of executables... .exe
libiconv/1.15: checking whether we are cross compiling... no
libiconv/1.15: checking for suffix of object files... obj
libiconv/1.15: checking whether we are using the GNU C compiler... no
libiconv/1.15: checking whether /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/build-aux/compile cl -nologo accepts -g... no
libiconv/1.15: checking for /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/build-aux/compile cl -nologo option to accept ISO C89... none needed
libiconv/1.15: checking whether /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/build-aux/compile cl -nologo understands -c and -o together... yes
libiconv/1.15: checking for style of include used by make... GNU
libiconv/1.15: checking dependency style of /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/build-aux/compile cl -nologo... none
libiconv/1.15: checking how to run the C preprocessor... /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/build-aux/compile cl -nologo -E
libiconv/1.15: checking for strip... /c/projects/.conan/data/msys2/20161025/_/_/package/3cbd862cb7a3ea47ed1220dc027f344262d5224f/bin/usr/bin/strip
libiconv/1.15: checking build system type... i686-w64-mingw32
! libiconv/1.15: checking host system type... Invalid configuration `i686-windows-msvc': system `msvc' not recognized
! libiconv/1.15: configure: error: /bin/sh build-aux/config.sub i686-windows-msvc failed
libiconv/1.15: 
libiconv/1.15: WARN: Package is corrupted, removing folder: C:\projects\.conan\data\libiconv\1.15\_\_\package\d3c57f1b4faa70d5d60e94d8531667d77c8367ac
libiconv/1.15: WARN: Build folder is dirty, removing it: C:\projects\.conan\data\libiconv\1.15\_\_\build\d3c57f1b4faa70d5d60e94d8531667d77c8367ac
libiconv/1.15: WARN: Error running `configure --help`: Error 1 while executing /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/configure --help
libiconv/1.15: ERROR: Package 'd3c57f1b4faa70d5d60e94d8531667d77c8367ac' build failed
libiconv/1.15: WARN: Build folder C:\projects\.conan\data\libiconv\1.15\_\_\build\d3c57f1b4faa70d5d60e94d8531667d77c8367ac
ERROR: libiconv/1.15: Error in build() method, line 115
	self._build_autotools()
while calling '_build_autotools', line 109
	env_build.configure(args=configure_args, host=host, build=build)
	ConanException: Error 1 while executing /c/projects/.conan/data/libiconv/1.15/_/_/build/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/source_subfolder/configure --prefix=C:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac --enable-static --disable-shared CPPFLAGS=-IC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/include LDFLAGS=-LC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/lib RANLIB=: "CC=$PWD/build-aux/compile cl -nologo" CFLAGS=-MD "CXX=$PWD/build-aux/compile cl -nologo" CXXFLAGS=-MD "CPPFLAGS=-D_WIN32_WINNT=0x0600 -IC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/include" LDFLAGS=-LC:/projects/.conan/data/libiconv/1.15/_/_/package/d3c57f1b4faa70d5d60e94d8531667d77c8367ac/lib LD=link "NM=dumpbin -symbols" STRIP=: "AR=$PWD/build-aux/ar-lib lib" RANLIB=: --host=i686-windows-msvc

Context

I’m trying to cross compile Qt 5.13.2 on Windows using VS2017 15.9.14, but the Qt package fails when cross compiling one of its dependencies: libiconv/1.15.

Worth noting, if I change my profile to purposefully target x64 bit binaries, libiconv/1.15 seems to build okay

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
thorntonryancommented, Feb 4, 2020

So, cross_building defaults its value of build_arch to the detected_architecture(), which I assume is being derived based on ~whether conan / Python are 32 or 64 bit~ some heuristic I can’t figure out how to circumvent … grrr.

~I think it should work if I were to use a 32 bit version of conan / Python…~

Ok, so detected_architecture() falls because it relies on a simple heuristic coming from here: https://github.com/conan-io/conan/blob/eadcd70ec7ccedc6d90b5360feff421e46cc6582/conans/client/tools/oss.py#L69

Which relies on platform.machine which comes from lib/platform.py

On Windows, this appears to look at the environment variable PROCESSOR_ARCHITECTURE, which reported AMD64, thus triggering cross_building to report True.

I can trick this Conan package to pretend it’s not cross-compiling by setting the following environment variable:

SET PROCESSOR_ARCHITECTURE=i386

This allows me to create the package without modifying the package recipe (suggested by @kunitsyn)

0reactions
akemimadokacommented, Mar 19, 2020

Seems it’s my fault, here should be an exception for msvc cross building.

But when I changed host to i686-w64-mingw32 by changing if not tools.cross_building(self.settings) to if not tools.cross_building(self.settings) or self._is_msvc: I got “fatal error LNK1112: module machine type ‘x64’ conflicts with target machine type ‘X86’”, seems here are more works to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing "libiconv.h" when crosscompiling for Windows with ...
I'm assuming your mingw crosscompiler is installed in /usr/x86_64-w64-mingw32, change it to the installation path where his "include" and "lib" ...
Read more >
MXE (M cross environment)
Introduction. MXE (M cross environment) is a GNU Makefile that compiles a cross compiler and cross compiles many free libraries such as SDL...
Read more >
Cross compile problem - glib and libiconv
I'm trying to cross compile GTK+ 2.4.4 for uClinux running on the ARM, ... I can configure, make and make install libiconv with...
Read more >
Troubleshooting — conan 1.16.1 documentation
Maybe the package creator didn't build and shared pre-built packages at all and only uploaded the package recipe, or maybe they are only...
Read more >
MXE (M cross environment) - R Developer Page
Compiler and runtime: MinGW-w64. Target OS, Packages. Static, Shared. 32 bit Windows, 99% (379/381), 72% ( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found