-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[openexr] errors when linking to static library #2596
Comments
I'm not seeing any issue in MSBuild: // main.cpp
#include <OpenEXR\IexBaseExc.h>
int main(int argc, char * argv[])
{
throw Iex_2_2::BaseExc("hello");
} builds and links successfully (and the resulting executable doesn't depend on any DLLs). Is it possible you're accidentally not linking the lib file? Otherwise, could you share a full repro (code+build)? |
@ras0219-msft Here is example code. |
Here's my setup that (mostly) works:
Then, in the cmake file I added the following to use /MT project(exrtools C CXX)
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "" FORCE)
string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE) Upon building, I got a bunch of zlib link errors (missing Once I did that, most of the binaries compile and link fine. I still get these errors:
but none of them match the errors you're getting. |
@ras0219-msft Managed to fix by doing a clean install. See #2599 |
@codicodi @ras0219-msft @alexkaratarakis Came across an issue similar to #1279
when linking to openexr static library. I am not sure why its looking for symbols when I am using the static libs. I looked at the export macros. There seem to be no issue. Could there be something in the way I am consuming this port.
These symbols are related to these lines
Based on this ticket AcademySoftwareFoundation/openexr/issues/86 I see why extending strings is problematic when it comes exports. However shouldn't this work in static form?
The text was updated successfully, but these errors were encountered: