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

[BUG] Error when link C++ runtime statically #1126

Open
jfulem opened this issue Sep 13, 2024 · 2 comments
Open

[BUG] Error when link C++ runtime statically #1126

jfulem opened this issue Sep 13, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jfulem
Copy link

jfulem commented Sep 13, 2024

I'm on windows, using MSVC (Visual Studio 2022).

Is it possible to build your depthai-core library with the /MT flag - which links the C++ runtime statically?

I tried that and it looks there are some issues with dependencies: XLink, spdlog
XLink.lib(ProtocolManager.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in DatatypeEnum.obj
spdlog.lib(fmt.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in DatatypeEnum.obj

How can I configure Hunter to build the dependencies with /MT as well?

Or am I missing something else?

@jfulem jfulem added the bug Something isn't working label Sep 13, 2024
@jfulem jfulem changed the title [BUG] {Error when link C++ runtime statically} [BUG] Error when link C++ runtime statically Sep 13, 2024
@moratom
Copy link
Collaborator

moratom commented Sep 22, 2024

Hi @jfulem , sorry for the late response.

As far as I know we haven't yet compiled the library with the /MT flag.

I believe that the flag should be passed down to hunter dependanices in case you use CMAKE_CXX_FLAGS variable.

Otherwise you can try to set the flag for each dependacny separatly in this file https://github.com/luxonis/depthai-core/blob/main/cmake/Hunter/config.cmake (see how other flags are passed down).

How are you setting the /MT flag now?

@jfulem
Copy link
Author

jfulem commented Sep 22, 2024

@moratom, thank you.

I tried both:

  • passing CMAKE_CXX_FLAGS
  • each dependency in Hunter/config.cmake

But I still get the same mismatch error. I will give it another try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants