dankamongmen / notcurses

blingful character graphics/TUI library. definitely not curses.
https://nick-black.com/dankwiki/index.php/Notcurses
Other
3.43k stars 113 forks source link

Cannot build library with OpenImageIO multimedia engine using MinGW 64 #2685

Open C010UR opened 1 year ago

C010UR commented 1 year ago

While trying to build libs using mingw, i get the error below. I used following cmake options: USE_DOCTEST=off USE_PANDOC=off BUILD_EXECUTABLES=off USE_MULTIMEDIA=oiio. Using ffmpeg instead of OpenImageIO helps, but perfomance is bad and the demo breaks after the penguin scene.

[109/112] Linking CXX shared library libnotcurses.dll
FAILED: libnotcurses.dll libnotcurses.dll.a
cmd.exe /C "cd . && C:\msys64\ucrt64\bin\c++.exe -O2 -g -DNDEBUG   -shared -o libnotcurses.dll -Wl,--out-implib,libnotcurses.dll.a -Wl,--major-image-version,3,--minor-image-version,0 CMakeFiles/notcurses.dir/src/media/ffmpeg.c.obj CMakeFiles/notcurses.dir/src/media/none.c.obj CMakeFiles/notcurses.dir/src/media/oiio-indep.c.obj CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj CMakeFiles/notcurses.dir/src/media/shim.c.obj CMakeFiles/notcurses.dir/src/compat/compat.c.obj -L/usr/local/lib libnotcurses-core.dll.a  -lOpenImageIO  -lwsock32  -lws2_32  -lsecur32  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> >::size() const':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_vector.h:988: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValueaSERKS0_'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `void std::_Destroy_aux<false>::__destroy<__gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > > >(__gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, __gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >)':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `OpenImageIO_v2_4_5::ParamValue* std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m<OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*>(OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*)':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_algobase.h:383: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValueaSERKS0_'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `OpenImageIO_v2_4_5::ParamValue* std::__do_uninit_copy<OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*>(OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*)':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_uninitialized.h:119: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue12init_noclearENS_7ustringENS_8TypeDescEiNS0_6InterpEPKvNS0_4CopyENS0_11FromUstringE'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `OpenImageIO_v2_4_5::ParamValue* std::__do_uninit_copy<__gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue const*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, OpenImageIO_v2_4_5::ParamValue*>(__gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue const*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, __gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue const*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, OpenImageIO_v2_4_5::ParamValue*)':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_uninitialized.h:116: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue12init_noclearENS_7ustringENS_8TypeDescEiNS0_6InterpEPKvNS0_4CopyENS0_11FromUstringE'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `void std::_Destroy_aux<false>::__destroy<OpenImageIO_v2_4_5::ParamValue*>(OpenImageIO_v2_4_5::ParamValue*, OpenImageIO_v2_4_5::ParamValue*)':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj:C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_construct.h:162: more undefined references to `__imp__ZN18OpenImageIO_v2_4_510ParamValue11clear_valueEv' follow
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/notcurses.dir/src/media/oiio.cpp.obj: in function `OpenImageIO_v2_4_5::ParamValue* std::uninitialized_copy<__gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue const*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, OpenImageIO_v2_4_5::ParamValue*>(__gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue const*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, __gnu_cxx::__normal_iterator<OpenImageIO_v2_4_5::ParamValue const*, std::vector<OpenImageIO_v2_4_5::ParamValue, std::allocator<OpenImageIO_v2_4_5::ParamValue> > >, OpenImageIO_v2_4_5::ParamValue*)':
C:/msys64/ucrt64/include/c++/12.2.0/bits/stl_uninitialized.h:119: undefined reference to `__imp__ZN18OpenImageIO_v2_4_510ParamValue12init_noclearENS_7ustringENS_8TypeDescEiNS0_6InterpEPKvNS0_4CopyENS0_11FromUstringE'
collect2.exe: error: ld returned 1 exit status
[110/112] Building CXX object CMakeFiles/notcurses-static.dir/src/media/oiio.cpp.obj
ninja: build stopped: subcommand failed.
dankamongmen commented 1 year ago

I enjoy nothing more than large C++ diagnostics! let me see if i can figure out what's going on; thanks for the report!

ooh and it's mingw, too. yes, i recall regular problems with OpenImageIO on the windows platform. ok, i'll need build back up some context to look into this. i think i only support ffmpeg on windows? maybe it's the other way around, though.

raymond-w-ko commented 5 months ago

This make it build, but is it also separated to two libs on other platforms? https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-openimageio?repo=ucrt64

/ucrt64/lib/libOpenImageIO.dll.a
/ucrt64/lib/libOpenImageIO_Util.dll.a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c8a23f26..77f6ed900 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -414,6 +414,7 @@ elseif(${USE_OIIO})
 target_include_directories(notcurses PUBLIC "${OIIO_INCLUDE_DIRS}")
 target_include_directories(notcurses-static PUBLIC "${OIIO_STATIC_INCLUDE_DIRS}")
 target_link_libraries(notcurses PRIVATE OpenImageIO)
+target_link_libraries(notcurses PRIVATE OpenImageIO_Util)
 target_link_libraries(notcurses-static PRIVATE ${OIIO_STATIC_LIBRARIES})
 target_link_directories(notcurses PRIVATE ${OIIO_LIBRARY_DIRS})
 target_link_directories(notcurses-static PRIVATE ${OIIO_STATIC_LIBRARY_DIRS})
dankamongmen commented 5 months ago

oooh i don't know!

dankamongmen commented 5 months ago

looks like yes on Linux. on those platforms, we get the library names from pkg-config, which lists all necessary ones.

we would probably need a corresponding notcurses-static line.

dankamongmen commented 5 months ago
[schwarzgerat](1) $ pkg-config --libs OpenImageIO
-lOpenImageIO -lOpenImageIO_Util 
[schwarzgerat](0) $