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

Improve precompiled binary package compatibility on windows/msvc #1513

Closed
waruqi opened this issue Jul 13, 2021 · 14 comments
Closed

Improve precompiled binary package compatibility on windows/msvc #1513

waruqi opened this issue Jul 13, 2021 · 14 comments
Milestone

Comments

@waruqi
Copy link
Member

waruqi commented Jul 13, 2021

issue1

vs2017

xmake-io/xmake-repo#496

opencv_core452.lib(parallel.cpp.obj) : error LNK2001: 无法解析的外部符号 __GSHandlerCheck_EH4

issue2

vs2013

https://ci.appveyor.com/project/waruqi/xmake/builds/39973970

png.lib(pngerror.c.obj) : error LNK2019: unresolved external symbol __imp___acrt_iob_func referenced in function png_warning
png.lib(pngerror.c.obj) : error LNK2019: unresolved external symbol __imp___stdio_common_vfprintf referenced in function _vfprintf_l
C:\Users\appveyor\AppData\Local\Temp\1.xmake\210713_E361ED7D2D2D413086531D03EFBCE430.b : fatal error LNK1120: 2 unresolved externals

@waruqi waruqi added this to the v2.5.6 milestone Jul 13, 2021
@waruqi
Copy link
Member Author

waruqi commented Jul 13, 2021

https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=msvc-160

You can mix binaries built by different versions of the v140, v141, and v142 toolsets. However, you must link by using a toolset at least as recent as the most recent binary in your app. Here's an example: you can link an app compiled using any 2017 toolset (v141, versions 15.0 through 15.9) to a static library compiled using, say, Visual Studio 2019 version 16.2 (v142), if they're linked using a version 16.2 or later toolset. You can link a version 16.2 library to a version 16.4 app as long as you use a 16.4 or later toolset.

@xq114
Copy link
Contributor

xq114 commented Jul 13, 2021

so it's just backwards compatible

@waruqi
Copy link
Member Author

waruqi commented Jul 13, 2021

ok, I only need to use vs2015 to compile all libraries, and only support pre-compiled binaries for compilers above 2015?

@xq114
Copy link
Contributor

xq114 commented Jul 13, 2021

ok, I only need to use vs2015 to compile all libraries, and only support pre-compiled binaries for compilers above 2015?

If it's applicable it would be good the precompiled binary from the latest visual studio is provided besides the compatibility version, since better performance could be gained with a more recent compiler

@waruqi
Copy link
Member Author

waruqi commented Jul 13, 2021

ok, I only need to use vs2015 to compile all libraries, and only support pre-compiled binaries for compilers above 2015?

If it's applicable it would be good the precompiled binary from the latest visual studio is provided besides the compatibility version, since better performance could be gained with a more recent compiler

Will do this, and I think it should be better to identify based on the toolset version instead of the vs version.

@waruqi
Copy link
Member Author

waruqi commented Jul 13, 2021

In addition, I don’t know if github action has native support for switching msvc toolset, but I saw this

https://github.com/ilammy/msvc-dev-cmd

@xq114
Copy link
Contributor

xq114 commented Jul 15, 2021

actions/runner-images#387

GitHub Actions is not plan to support VS2015 any more. It would be better switch to AppVeyor or some other ci platform.

@waruqi
Copy link
Member Author

waruqi commented Jul 15, 2021

actions/virtual-environments#387

GitHub Actions is not plan to support VS2015 any more. It would be better switch to AppVeyor or some other ci platform.

I saw that github ci has vs2015 and vs2019, I will switch to 2015 later

https://github.com/xmake-mirror/build-artifacts/runs/3076171663?check_suite_focus=true

@waruqi
Copy link
Member Author

waruqi commented Jul 16, 2021

actions/virtual-environments#387

GitHub Actions is not plan to support VS2015 any more. It would be better switch to AppVeyor or some other ci platform.

The free plan of other ci does not support parallel compilation and will be very slow.

@waruqi
Copy link
Member Author

waruqi commented Jul 16, 2021

GitHub ci has vs2015 but there is no corresponding msbuild/v140 configuration path. ohmm..

@waruqi
Copy link
Member Author

waruqi commented Jul 16, 2021

Maybe at present I can only limit to >= vs2019 to support pre-compiled packages

@waruqi
Copy link
Member Author

waruqi commented Jul 16, 2021

But I see that the toolset version in vs2019 used on the github action is 14.29, which means that as long as the user's compiler toolset >=14.2, it should be compatible.

Maybe some users' VS2017 toolset can also match this requirement.

@waruqi
Copy link
Member Author

waruqi commented Jul 17, 2021

I have improved xmake dev, and only enable pre-compiled installation for toolset >= 14.29 on ci

The pre-compilation service has also been adjusted, version 2.5.5 can only temporarily disable the new pre-compiled package, and wait for the subsequent xmake release

In addition, dynamic libraries and executable packages are not affected by toolset

@waruqi
Copy link
Member Author

waruqi commented Jul 17, 2021

Now, I have added v14.16 toolset pre-compiled package support, which can support compilers above vs2017.

  • 14.16 (vs2017 on windows-2016)
  • 14.29 (vs2019 on windows-latest)

If the user has a higher version compiler, the 14.29 toolset package will be selected first.

https://github.com/xmake-mirror/build-artifacts/blob/main/packages/o/opencv/4.5.2/manifest.txt

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

No branches or pull requests

2 participants