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

[Windows, Cpp] LNK2001 - unresolved external symbol OMP_NUM_THREADS #6238

Closed
wil70 opened this issue Dec 15, 2023 · 5 comments · Fixed by #6251
Closed

[Windows, Cpp] LNK2001 - unresolved external symbol OMP_NUM_THREADS #6238

wil70 opened this issue Dec 15, 2023 · 5 comments · Fixed by #6251
Assignees
Labels

Comments

@wil70
Copy link

wil70 commented Dec 15, 2023

Description

Linker issues after compilation
"LNK2001 - unresolved external symbol OMP_NUM_THREADS"

image

Reproducible example

Download the latest code as of Dec 15. Compile for windows in x64 bits.
You will see many linker issue in the error dialog
"LNK2001 - unresolved external symbol OMP_NUM_THREADS"

Environment info

Windows 10 PRO

LightGBM version or commit hash:
Latest as of dec 15

Command(s) you used to install LightGBM

start vs 
set project to release in x64 bits
clean
compile

Additional Comments

I tried to compile on 2 machines, same result.
The windows GPU version via cmake compile well.

@jameslamb jameslamb added the bug label Dec 15, 2023
@jameslamb
Copy link
Collaborator

Thanks for the report and sorry about that!

I suspect it's because in #6226, I forgot to add this new file src/utils/openmp_wrapper.cpp to the Visual Studio solution files in https://github.com/microsoft/LightGBM/tree/master/windows.

Would you be willing to try adding it there and putting up a pull request?

@jameslamb
Copy link
Collaborator

@wil70 I suspect you meant to post #6190 (comment) over here.

Copying it here:

That worked with the additional file - TY!

I tried to push the code but got an error

I attached the 2 modified project files in a zip
LightGBM.vcxproj.zip

git.exe push --progress "origin" master:master
remote: Permission to microsoft/LightGBM.git denied to wil70.
fatal: unable to access 'https://github.com/microsoft/LightGBM/': The requested URL returned error: 403
git did not exit cleanly (exit code 128) (12032 ms @ 2023-12-15 10:14:51 AM)
  1. you cannot push directly to this repository
  2. when you propose changes, do it from a new branch not one called master

If you're unfamiliar with creating pull requests on GitHub, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork.

The process is as follows:

  1. fork this repository by clicking the "fork" button at https://github.com/microsoft/LightGBM
  2. clone your fork to your local environment
# clone
git clone --recursive [email protected]:wil70/LightGBM.git

# (optional) add another remote pointing to the main LightGBM project
git remote add upstream [email protected]:microsoft/LightGBM.git
  1. create a new branch
git checkout -b fix/vs-solution
  1. make changes on that branch and then commit and push them
cd ./LightGBM
git add ./windows
git commit -m "[c++] add openmp_wrapper to Visual Studio solution files"
git push origin fix/vs-solution
  1. in the GitHub UI, go to https://github.com/microsoft/LightGBM/pulls and click "open pull request"

@ if you need any help! We appreciate you taking the time to contribute to LightGBM.

@jameslamb
Copy link
Collaborator

@wil70 are you still interested in submitting a pull request for this?

If not or if you don't have time right now, let me know and I'll put up a fix.

@wil70
Copy link
Author

wil70 commented Dec 28, 2023

Hi @jameslamb , sorry, for the delay, if you can do it that would be great! (otherwise I shall e back home on 3rd and will be able to do it, but please feel free to push the fix before - TY)

@jameslamb
Copy link
Collaborator

Ok no problem! I'll do it shortly. Thanks again for bringing it to our attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants