Skip to content

[many ports] Support building with MinGW toolchain#8940

Merged
ras0219-msft merged 7 commits intomicrosoft:masterfrom
koprok:mingw
Feb 12, 2020
Merged

[many ports] Support building with MinGW toolchain#8940
ras0219-msft merged 7 commits intomicrosoft:masterfrom
koprok:mingw

Conversation

@koprok
Copy link
Contributor

@koprok koprok commented Nov 7, 2019

Fixes necessary to build some packages with MinGW toolchain in Debian 9. Custom triplet file and CMake toolchain file is not included.

@JackBoosY
Copy link
Contributor

/azp run

@grdowns grdowns changed the title Some package fixes necessary to build with MinGW toolchain [many ports] Support building with MinGW toolchain Nov 19, 2019
@JackBoosY
Copy link
Contributor

Error in Windows:

Included: .\config.msvc
	link.exe /nologo /LIBPATH:\bin.msvc /LIBPATH:C:\vsts\_work\2\s\packages\libxslt_x86-windows\debug\lib /DEBUG /DLL  /VERSION:1.1  /IMPLIB:\bin.msvc\libxslt.lib /OUT:\bin.msvc\libxslt.dll  \int.xslt.msvc\attributes.obj \int.xslt.msvc\documents.obj \int.xslt.msvc\extensions.obj \int.xslt.msvc\extra.obj \int.xslt.msvc\functions.obj \int.xslt.msvc\imports.obj \int.xslt.msvc\keys.obj \int.xslt.msvc\namespaces.obj \int.xslt.msvc\numbers.obj \int.xslt.msvc\pattern.obj \int.xslt.msvc\preproc.obj \int.xslt.msvc\security.obj \int.xslt.msvc\templates.obj \int.xslt.msvc\transform.obj \int.xslt.msvc\variables.obj \int.xslt.msvc\xslt.obj \int.xslt.msvc\xsltlocale.obj \int.xslt.msvc\xsltutils.obj \int.xslt.msvc\attrvt.obj wsock32.lib libiconv.lib libcharset.lib zlibd.lib lzmad.lib libxml2.lib
MSVCRTD.lib(chkstk.obj) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM'

@JackBoosY
Copy link
Contributor

/azp run

@koprok
Copy link
Contributor Author

koprok commented Nov 20, 2019

Error in Windows:

Included: .\config.msvc
	link.exe /nologo /LIBPATH:\bin.msvc /LIBPATH:C:\vsts\_work\2\s\packages\libxslt_x86-windows\debug\lib /DEBUG /DLL  /VERSION:1.1  /IMPLIB:\bin.msvc\libxslt.lib /OUT:\bin.msvc\libxslt.dll  \int.xslt.msvc\attributes.obj \int.xslt.msvc\documents.obj \int.xslt.msvc\extensions.obj \int.xslt.msvc\extra.obj \int.xslt.msvc\functions.obj \int.xslt.msvc\imports.obj \int.xslt.msvc\keys.obj \int.xslt.msvc\namespaces.obj \int.xslt.msvc\numbers.obj \int.xslt.msvc\pattern.obj \int.xslt.msvc\preproc.obj \int.xslt.msvc\security.obj \int.xslt.msvc\templates.obj \int.xslt.msvc\transform.obj \int.xslt.msvc\variables.obj \int.xslt.msvc\xslt.obj \int.xslt.msvc\xsltlocale.obj \int.xslt.msvc\xsltutils.obj \int.xslt.msvc\attrvt.obj wsock32.lib libiconv.lib libcharset.lib zlibd.lib lzmad.lib libxml2.lib
MSVCRTD.lib(chkstk.obj) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM'

@JackBoosY I believe this error has nothing to do with my changes. Maybe I should rebase my branch and then run the checks again?

@JackBoosY
Copy link
Contributor

x86-windows test notes
spatialite-tools Pass
readosm Pass
libxslt Fail Regression

@koprok Could you test to install libxslt:x86-windows ?

@JackBoosY
Copy link
Contributor

/azp run

@koprok
Copy link
Contributor Author

koprok commented Nov 21, 2019

@JackBoosY I can install libxslt without any problems. Here is the log from my PC:

PS C:\koprok\vcpkg> .\bootstrap-vcpkg.bat                                                                                                                                                               
Building vcpkg.exe ...

  pch.cpp
  archives.cpp
  checks.cpp
  chrono.cpp
  cofffilereader.cpp
  downloads.cpp
  enums.cpp
  files.cpp
  hash.cpp
  machinetype.cpp
  strings.cpp
  stringview.cpp
  system.cpp
  system.print.cpp
  binaryparagraph.cpp
  build.cpp
  commands.autocomplete.cpp
  commands.buildexternal.cpp
  commands.cache.cpp
  commands.ci.cpp
  commands.contact.cpp
  commands.cpp
  commands.create.cpp
  commands.dependinfo.cpp
  commands.edit.cpp
  commands.env.cpp
  commands.exportifw.cpp
  commands.import.cpp
  commands.integrate.cpp
  commands.list.cpp
  commands.owns.cpp
  commands.porthistory.cpp
  commands.portsdiff.cpp
  commands.search.cpp
  commands.upgrade.cpp
  commands.version.cpp
  commands.xvsinstances.cpp
  dependencies.cpp
  export.cpp
  globalstate.cpp
  help.cpp
  input.cpp
  install.cpp
  logicexpression.cpp
  metrics.cpp
  packagespec.cpp
  packagespecparseresult.cpp
  paragraphparseresult.cpp
  paragraphs.cpp
  parse.cpp
  postbuildlint.buildtype.cpp
  postbuildlint.cpp
  remove.cpp
  sourceparagraph.cpp
  statusparagraph.cpp
  statusparagraphs.cpp
  tools.cpp
  triplet.cpp
  update.cpp
  userconfig.cpp
  vcpkgcmdarguments.cpp
  vcpkglib.cpp
  vcpkgpaths.cpp
  versiont.cpp
  visualstudio.cpp
  vcpkglib.vcxproj -> C:\koprok\vcpkg\toolsrc\msbuild.x86.release\vcpkglib.lib
  vcpkg.cpp
  Generating code
  Previous IPDB not found, fall back to full compilation.
  All 14696 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code
  vcpkg.vcxproj -> C:\koprok\vcpkg\toolsrc\msbuild.x86.release\vcpkg.exe
  vcpkgmetricsuploader.cpp
  Generating code
  Previous IPDB not found, fall back to full compilation.
  All 5084 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code
  vcpkgmetricsuploader.vcxproj -> C:\koprok\vcpkg\toolsrc\msbuild.x86.release\vcpkgmetricsuploader.exe

Building vcpkg.exe... done.

PS C:\koprok\vcpkg> .\vcpkg.exe install libxslt:x86-windows                                                                                                                                             The following packages will be built and installed:
  * libiconv[core]:x86-windows
  * liblzma[core]:x86-windows
  * libxml2[core]:x86-windows
    libxslt[core]:x86-windows
  * zlib[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/5: zlib:x86-windows
Building package zlib[core]:x86-windows...
A suitable version of cmake was not found (required v3.14.0). Downloading portable cmake v3.14.0...
Downloading cmake...
  https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-win32-x86.zip -> C:\koprok\vcpkg\downloads\cmake-3.14.0-win32-x86.zip
Extracting cmake...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
  https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\koprok\vcpkg\downloads\7-zip.commandline.18.1.0.nupkg
Extracting 7zip...
A suitable version of nuget was not found (required v4.6.2). Downloading portable nuget v4.6.2...
Downloading nuget...
  https://dist.nuget.org/win-x86-commandline/v4.6.2/nuget.exe -> C:\koprok\vcpkg\downloads\nuget.exe
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Downloading powershell-core...
  https://github.com/PowerShell/PowerShell/releases/download/v6.2.1/PowerShell-6.2.1-win-x86.zip -> C:\koprok\vcpkg\downloads\PowerShell-6.2.1-win-x86.zip
Extracting powershell-core...
A suitable version of git was not found (required v2.21.0). Downloading portable git v2.21.0...
Downloading git...
  https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/PortableGit-2.21.0-32-bit.7z.exe -> C:\koprok\vcpkg\downloads\PortableGit-2.21.0-32-bit.7z.exe
Extracting git...
-- Downloading http://www.zlib.net/zlib-1.2.11.tar.gz...
-- Extracting source C:/koprok/vcpkg/downloads/zlib1211.tar.gz
-- Applying patch cmake_dont_build_more_than_needed.patch
-- Using source at C:/koprok/vcpkg/buildtrees/zlib/src/1.2.11-f690224aeb
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: C:/koprok/vcpkg/packages/zlib_x86-windows/share/zlib/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package zlib[core]:x86-windows... done
Installing package zlib[core]:x86-windows...
Installing package zlib[core]:x86-windows... done
Elapsed time for package zlib:x86-windows: 1.335 min
Starting package 2/5: libiconv:x86-windows
Building package libiconv[core]:x86-windows...
-- Downloading https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz...
-- Extracting source C:/koprok/vcpkg/downloads/libiconv-1.15.tar.gz
-- Applying patch 0001-Add-export-definitions.patch
-- Applying patch 0002-Config-for-MSVC.patch
-- Using source at C:/koprok/vcpkg/buildtrees/libiconv/src/1.15-a8068c764e
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: C:/koprok/vcpkg/packages/libiconv_x86-windows/share/libiconv/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package libiconv[core]:x86-windows... done
Installing package libiconv[core]:x86-windows...
Installing package libiconv[core]:x86-windows... done
Elapsed time for package libiconv:x86-windows: 11.94 s
Starting package 3/5: liblzma:x86-windows
Building package liblzma[core]:x86-windows...
-- Downloading https://github.com/xz-mirror/xz/archive/v5.2.4.tar.gz...
-- Extracting source C:/koprok/vcpkg/downloads/xz-mirror-xz-v5.2.4.tar.gz
-- Applying patch enable-uwp-builds.patch
-- Using source at C:/koprok/vcpkg/buildtrees/liblzma/src/v5.2.4-66bfe33102
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: C:/koprok/vcpkg/packages/liblzma_x86-windows/share/liblzma/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package liblzma[core]:x86-windows... done
Installing package liblzma[core]:x86-windows...
Installing package liblzma[core]:x86-windows... done
Elapsed time for package liblzma:x86-windows: 20.09 s
Starting package 4/5: libxml2:x86-windows
Building package libxml2[core]:x86-windows...
-- Downloading https://github.com/GNOME/libxml2/archive/v2.9.9.tar.gz...
-- Extracting source C:/koprok/vcpkg/downloads/GNOME-libxml2-v2.9.9.tar.gz
-- Using source at C:/koprok/vcpkg/buildtrees/libxml2/src/v2.9.9-8b0649afae
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package libxml2[core]:x86-windows... done
Installing package libxml2[core]:x86-windows...
Installing package libxml2[core]:x86-windows... done
Elapsed time for package libxml2:x86-windows: 22.23 s
Starting package 5/5: libxslt:x86-windows
Building package libxslt[core]:x86-windows...
-- Downloading https://github.com/GNOME/libxslt/archive/v1.1.33.tar.gz...
-- Extracting source C:/koprok/vcpkg/downloads/GNOME-libxslt-v1.1.33.tar.gz
-- Applying patch 0001-Fix-makefile.patch
-- Applying patch 0002-Fix-lzma.patch
-- Using source at C:/koprok/vcpkg/buildtrees/libxslt/src/v1.1.33-8a8517c582
Prerunning x86-windows-dbg
-- Building and installing x86-windows-dbg
Prerunning x86-windows-rel
-- Building and installing x86-windows-rel
-- Warning: Could not find a matching pdb file for:
    C:/koprok/vcpkg/packages/libxslt_x86-windows/bin/libexslt.dll
    C:/koprok/vcpkg/packages/libxslt_x86-windows/bin/libxslt.dll
    C:/koprok/vcpkg/packages/libxslt_x86-windows/debug/bin/libexslt.dll
    C:/koprok/vcpkg/packages/libxslt_x86-windows/debug/bin/libxslt.dll

-- Installing: C:/koprok/vcpkg/packages/libxslt_x86-windows/share/libxslt/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package libxslt[core]:x86-windows... done
Installing package libxslt[core]:x86-windows...
Installing package libxslt[core]:x86-windows... done
Elapsed time for package libxslt:x86-windows: 38.32 s

Total elapsed time: 2.878 min

PS C:\koprok\vcpkg>  

@koprok
Copy link
Contributor Author

koprok commented Dec 16, 2019

@JackBoosY, now after this branch builds also on Windows, could you please review it again?

Copy link
Contributor

@JackBoosY JackBoosY left a comment

Choose a reason for hiding this comment

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

Since the port boost-modular-build-helper has changed, please correct its version in the file CONTROL.
See documentation.

@koprok
Copy link
Contributor Author

koprok commented Dec 16, 2019

@JackBoosY, about the VCPKG_TARGET_IS_WINDOWS changes. I know that MinGW is not officially supported in Vcpkg. But anyway, can you suggest some better way to make difference between Windows/MSVC and Windows/MinGW? When building with MinGW toolchain, the target is still Windows, so this if statement is a little bit misleading, although it works fine in this case.

@koprok koprok requested a review from JackBoosY December 16, 2019 10:23
@JackBoosY
Copy link
Contributor

/azp run

@JackBoosY
Copy link
Contributor

When buiding libraqm:x64-windows-static:

-- Found FriBidi: C:/vsts/_work/4/s/installed/x64-windows/debug/lib/fribidi.lib  
CMake Error: Could not open file for write in copy operation C:/vsts/_work/4/s/buildtrees/libraqm/src/v0.7.0-bcd3cf2fa3/src/raqm-version.h.tmp
CMake Error: : System Error: Permission denied
CMake Error at CMakeLists.txt:16 (configure_file):
  configure_file Problem configuring file

@koprok koprok force-pushed the mingw branch 3 times, most recently from 5333c35 to 8d85db0 Compare December 17, 2019 10:41
@koprok
Copy link
Contributor Author

koprok commented Dec 17, 2019

When buiding libraqm:x64-windows-static:

-- Found FriBidi: C:/vsts/_work/4/s/installed/x64-windows/debug/lib/fribidi.lib  
CMake Error: Could not open file for write in copy operation C:/vsts/_work/4/s/buildtrees/libraqm/src/v0.7.0-bcd3cf2fa3/src/raqm-version.h.tmp
CMake Error: : System Error: Permission denied
CMake Error at CMakeLists.txt:16 (configure_file):
  configure_file Problem configuring file

This is not related to my MinGW changes, but it is easy to fix, so I have pushed a new commit to fix it.

@koprok
Copy link
Contributor Author

koprok commented Dec 17, 2019

@JackBoosY, so everything builds successfully again. Is it anything more I can do to get this merged into master? :-)

@koprok
Copy link
Contributor Author

koprok commented Jan 22, 2020

@JackBoosY, all pipelines should be passing now. OS X fails because of some error not related to the code.

@JackBoosY
Copy link
Contributor

@koprok I will test it manually.

@JackBoosY
Copy link
Contributor

/azp run

@JackBoosY
Copy link
Contributor

When building fribidi, error shows:

  File "/usr/local/bin/meson", line 2
    PYTHONPATH="/usr/local/Cellar/meson/0.53.0/lib/python3.7/site-packages" exec "/usr/local/Cellar/meson/0.53.0/libexec/bin/meson" "$@"
                                                                               ^
SyntaxError: invalid syntax

@koprok
Copy link
Contributor Author

koprok commented Jan 22, 2020

When building fribidi, error shows:

  File "/usr/local/bin/meson", line 2
    PYTHONPATH="/usr/local/Cellar/meson/0.53.0/lib/python3.7/site-packages" exec "/usr/local/Cellar/meson/0.53.0/libexec/bin/meson" "$@"
                                                                               ^
SyntaxError: invalid syntax

@JackBoosY this looks to me like some issue with the build environment that you are using

@vicroms
Copy link
Member

vicroms commented Jan 23, 2020

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@koprok
Copy link
Contributor Author

koprok commented Jan 24, 2020

@JackBoosY, @vicroms, all pipelines have passed, finally! Ready to merge now?

@JackBoosY
Copy link
Contributor

@koprok Did you test the related features(such as ffmpeg)?

@koprok
Copy link
Contributor Author

koprok commented Feb 2, 2020

@JackBoosY, I have tested only glew. Zlib, bzip2 and ffmpeg are dependencies that are needed by some other libraries that I use. For now it is enough for my project that these can be built successfully with MinGW, but I have not tested them personally. Later maybe I will actually use ffmpeg, but the first step is to be able to build it, right? :)

@JackBoosY JackBoosY added the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Feb 3, 2020
@JackBoosY
Copy link
Contributor

/azp run

1 similar comment
@ras0219-msft
Copy link
Contributor

/azp run

@JackBoosY JackBoosY removed the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Feb 7, 2020
Copy link
Contributor

@JackBoosY JackBoosY left a comment

Choose a reason for hiding this comment

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

Can you remove the following content from VCPKG_PATH/scirpts/ci.baseline.txt?

kd-soap:x64-linux=fail
jsonnet:x64-osx=fail

@JackBoosY JackBoosY added the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Feb 10, 2020
@ras0219-msft ras0219-msft merged commit f478be7 into microsoft:master Feb 12, 2020
@ras0219-msft
Copy link
Contributor

Awesome work, thanks everyone!

@koprok koprok deleted the mingw branch February 12, 2020 10:08
KineticTheory pushed a commit to KineticTheory/vcpkg that referenced this pull request Feb 17, 2020
* Some package fixes necessary to build with MinGW toolchain

* [libraqm] Fix build error caused by trying to write to source directory

* [tmxparser] Fix build failure when tmx port is intalled before tmxparser port

System include path was added first on compiler command line. This leads to
build failure when there is a tmx.h header file in system include path.

* [qt5-base][angle] Trigger CI rebuild

* [kd-soap] Fix build error

* Update ci.baseline

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants