protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

compilation error of libprotoc with clang on windows when compiling a shared lib

Open hadrienmottaz opened this issue 5 years ago • 4 comments

Hi,

I am trying to compile protobuf with clang 10.0 && msvc142 on windows when compiling a shared lib

I am gettiing the following compilation error

src\google/protobuf/compiler/scc.h(63,21): error : 'google::protobuf::compiler::SCCAnalyzer<google::protobuf::compiler::js::(anonymous namespace)::DepsGenerator>' must have external linkage when declared 'dllexport' [C:.conan\fee85c\1\build_subfolder\source_subfolder\cmake\libprotoc.vcxproj]

I am using the following argument

-o protobuf:shared=True

and this sis the cmake output -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041. 10:19:56 -- The C compiler identification is Clang 10.0.0 with MSVC-like command-line 10:20:00 -- The CXX compiler identification is Clang 10.0.0 with MSVC-like command-line 10:20:00 -- Detecting C compiler ABI info 10:20:03 -- Detecting C compiler ABI info - done 10:20:03 -- Check for working C compiler: C:/BuildTools/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped 10:20:03 -- Detecting C compile features 10:20:03 -- Detecting C compile features - done 10:20:03 -- Detecting CXX compiler ABI info 10:20:06 -- Detecting CXX compiler ABI info - done 10:20:06 -- Check for working CXX compiler: C:/BuildTools/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped

thanks

hadrienmottaz avatar Sep 29 '20 13:09 hadrienmottaz

Sorry for the long delay. Are you still seeing this error in newer versions of protobuf?

deannagarcia avatar Jul 26 '22 16:07 deannagarcia

Sorry for the long delay. Are you still seeing this error in newer versions of protobuf?

Yep

nepridumalnik avatar Aug 22 '22 10:08 nepridumalnik

I am kind a shooting blind here, but can you check if add PROTOC_EXPORT to https://github.com/protocolbuffers/protobuf/blob/701dd83594c5d979481bc36ac58efea670a929ba/src/google/protobuf/compiler/cpp/helpers.h#L637 fixes this for you?

fowles avatar Aug 22 '22 13:08 fowles

Same error remains :(

UPD: Version was 3.20.1, upgrade to 3.21.5 helped

nepridumalnik avatar Aug 23 '22 02:08 nepridumalnik

Closing since newer version no longer has this problem.

sbenzaquen avatar Apr 19 '23 19:04 sbenzaquen