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

macOS 11.5.2 Symbol not found: _NSLocalizedDescriptionKey #3

Open
u3dreal opened this issue Sep 5, 2021 · 10 comments
Open

macOS 11.5.2 Symbol not found: _NSLocalizedDescriptionKey #3

u3dreal opened this issue Sep 5, 2021 · 10 comments

Comments

@u3dreal
Copy link

u3dreal commented Sep 5, 2021

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 !

@u3dreal u3dreal changed the title macOS 11 Symbol not found: _NSLocalizedDescriptionKey macOS 11.5.2 Symbol not found: _NSLocalizedDescriptionKey Sep 5, 2021
@ArchieMeng
Copy link
Member

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

if (${CMAKE_VERSION} VERSION_LESS "3.15" OR ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
include_directories(${PYTHON_INCLUDE_DIRS})
target_link_libraries(rife_ncnn_vulkan_wrapper ${RIFE_LINK_LIBRARIES} ${PYTHON_LIBRARIES})
might solve the issue.

Additionally, could you check:

  • if the latest git version works
  • if rife-ncnn-vulkan (nihui's original one) release build works
  • What are exactly linked with _rife_ncnn_vulkan_wrapper.so on OSX? Maybe this link from StackOverFlow may help.

@u3dreal
Copy link
Author

u3dreal commented Sep 6, 2021

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
Copy link
Member

k4yt3x commented Sep 6, 2021

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 single `s.

@u3dreal
Copy link
Author

u3dreal commented Sep 6, 2021

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

@k4yt3x
Copy link
Member

k4yt3x commented Sep 6, 2021

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

@ArchieMeng
Copy link
Member

ArchieMeng commented Sep 6, 2021

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

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

is enabled in the release action with "-DUSE_STATIC_MOLTENVK=ON" in

- name: build-x86_64
run: |
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.162.0/macOS
mkdir build-x86_64 && cd build-x86_64
cmake -DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-DVulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.2.162.0/MoltenVK/include \
-DVulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.2.162.0/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
../src
cmake --build . -j 3

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
Copy link
Author

u3dreal commented Sep 6, 2021

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

@u3dreal
Copy link
Author

u3dreal commented Sep 12, 2021

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
Copy link
Member

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

@u3dreal
Copy link
Author

u3dreal commented Sep 12, 2021

I followed the release.yaml in detail but no luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants