media2x / rife-ncnn-vulkan-python

A Python FFI of nihui/rife-ncnn-vulkan achieved with SWIG
MIT License
36 stars 11 forks source link

macOS 11.5.2 Symbol not found: _NSLocalizedDescriptionKey #3

Open u3dreal opened 3 years ago

u3dreal commented 3 years ago

Hello and thank you for this nice port to python !

when i try to execute rife_ncnn_vulkan.py ( with pics added to ../images folder ) .. latest release download https://github.com/media2x/rife-ncnn-vulkan-python/releases/tag/20210520 I get the following error.

Traceback (most recent call last):
  File "/Users/drquader/Desktop/RIFE_python/rife-ncnn-vulkan-python-20210504-macos/rife_ncnn_vulkan.py", line 12, in <module>
    import rife_ncnn_vulkan_wrapper as raw
  File "/Users/drquader/Desktop/RIFE_python/rife-ncnn-vulkan-python-20210504-macos/rife_ncnn_vulkan_wrapper.py", line 15, in <module>
    import _rife_ncnn_vulkan_wrapper
ImportError: dlopen(/Users/drquader/Desktop/RIFE_python/rife-ncnn-vulkan-python-20210504-macos/_rife_ncnn_vulkan_wrapper.so, 2): Symbol not found: _NSLocalizedDescriptionKey
  Referenced from: /Users/drquader/Desktop/RIFE_python/rife-ncnn-vulkan-python-20210504-macos/_rife_ncnn_vulkan_wrapper.so
  Expected in: flat namespace
 in /Users/drquader/Desktop/RIFE_python/rife-ncnn-vulkan-python-20210504-macos/_rife_ncnn_vulkan_wrapper.so

this usually means it is not linked against Foundation Framework. Any idea ?

Thanks alot !

ArchieMeng commented 3 years ago

Emmm, I don't have a mac, so I don't know what it means. Could you try using the git version and install as python package through the setuptools way (python setup.py install).

I guess there might be some errors in the CMakeList.txt since it changed a lot during the times. Another reason might be the python lib linking is broken just like ImportError: DLL load failed while importing _rife_ncnn_vulkan_wrapper: The specified module could not be found. or What does "Symbol not found / Expected in: flat namespace" actually mean?. If that is the case, then a static link on your device might help. Change CMakeList.txt's python part on the tail like https://github.com/media2x/rife-ncnn-vulkan-python/blob/6c84631b9b43368471840868e0a67ad704815750/src/CMakeLists.txt#L296-L298 might solve the issue.

Additionally, could you check:

u3dreal commented 3 years ago

After having a look at the CMakaList.txt i think there is something commented out that should be there ..

list(APPEND RIFE_LINK_LIBRARIES
        ${Metal}
        ${QuartzCore}
        ${CoreGraphics}
        ${Cocoa}
        ${IOKit}
        ${IOSurface}
        ${Foundation}
        ${CoreFoundation}
    )
endif()

#target_link_libraries(rife-ncnn-vulkan ${RIFE_LINK_LIBRARIES})

why is this commented out ?? It adds Foundation to the RIFE_LINK_LIBRARIES but it is commented out ?? This is necessary for macos.

I do not have vulkan and SWIG installed and i would be happy to avoid it. Maybe you cam change it and let actions do the work.

k4yt3x commented 3 years ago

I think this line is for compiling the original CLI binary only, not for the linked library we're trying to build. @ArchieMeng's confirmation is required here, though.

P.S. enclose your multi-line code block with ``s instead of singles.

u3dreal commented 3 years ago

OK but Foundation framework is needed for osx. Maybe i will do a fork.

k4yt3x commented 3 years ago

It'll be great if you can figure that out. Neither I or @ArchieMeng has a macOS system nor much macOS development experiences.

ArchieMeng commented 3 years ago

After having a look at the CMakaList.txt i think there is something commented out that should be there ..

list(APPEND RIFE_LINK_LIBRARIES
        ${Metal}
        ${QuartzCore}
        ${CoreGraphics}
        ${Cocoa}
        ${IOKit}
        ${IOSurface}
        ${Foundation}
        ${CoreFoundation}
    )
endif()

#target_link_libraries(rife-ncnn-vulkan ${RIFE_LINK_LIBRARIES})

why is this commented out ?? It adds Foundation to the RIFE_LINK_LIBRARIES but it is commented out ?? This is necessary for macos.

I do not have vulkan and SWIG installed and i would be happy to avoid it. Maybe you cam change it and let actions do the work.

Just the same as what @k4yt3x said, the commented line was used for building original binary executable.

For Foundation libs, the CMakeList.txt part of this https://github.com/media2x/rife-ncnn-vulkan-python/blob/8903d898e039e264a8b03a5d12777488a96909d2/rife_ncnn_vulkan_python/CMakeLists.txt#L225-L245

is enabled in the release action with "-DUSE_STATIC_MOLTENVK=ON" in https://github.com/media2x/rife-ncnn-vulkan-python/blob/8903d898e039e264a8b03a5d12777488a96909d2/.github/workflows/release.yml#L192-L203 So the MacOS version should have already been linked with Foundation libs.

PS: @k4yt3x @u3dreal , I suddenly remembered that I had a very old Macbook air. Maybe I can reopen it to try the testing, but don't expect too much on this, I am not familiar with Mac. You'd better on your own now, because our environment might differ a lot and I don't have much spare time on this recently.

u3dreal commented 3 years ago

I forked it ... I'll have a look when i have time

u3dreal commented 2 years ago

Hmm strange i'm not able to compile nihui version of rife on BigSur. Getting segfaults .. Must be a problem with Vukan SDK and MacOSSDK versions. So for now i can not test it. precompiled rife from nihui works well on 11.5.

ArchieMeng commented 2 years ago

That's fine, because environment issues are common. Maybe nihui's github release action file might help.

u3dreal commented 2 years ago

I followed the release.yaml in detail but no luck