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

'LightGBM:inet_pton': ambiguous call to overloaded function (compiling source file ..\src\network\liners_socket.app) #5856

Closed
erinengle76 opened this issue Apr 25, 2023 · 2 comments · Fixed by #5884
Labels

Comments

@erinengle76
Copy link

Hi James,

I am still facing the same issue despite using the sln file from v 3.3.5 uploaded on January 23rd. (https://github.com/microsoft/LightGBM/releases). I have selected Windows SDK 10.0 (latest installed version) and Visual Studio 2022(v143) under general properties. See error log below.

Screenshot 2023-04-25 121916

"Thanks for your interest in LightGBM!

I put some of the text of those logs through Google Translate (I cannot read the language they're in, apologies), and saw that it looks like you are hitting this during compilation:

error C2668: "LightGBM::inet_pton": ambiguous call to overloaded function (compile source file..\src\network \linkers_socket.cpp)

LightGBM has its own implementation of inet_pton, but some newer compilers on Windows ship with their own, conflicting implementation.

If you searched this project's issue tracker for that error message, you'd see that the same error was reported in #5019, and fixed about 5 months ago in #5159.

Please update to a newer version of LightGBM's source code, from at least after #5159.

If that doesn't resolve the issue you're facing, please click below to see the information we need to efficiently, effectively help you.

how to ask for help (click me)

It is very very very difficult for maintainers to help you when you only report a wall of logs without other context.

  • are you installing the Python package / R package? just building the CLI? something else?
  • how did you try to install LightGBM?
  • what version are you using?
  • it seems like you might be using Visual Studio to compile LightGBM... what version of Visual Studio? Did you customize anything about the installation?

Without answers like this, you are asking maintainers here to guess what you're doing, and that will take away our already-limited time from other work on this project.

Can you please provide the answers to the questions I've asked above?

Originally posted by @jameslamb in #5499 (comment)"

@erinengle76 erinengle76 changed the title Thanks for your interest in LightGBM! 'LightGBM:inet_pton': ambiguous call to overloaded function (compiling source file ..\src Apr 25, 2023
@erinengle76 erinengle76 changed the title 'LightGBM:inet_pton': ambiguous call to overloaded function (compiling source file ..\src 'LightGBM:inet_pton': ambiguous call to overloaded function (compiling source file ..\src\network\liners_socket.app) Apr 25, 2023
@jameslamb
Copy link
Collaborator

jameslamb commented May 10, 2023

Thanks for using LightGBM and for the report. I was able to reproduce this on latest master (a2c1dec) today with the following steps:

  1. setting Windows SDK version in LightGBM.vcxproj to 10.0

<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>

  1. running the following from the root of the repo
MSBuild.exe windows/LightGBM.sln /p:Configuration=DLL /p:Platform=x64 /p:PlatformToolset=v142

I have Visual Studio 2019, and am on Windows 10.

Adding #define WIN_HAS_INET_PTON right above this line, I'm able to compile LightGBM successfully with MSBuild.exe.

#ifndef WIN_HAS_INET_PTON

I suspect that would work for you too.


I guess that building directly from inside Visual Studio the way you are, CMake isn't being used, and therefore this check doesn't run?

LightGBM/CMakeLists.txt

Lines 338 to 348 in a2c1dec

# Check if inet_pton is already available, to avoid conflicts with the implementation in LightGBM.
# As of 2022, MinGW started including a definition of inet_pton.
if(WIN32)
include(CheckSymbolExists)
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
check_symbol_exists(inet_pton "ws2tcpip.h" WIN_INET_PTON_FOUND)
if(WIN_INET_PTON_FOUND)
add_definitions(-DWIN_HAS_INET_PTON)
endif()
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "ws2_32")
endif()

I'll try to push a fix for that. Since that the was only added for compatibility with newer MinGW, it should be safe to assume that any build using Visual Studio compilers won't already have inet_pton.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants