signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.49k stars 1.4k forks source link

Windows/VS 2022 build errors in mod_enum and two missing vcxproj files #2172

Closed KrisD888 closed 8 months ago

KrisD888 commented 1 year ago

Describe the bug 30 multiply defined symbols errors when building Freeswitch project mod_enum and errors loading docs.2017.vcxproj and FSComm.2017.vcxproj

To Reproduce Steps to reproduce the behavior:

  1. Compiled Master from 07/19/2023 and on several occasions in the past 6 months
  2. Using Windows Server 2019 and
  3. Visual Studio Community 2022 (64-bit) - Version 17.6.5 and .NET Framework 4.8.03761

The rest of the solution compiles OK and Freeswitch runs well without mod_enum.

Expected behavior It would be nice to clear up these errors even though they don't seem to affect my operation.

Package version or git hash FreeSWITCH Version 1.10.10-dev-5874~e764f292b5~64bit (e764f292b5 64bit)

Build Errors

Severity Code Description Project File Line Suppression State Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(dname.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(rr.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(packet.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(resolver.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(host2str.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(str2host.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(util.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(parse.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(buffer.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(dnssec.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(host2wire.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(wire2host.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(error.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(net.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(b64_ntop.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(gmtime_r.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(inet_ntop.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(b32_ntop.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(zone.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(rr_functions.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(b64_pton.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(inet_pton.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(b32_pton.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(gettimeofday.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(dnssec_zone.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(sha1.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(sha2.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(strlcpy.obj) 1
Error LNK2005 SocketNotificationRetrieveEvents already defined in ldns.lib(rdata.obj) mod_enum E:\FS_GIT\src\mod\applications\mod_enum\ldns.lib(rbtree.obj) 1
Error LNK1169 one or more multiply defined symbols found mod_enum E:\FS_GIT\x64\Debug\mod\mod_enum.dll 1

When the solution first loads, it also throws these 2 errors:

E:\FS_GIT\docs\docs.2017.vcxproj : error : The project file could not be loaded. Could not find file 'E:\FS_GIT\docs\docs.2017.vcxproj'. E:\FS_GIT\docs\docs.2017.vcxproj

E:\FS_GIT\fscomm\FSComm.2017.vcxproj : error : The project file could not be loaded. Could not find file 'E:\FS_GIT\fscomm\FSComm.2017.vcxproj'. E:\FS_GIT\fscomm\FSComm.2017.vcxproj

andywolk commented 1 year ago

Patches are welcome

Visytel commented 1 year ago

Ok. After some investigation I have found that Microsoft's winsock2.h has recently changed in their later SDKs and added the following:

inline UINT32 SocketNotificationRetrieveEvents ( In OVERLAPPED_ENTRY* notification ) { return (UINT32)notification->dwNumberOfBytesTransferred; }

This then causes LNK2004 warnings when ldns is built and hence the LNK2005 errors with mod_enum that uses ldns.

The problem is the following inside freeswitch\libs\ldns\ldns\config.h (as pulled in by freeswitch when building for the first time: http://files.freeswitch.org/downloads/libs/ldns-1.6.9-1-win.tar.gz) - Lines 262-264:

ifndef __cplusplus

define inline

endif

If this is changed to the following then this will fix this issue and also work with older Windows SDKs:

ifndef __cplusplus

ifndef _WIN32

define inline / Do not define inline for Windows to avoid warnings/errors with winsock2.h usage of inline within the latest Windows SDKs /

endif

endif

Andy I hope you can simply make this change inside the ldns project and this issue will be fixed.

Thanks,

Andrew

andywolk commented 1 year ago

Hi Andrew. No need to update the tarball. We have this file in the source tree: https://github.com/signalwire/freeswitch/blob/master/libs/win32/ldns/ldns-lib/config.h#L263

Visytel commented 1 year ago

Andrey,

PR done here awaiting your approval: https://github.com/signalwire/freeswitch/pull/2188

Andrew

andywolk commented 8 months ago

Fixed by https://github.com/signalwire/freeswitch/pull/2188

KrisD888 commented 8 months ago

I just downloaded Master and compiled it. The 30 errors are now fixed but these two still show up upon opening of the solution.

E:\FS_GIT\docs\docs.2017.vcxproj : error : The project file could not be loaded. Could not find file 'E:\FS_GIT\docs\docs.2017.vcxproj'. E:\FS_GIT\docs\docs.2017.vcxproj E:\FS_GIT\fscomm\FSComm.2017.vcxproj : error : The project file could not be loaded. Could not find file 'E:\FS_GIT\fscomm\FSComm.2017.vcxproj'. E:\FS_GIT\fscomm\FSComm.2017.vcxproj

Visytel commented 8 months ago

KrisD888: You need to simply not build these by removing them from the solution - see my (yet to be approved) PR: https://github.com/signalwire/freeswitch/pull/2192

I hope that helps.