Skip to content

Fix MSVC 19.28+ issue with ByEdgeOrByMeterValue::by_edge and ByEdgeOrByMeterValue::by_meter definitions#6156

Merged
akashihi merged 2 commits intoProject-OSRM:masterfrom
mloskot:ml/fix-msvc-19-28-static-const-member
Nov 13, 2021
Merged

Fix MSVC 19.28+ issue with ByEdgeOrByMeterValue::by_edge and ByEdgeOrByMeterValue::by_meter definitions#6156
akashihi merged 2 commits intoProject-OSRM:masterfrom
mloskot:ml/fix-msvc-19-28-static-const-member

Conversation

@mloskot
Copy link
Copy Markdown
Member

@mloskot mloskot commented Nov 12, 2021

Issue

This is a workaround for discrepancy between MSVC 19.27 and 19.28
about static const member definition
https://developercommunity2.visualstudio.com/t/discrepancy-between-msvc-1927-vs-1928-about-static/1255338

Building Debug configuration with MSVC 19.28+ fails with:

osrm_extract.lib(extractor_callbacks.obj) : error LNK2001: unresolved external symbol
  "public: static struct osrm::extractor::detail::ByEdgeOrByMeterValue::ValueByEdge const osrm::extractor::detail::ByEdgeOrByMeterValue::by_edge"
osrm_extract.lib(extractor_callbacks.obj) : error LNK2001: unresolved external symbol
  "public: static struct osrm::extractor::detail::ByEdgeOrByMeterValue::ValueByMeter const osrm::extractor::detail::ByEdgeOrByMeterValue::by_meter"

We can not use C++17 inline variable as a workaround suggested
in the issue report linked above, because the sol2 does not
seem to compile in C++17 mode:

third_party/sol2/sol2/sol.hpp: error C2039: 'object_type': is not a member of...

Tasklist

…ByMeterValue::by_meter definitions

This is a workaround for discrepancy between MSVC 19.27 and 19.28
about static const member definition
https://developercommunity2.visualstudio.com/t/discrepancy-between-msvc-1927-vs-1928-about-static/1255338

We can not use C++17 inline variable as a workaround suggested
in the issue report linked above, because the sol2 does not
seem to compile in C++17 mode:

    third_party/sol2/sol2/sol.hpp: error C2039: 'object_type': is not a member of...
mloskot added a commit to Cadcorp/osrm-backend that referenced this pull request Nov 12, 2021
…st member definition

https://developercommunity2.visualstudio.com/t/discrepancy-between-msvc-1927-vs-1928-about-static/1255338

NOTE: We can not use C++17 inline variable as a workaround suggesed in the issue report,
because sol2 does not compile in C++17 mode:

   third_party/sol2/sol2/sol.hpp: error C2039: 'object_type': is not a member of...

So, we still build osrm-backend as C++14.

This fix was proposed to upstream Project-OSRM#6156

(cherry picked from commit 0754ef5 in cadcorp/5.25 branch)
@akashihi akashihi merged commit ff1af41 into Project-OSRM:master Nov 13, 2021
mloskot added a commit to Cadcorp/osrm-backend that referenced this pull request Mar 16, 2022
…st member definition

https://developercommunity2.visualstudio.com/t/discrepancy-between-msvc-1927-vs-1928-about-static/1255338

NOTE: We can not use C++17 inline variable as a workaround suggesed in the issue report,
because sol2 does not compile in C++17 mode:

   third_party/sol2/sol2/sol.hpp: error C2039: 'object_type': is not a member of...

So, we still build osrm-backend as C++14.

This fix was proposed to upstream Project-OSRM#6156

(cherry picked from commit 0754ef5 in cadcorp/5.25 branch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants