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

[qt5]Fix static build failure in windows #7108

Closed
wants to merge 15 commits into from
Closed

[qt5]Fix static build failure in windows #7108

wants to merge 15 commits into from

Conversation

JackBoosY
Copy link
Contributor

@JackBoosY JackBoosY commented Jul 1, 2019

  1. The option staticlib is no longer supported in static builds, replacing it with static.
  2. Now we don't need to use qmake_all to build qt5 and other modules in windows-static, it seems to break the disabled parameters during the build. See documentation.

Fix the failure of qt5 module build in windows-static (caused by #5293):

  • qt5-base
  • qt5-3d
  • qt5-activeqt : only support Windows
  • qt5-charts
  • qt5-connectivity
  • qt5-datavis3d
  • qt5-declarative
  • qt5-gamepad
  • qt5-graphicaleffects
  • qt5-imageformats
  • qt5-location
  • qt5-macextras : only support OSX
  • qt5-modularscripts
  • qt5-mqtt
  • qt5-multimedia
  • qt5-networkauth
  • qt5-purchasing
  • qt5-quickcontrols
  • qt5-quickcontrols2
  • qt5-remoteobjects
  • qt5-script
  • qt5-scxml
  • qt5-sensors
  • qt5-serialport
  • qt5-speech
  • qt5-svg
  • qt5-tools
  • qt5-virtualkeyboard
  • qt5-webchannel
  • qt5-websockets
  • qt5-webview
  • qt5-winextras : only support Windows
  • qt5-xmlpatterns

Related: #4560 #6240 #5881 #731 #513.

NOTE: Need to wait for PR #7230 to merge.

@JackBoosY JackBoosY added the info:internal This PR or Issue was filed by the vcpkg team. label Jul 1, 2019
@JackBoosY
Copy link
Contributor Author

JackBoosY commented Jul 3, 2019

  1. There will be some errors when using vcpkg freetype:
   Creating library ..\..\bin\qml.lib and object ..\..\bin\qml.exp
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressInit referenced in function ft_bzip2_file_init
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompress referenced in function ft_bzip2_file_fill_output
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressEnd referenced in function ft_bzip2_file_done
..\..\bin\qml.exe : fatal error LNK1120: 3 unresolved externals
   Creating library ..\..\bin\qmleasing.lib and object ..\..\bin\qmleasing.exp
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressInit referenced in function ft_bzip2_file_init
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompress referenced in function ft_bzip2_file_fill_output
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressEnd referenced in function ft_bzip2_file_done
..\..\bin\qmleasing.exe : fatal error LNK1120: 3 unresolved externals

I am temporarily unable to solve these problems, so temporarily use qt5 built-in freetype source.

  1. We need to use qtmain.lib/qtmaind.lib when building qt5-declarative, but its path is wrong. Although this path was fixed in qt5-base/fixcmake.py, bug it obviously didn't work.
    So I temporarily commented on these codes to delete this library, waiting for the issue to be fixed later.

  2. I found that there is no need to delete several library code directories built into source/src/3rdparty/, we just need to add compile flag -system-portname and set their path, @ras0219-msft can you confirm this?

@JackBoosY JackBoosY requested a review from ras0219-msft July 5, 2019 06:29
@JackBoosY JackBoosY mentioned this pull request Jul 8, 2019
@heydojo
Copy link
Contributor

heydojo commented Jul 15, 2019

There will be some errors when using vcpkg freetype:

The windows port doesn't need to compile against freetype. https://doc.qt.io/archives/qt-5.11/qtgui-attribution-freetype.html

Configure with -no-freetype, or -system-freetype to avoid.

Creating library ..\..\bin\qml.lib and object ..\..\bin\qml.exp
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressInit referenced in function ft_bzip2_file_init
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompress referenced in function ft_bzip2_file_fill_output
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressEnd referenced in function ft_bzip2_file_done
..\..\bin\qml.exe : fatal error LNK1120: 3 unresolved externals
   Creating library ..\..\bin\qmleasing.lib and object ..\..\bin\qmleasing.exp
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressInit referenced in function ft_bzip2_file_init
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompress referenced in function ft_bzip2_file_fill_output
freetyped.lib(ftbzip2.c.obj) : error LNK2019: unresolved external symbol BZ2_bzDecompressEnd referenced in function ft_bzip2_file_done
..\..\bin\qmleasing.exe : fatal error LNK1120: 3 unresolved externals

https://github.com/microsoft/vcpkg/blob/master/ports/qt5-base/portfile.cmake#L41

The back slashes in your code snippet give it away that it was compiled on Windows. And I can see that -system-freetype exists inside of the configure step of the port file.

Does this then mean that there needs to be a conditional for Windows which uses -no-freetype instead of -system-freetype in the configure section of the port file?
The Windows code really should not be compiled against freetype.

@Rastaban
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JackBoosY
Copy link
Contributor Author

Since qt5-linux has been fixed, create a new PR #7313 to solve this issue.

@JackBoosY JackBoosY closed this Jul 18, 2019
@JackBoosY JackBoosY deleted the dev/jack/fix_qt5_windows_static branch August 12, 2019 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info:internal This PR or Issue was filed by the vcpkg team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants