Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Windows shared library generates linkage warnings #569

@uilianries

Description

@uilianries

Hello!

First, thanks for providing this amazing project to the community!

I have some linkage warnings when building glog 0.4.0 as shared library (with gflags 2.2.0), it does not break the build, but looks suspect.

$ cmake -G "Ninja" -DCMAKE_BUILD_TYPE="Release" -DBUILD_SHARED_LIBS="ON" -DWITH_GFLAGS="ON" -DWITH_THREADS="ON"

-- The C compiler identification is MSVC 19.26.28806.0
-- The CXX compiler identification is MSVC 19.26.28806.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Using autogenerated Findgflags.cmake
-- Found gflags: 2.2.0 (found suitable version "2.2.0", minimum required is "2.2.0")
-- Library gflags_nothreads found C:/Users/uilia/.conan/data/gflags/2.2.0/_/_/package/ed160c62813fa6d86d309b2f7e6e791ae96da725/Lib/gflags_nothreads.lib
-- Found: C:/Users/uilia/.conan/data/gflags/2.2.0/_/_/package/ed160c62813fa6d86d309b2f7e6e791ae96da725/Lib/gflags_nothreads.lib
-- Library shlwapi not found in package, might be system one
-- Looking for gflags namespace
-- Looking for gflags namespace - failed
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Looking for dlfcn.h
-- Looking for dlfcn.h - not found
-- Looking for execinfo.h
-- Looking for execinfo.h - not found
-- Looking for glob.h
-- Looking for glob.h - not found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for libunwind.h
-- Looking for libunwind.h - not found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for pwd.h
-- Looking for pwd.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/syscall.h
-- Looking for sys/syscall.h - not found
-- Looking for sys/time.h
-- Looking for sys/time.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/utsname.h
-- Looking for sys/utsname.h - not found
-- Looking for syscall.h
-- Looking for syscall.h - not found
-- Looking for syslog.h
-- Looking for syslog.h - not found
-- Looking for ucontext.h
-- Looking for ucontext.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for unwind.h
-- Looking for unwind.h - not found
-- Looking for C++ include ext/hash_map
-- Looking for C++ include ext/hash_map - not found
-- Looking for C++ include ext/hash_set
-- Looking for C++ include ext/hash_set - not found
-- Looking for C++ include ext/slist
-- Looking for C++ include ext/slist - not found
-- Looking for C++ include tr1/unordered_map
-- Looking for C++ include tr1/unordered_map - not found
-- Looking for C++ include tr1/unordered_set
-- Looking for C++ include tr1/unordered_set - not found
-- Looking for C++ include unordered_map
-- Looking for C++ include unordered_map - found
-- Looking for C++ include unordered_set
-- Looking for C++ include unordered_set - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned __int16
-- Check size of unsigned __int16 - done
-- Check size of u_int16_t
-- Check size of u_int16_t - failed
-- Check size of uint16_t
-- Check size of uint16_t - done
-- Looking for dladdr
-- Looking for dladdr - not found
-- Looking for fcntl
-- Looking for fcntl - not found
-- Looking for pread
-- Looking for pread - not found
-- Looking for pwrite
-- Looking for pwrite - not found
-- Looking for sigaction
-- Looking for sigaction - not found
-- Looking for sigaltstack
-- Looking for sigaltstack - not found
-- Performing Test HAVE_NO_DEPRECATED
-- Performing Test HAVE_NO_DEPRECATED - Failed
-- Performing Test HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for get_static_proc_name in unwind
-- Looking for get_static_proc_name in unwind - not found
-- Looking for UnDecorateSymbolName in dbghelp
-- Looking for UnDecorateSymbolName in dbghelp - found
-- Performing Test HAVE___ATTRIBUTE__
-- Performing Test HAVE___ATTRIBUTE__ - Failed
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_DEFAULT
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_DEFAULT - Failed
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_HIDDEN
-- Performing Test HAVE___ATTRIBUTE__VISIBILITY_HIDDEN - Failed
-- Performing Test HAVE___BUILTIN_EXPECT
-- Performing Test HAVE___BUILTIN_EXPECT - Failed
-- Performing Test HAVE___SYNC_VAL_COMPARE_AND_SWAP
-- Performing Test HAVE___SYNC_VAL_COMPARE_AND_SWAP - Failed
-- Performing Test HAVE_RWLOCK
-- Performing Test HAVE_RWLOCK - Failed
-- Performing Test HAVE___DECLSPEC
-- Performing Test HAVE___DECLSPEC - Success
-- Performing Test STL_NO_NAMESPACE
-- Performing Test STL_NO_NAMESPACE - Failed
-- Performing Test STL_STD_NAMESPACE
-- Performing Test STL_STD_NAMESPACE - Success
-- Performing Test HAVE_USING_OPERATOR
-- Performing Test HAVE_USING_OPERATOR - Success
-- Performing Test HAVE_NAMESPACES
-- Performing Test HAVE_NAMESPACES - Success
-- Performing Test HAVE_GCC_TLS
-- Performing Test HAVE_GCC_TLS - Failed
-- Performing Test HAVE_MSVC_TLS
-- Performing Test HAVE_MSVC_TLS - Success
-- Performing Test HAVE_CXX11_TLS
-- Performing Test HAVE_CXX11_TLS - Success
-- Performing Test HAVE_ALIGNED_STORAGE
-- Performing Test HAVE_ALIGNED_STORAGE - Success
-- Performing Test HAVE_SYMBOLIZE
-- Performing Test HAVE_SYMBOLIZE - Success
-- Performing Test HAVE_LOCALTIME_R
-- Performing Test HAVE_LOCALTIME_R - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/uilia/dev/glog/0.4.0/build/
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.6.2
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

----Running------
> cmake --build C:/Users/uilia/dev/glog/0.4.0/build -- -j12
-----------------
[1/9] Building CXX object CMakeFiles\glog.dir\src\windows\port.cc.obj

[2/9] Building CXX object CMakeFiles\glog.dir\src\raw_logging.cc.obj

[3/9] Building CXX object CMakeFiles\glog.dir\src\symbolize.cc.obj

[4/9] Building CXX object CMakeFiles\glog.dir\src\signalhandler.cc.obj

[5/9] Building CXX object CMakeFiles\glog.dir\src\demangle.cc.obj

[6/9] Building CXX object CMakeFiles\glog.dir\src\vlog_is_on.cc.obj

src\vlog_is_on.cc(53): warning C4273: 'fLI::FLAGS_v': inconsistent dll linkage
glog/logging.h(371): note: see previous definition of 'FLAGS_v'
[7/9] Building CXX object CMakeFiles\glog.dir\src\utilities.cc.obj

[8/9] Building CXX object CMakeFiles\glog.dir\src\logging.cc.obj

src\logging.cc(107): warning C4273: 'fLB::FLAGS_logtostderr': inconsistent dll linkage
glog/logging.h(334): note: see previous definition of 'FLAGS_logtostderr'
src\logging.cc(109): warning C4273: 'fLB::FLAGS_alsologtostderr': inconsistent dll linkage
glog/logging.h(337): note: see previous definition of 'FLAGS_alsologtostderr'
src\logging.cc(111): warning C4273: 'fLB::FLAGS_colorlogtostderr': inconsistent dll linkage
glog/logging.h(340): note: see previous definition of 'FLAGS_colorlogtostderr'
src\logging.cc(127): warning C4273: 'fLI::FLAGS_stderrthreshold': inconsistent dll linkage
glog/logging.h(344): note: see previous definition of 'FLAGS_stderrthreshold'
src\logging.cc(133): warning C4273: 'fLB::FLAGS_log_prefix': inconsistent dll linkage
glog/logging.h(347): note: see previous definition of 'FLAGS_log_prefix'
src\logging.cc(135): warning C4273: 'fLI::FLAGS_minloglevel': inconsistent dll linkage
glog/logging.h(358): note: see previous definition of 'FLAGS_minloglevel'
src\logging.cc(139): warning C4273: 'fLI::FLAGS_logbuflevel': inconsistent dll linkage
glog/logging.h(351): note: see previous definition of 'FLAGS_logbuflevel'
src\logging.cc(141): warning C4273: 'fLI::FLAGS_logbufsecs': inconsistent dll linkage
glog/logging.h(354): note: see previous definition of 'FLAGS_logbufsecs'
src\logging.cc(163): warning C4273: 'fLI::FLAGS_logfile_mode': inconsistent dll linkage
glog/logging.h(365): note: see previous definition of 'FLAGS_logfile_mode'
src\logging.cc(167): warning C4273: 'fLS::FLAGS_log_dir': inconsistent dll linkage
glog/logging.h(362): note: see previous definition of 'FLAGS_log_dir'
src\logging.cc(169): warning C4273: 'fLS::FLAGS_log_link': inconsistent dll linkage
glog/logging.h(369): note: see previous definition of 'FLAGS_log_link'
src\logging.cc(173): warning C4273: 'fLI::FLAGS_max_log_size': inconsistent dll linkage
glog/logging.h(374): note: see previous definition of 'FLAGS_max_log_size'
src\logging.cc(176): warning C4273: 'fLB::FLAGS_stop_logging_if_full_disk': inconsistent dll linkage
glog/logging.h(377): note: see previous definition of 'FLAGS_stop_logging_if_full_disk'
[9/9] Linking CXX shared library bin\glog.dll

   Creating library lib\glog.lib and object lib\glog.exp

LINK : warning LNK4217: symbol '?FLAGS_v@fLI@@3HA (int fLI::FLAGS_v)' defined in 'vlog_is_on.cc.obj' is imported by 'logging.cc.obj' in function '"bool __cdecl google::SendEmailInternal(char const *,char const *,char const *,bool)" (?SendEmailInternal@google@@YA_NPEBD00_N@Z)'

LINK : warning LNK4217: symbol '?FLAGS_logtostderr@fLB@@3_NA (bool fLB::FLAGS_logtostderr)' defined in 'logging.cc.obj' is imported by 'raw_logging.cc.obj' in function '"void __cdecl google::RawLog__(int,char const *,int,char const *,...)" (?RawLog__@google@@YAXHPEBDH0ZZ)'

LINK : warning LNK4217: symbol '?FLAGS_alsologtostderr@fLB@@3_NA (bool fLB::FLAGS_alsologtostderr)' defined in 'logging.cc.obj' is imported by 'raw_logging.cc.obj' in function '"void __cdecl google::RawLog__(int,char const *,int,char const *,...)" (?RawLog__@google@@YAXHPEBDH0ZZ)'

LINK : warning LNK4217: symbol '?FLAGS_stderrthreshold@fLI@@3HA (int fLI::FLAGS_stderrthreshold)' defined in 'logging.cc.obj' is imported by 'raw_logging.cc.obj' in function '"void __cdecl google::RawLog__(int,char const *,int,char const *,...)" (?RawLog__@google@@YAXHPEBDH0ZZ)'


$ cmake --build C:\Users\uilia\dev\glog\0.4.0\build --target install -- -j12

[0/1] Install the project...

-- Install configuration: "Release"
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/lib/glog.lib
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/bin/glog.dll
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/include/glog/logging.h
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/include/glog/raw_logging.h
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/include/glog/stl_logging.h
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/include/glog/vlog_is_on.h
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/include/glog/log_severity.h
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/lib/cmake/glog/glog-config.cmake
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/lib/cmake/glog/glog-config-version.cmake
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/lib/cmake/glog/glog-targets.cmake
-- Installing: C:/Users/uilia/dev\glog\0.4.0\build/lib/cmake/glog/glog-targets-release.cmake

Environment:

arch=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
os=Windows
os.version=10

Do you think this is a problem?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions