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
Linker error 2038 msvc 2015 debug build #4231
Comments
I know that is a problem with the run time libraries. I'm built shogun with debug flag in MSVC 2015, but it seems that it was instead build in release. Isn't it? |
@fyoda i'm not so sure how do you end up here.... could you maaaybe reproduce the commands of appveyor or what's in the manual for windows, namely:
|
The cmake command you reported cannot work as is. When, executed from command line you get the error about the GPL and SVM flag. Only the following command works for me:
|
@fyoda what? :) i mean if you do not want GPL sure thing that you can disable it... but that work as it works on appveyor. you are missing the submodules:
|
I'm sorry, I forgot the submodules. Now your CMAKE command works fine.
It builds without errors. However, I'm getting errors LNK2038 when I'm using the .dll generated on the with the sample code posted here. |
@fyoda i'm not so sure that DLL should be linkable to a simple example - like the minimal code. for that you should compile with the static lib... if you want to use the dll you need to load it into memory with |
@vigsterkr I'm just trying to run the following code, first in Debug mode, than in Release:
At the end of the debug I have four files:
at the end of the release just two:
Now I took both shared libraries I tried to build the example code posted above, first in Debug mode (with debug lib), then Release (with release lib). At the first build, I got the following error in the include file include\shogun/io/SGIO.h
Modifying direct.h with io.h to solve this issue. In Debug I get the following errors:
In Release, linking against release shogun lib the example compile and works fine. |
@fyoda modifying direct.h? you mean dirent.h? none the less you have to actually use the right include flags for shogun (check exported target) before you wanna compile against the lib.... otherwise of course you are going have troubles compiling your code. on the other hand i'd actually link with the static lib, which i dont get why wouldn't has any of those symbols in case of a Debug mode.... that's only adds debug information to the obj not removing functions. are you sure that you are having the right linker flags to find the debug mode library? |
@vigsterkr I meant dirent.h, sorry for the typo. I don't understand. What do you mean with proper flag? I would try to link shogun statically to the example, but at the end of the build process I don't see any shogun.a file. |
there's no such thing as shogun.a in windows... it's |
@vigsterkr I'm sorry, I got confused. Even if I use static linking against the example I get the same LNK2019 errors reported above, both in release and debug mode: |
@fyoda but the libshogun (c++ examples) compiles fine? |
@vigsterkr If compiles fine, but I get an error in the unit test configuration of Eigen library 3.3.4 and it is not able to find BLAS:
|
can you run the tests? meaning |
@vigsterkr In which solution can I find ctest? |
mmm it's not a solution.. .it's part of |
please read this before further questions: |
@vigsterkr I did and read all the developing information. Indeed, in the INTERFACES.md I see normal information on how to use shogun as Shared Library. I'm not interested in interfaces with other scripting languages, but just with C++. They are simple instruction on how to use link a shared lib. In EXAMPLES.md I just see information on how to run automatically generated example. Unfortunately, they are available only with BUILD_META_EXAMPLE flag enabled. Thus, no meta examples are available since the CMAKE command you suggested has -DBUILD_META_EXAMPLES=OFF flag. The only tests I'm able to run now are the unit tests, which passed. |
@fyoda if unit tests are passing that it definitely managed to link with |
@vigsterkr Ok the test runs correctly. I have tried linking statically the library to the example and it works only with Release library. |
@vigsterkr in my opinion, the problem happens when in MSVC the user switches from Debug to Release configuration. Indeed the Runtime Library is not updated properly. It should be: Instead, in the shogun solution... Even if I select the Debug configuration, the Multi-threaded DLL is set in all submodules, that is wrong: --> look here |
@vigsterkr I just changed manually the Runtime Lib in all submodules and worked out. So, there is a problem with the generation of the MSVC solution using CMAKE. It works with dynamic and static linking. |
@fyoda submodules? i'm not so sure if i follow... moreover, if the libshogun examples are successfully compiled and linked then it means that your custom linking/compilation is broken...
or
if you are referring to the fact that when you run once in the cmake say with |
@vigsterkr I meant subprojects within the generated MSVC solution.
And you link the generated library against an example in debug configuration you experience the Runtime library errors I posted above. This is fully supported by CMAKE to switch between debug and release build within MSVC. In addition to that, to get you C++ working it is mandatory to add:
and change the include file |
mmmm i have to check with i'm not so sure if i understand why would this happen - Debug not working in case of MSVC & shogun. i'm using cmake to generate the solution files, so i dont understand what's missing or how. ideas? |
@fyoda have you maybe checked whether adding
to https://github.com/shogun-toolbox/shogun/blob/develop/src/shogun/lib/Time.cpp#L92 |
@vigsterkr I didn't try. I just added
to my main.cpp example to solve the issue. I can try to add it to Time.cpp and I'll let you know. |
if you could add & test that'd be really great thnx! |
@vigsterkr Adding in Time.cpp, rebuilding the library solved the issue when building the c++ example. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@vigsterkr still relevant? Should be addressed in the windows fixes? |
this should be autoclosed once #4719 is merged. i've marked there this issue |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue is now being closed due to a lack of activity. Feel free to reopen it. |
Hello everyone,
I'm going to use shogun on windows. I'm having a problem installing it with vcpkg. But I have already opened an issue for that.
In the meanwhile, I'm trying to use CMAKE to generate the MSVC 2015 Win64 solution and generate the debug and release build.
The release build works fine. I have tried it with the minimal usage examples here reported.
Unfortunately, I'm getting LNK2038 error when using the debug build of the library in debug mode.
Here I report the CMAKE log:
The generated errors are:
I have also tried building the library in "RelWithDebInfo" but the final ouput is equal when used.
What is wrong with my debug build of the library?
The text was updated successfully, but these errors were encountered: