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

Revert "Make shared libraries be able to link to MSVC static runtime libraries, so that VC runtime is not required." #6914

Merged
merged 9 commits into from Nov 20, 2019

Conversation

rafi-kamal
Copy link
Contributor

This reverts commit 129a7c8. We are seeing errors when building Python release artifacts in Windows:
"error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj".

rafi-kamal and others added 8 commits November 19, 2019 15:45
Co-Authored-By: ObsidianMinor <ObsidianMinor@users.noreply.github.com>
…libraries, so that VC runtime is not required."

This reverts commit 129a7c8. We are
seeing errors when building Python release artifacts in Windows:
" error LNK2038: mismatch detected for 'RuntimeLibrary': value
'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in
descriptor.obj".
@rafi-kamal
Copy link
Contributor Author

Detailed error message (sponge link):

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -I. -I../src -IC:\python37\include -IC:\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /EHsc /Tpgoogle/protobuf/pyext\unknown_fields.cc /Fobuild\temp.win-amd64-3.7\Release\google/protobuf/pyext\unknown_fields.obj -D_hypot=hypot -DMS_WIN64 /MT
unknown_fields.cc
c:\python37\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
c:\python37\include\pyconfig.h(117): note: command-line arguments:  see previous definition of 'MS_WIN64'
google/protobuf/pyext\unknown_fields.cc(231): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
google/protobuf/pyext\unknown_fields.cc(280): warning C4244: 'argument': conversion from 'google::protobuf::uint64' to 'long', possible loss of data
google/protobuf/pyext\unknown_fields.cc(286): warning C4244: 'argument': conversion from 'google::protobuf::uint64' to 'long', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:libucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:../src/.libs /LIBPATH:C:\python37\libs /LIBPATH:C:\python37\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\um\x64" /EXPORT:PyInit__message build\temp.win-amd64-3.7\Release\google/protobuf/pyext\descriptor.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\descriptor_containers.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\descriptor_database.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\descriptor_pool.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\extension_dict.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\field.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\map_container.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\message.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\message_factory.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\message_module.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\repeated_composite_container.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\repeated_scalar_container.obj build\temp.win-amd64-3.7\Release\google/protobuf/pyext\unknown_fields.obj ../src/.libs/libprotobuf.a ../src/.libs/libprotobuf-lite.a /OUT:build\lib.win-amd64-3.7\google\protobuf\pyext\_message.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\google/protobuf/pyext\_message.cp37-win_amd64.lib
libprotobuf.a(descriptor.pb.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(generated_message_reflection.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(coded_stream.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(descriptor.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(common.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(message_lite.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(descriptor_database.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(map_field.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(zero_copy_stream.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(zero_copy_stream_impl_lite.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(strtod.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(message_differencer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(text_format.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(dynamic_message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(arena.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(repeated_field.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(wire_format_lite.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(generated_message_util.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(parse_context.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(unknown_field_set.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(extension_set.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(extension_set_heavy.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(reflection_ops.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(wire_format.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(stringprintf.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(strutil.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(tokenizer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(substitute.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(status.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(int128.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(zero_copy_stream_impl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(field_comparator.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(any_lite.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(any.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(printer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(implicit_weak_message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(structurally_valid.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
libprotobuf.a(io_win32.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj
message_module.obj : warning LNK4197: export 'PyInit__message' specified multiple times; using first specification
   Creating library build\temp.win-amd64-3.7\Release\google/protobuf/pyext\_message.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\google/protobuf/pyext\_message.cp37-win_amd64.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
libprotobuf.a(strutil.obj) : error LNK2001: unresolved external symbol __imp_strchr
libprotobuf.a(printer.obj) : error LNK2001: unresolved external symbol __imp_strchr
build\lib.win-amd64-3.7\google\protobuf\pyext\_message.cp37-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120

T:\src\github\protobuf\protobuf\python>dir dist
 Volume in drive T is tmpfs
 Volume Serial Number is C8EA-C16A

 Directory of T:\src\github\protobuf\protobuf\python

File Not Found

T:\src\github\protobuf\protobuf\python>copy dist\* T:\src\github\protobuf\artifacts
The system cannot find the path specified.

@rafi-kamal
Copy link
Contributor Author

@veawor sorry I had to revert the commit, otherwise it's blocking our Python release. I'll be happy to roll forward the commit if it doesn't break building Python release artifacts. I'll try to find out ways so that these kind issues can be identified earlier.

@rafi-kamal rafi-kamal merged commit 01425cb into protocolbuffers:3.11.x Nov 20, 2019
rafi-kamal added a commit that referenced this pull request Nov 21, 2019
* Update CHANGES.txt with 3.11.0-RC1 release notes (#6909)

* Revert "Make shared libraries be able to link to MSVC static runtime libraries, so that VC runtime is not required." (#6914)

* Marked update_compatibility_version.py as executable (#6916)
@snnn
Copy link
Contributor

snnn commented Dec 2, 2019

"libprotobuf.a(descriptor.pb.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in descriptor.obj"

It means the descriptor.pb.cc wasn't compiled with the static runtime.

nlhien pushed a commit to nlhien/protobuf that referenced this pull request Feb 28, 2020
* Update CHANGES.txt with 3.11.0-RC1 release notes (protocolbuffers#6909)

* Revert "Make shared libraries be able to link to MSVC static runtime libraries, so that VC runtime is not required." (protocolbuffers#6914)

* Marked update_compatibility_version.py as executable (protocolbuffers#6916)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants