onuralpszr / GFPGAN-ncnn-vulkan

[WIP] NCNN with Vulkan implementation of GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration
GNU General Public License v3.0
38 stars 7 forks source link

Undefined reference to 'cv::Mat:: ' related errors #2

Closed MjiS closed 11 months ago

MjiS commented 11 months ago

Hi, I have tried building and running your repository. When I compile it on Ubuntu I get the following errors which I think are related to my OpenCV version or NCNN. Can you specify the version you have used or recommend?
Currently, I'm using the latest OpenCV and NCNN versions. 1 2

onuralpszr commented 11 months ago

@MjiS why don't you use cmake/make build ? I see that you doing manually ?

MjiS commented 11 months ago

Thank you for replying. I actually did use cmake. But I'm still unable to fix this issue. I have tried installing OpenCV using the following links: 1, https://pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/ 2, https://cv-tricks.com/installation/opencv-4-1-ubuntu18-04/

I tried fixing the linking issue of OpenCV but I'm still unable to resolve it.

onuralpszr commented 11 months ago

@MjiS what is your distro ? Because I have CI on repo is basically compile for ubuntu system

https://github.com/onuralpszr/GFPGAN-ncnn-vulkan/blob/main/.github/workflows/build_devCI.yml.

You can clearly see how I got Vulkan and install Opencv. I didn't compile opencv and I used what ubuntu offer me in their repo. Also Ubuntu on github uses Ubuntu 22.04. I did not use olders systems since they are EOL.

MjiS commented 11 months ago

I am also using Ubuntu 22.04.2 LTS. Thanks for pointing out the workflow. I will try your approach of Windows as you have gently updated the workflow too :smiley:

onuralpszr commented 11 months ago

I am also using Ubuntu 22.04.2 LTS. Thanks for pointing out the workflow. I will try your approach of Windows as you have gently updated the workflow too 😃

We have workflow for windows but I did not tested fully yet. We just compile it.

MjiS commented 11 months ago

I am also using Ubuntu 22.04.2 LTS. Thanks for pointing out the workflow. I will try your approach of Windows as you have gently updated the workflow too 😃

We have workflow for windows but I did not tested fully yet. We just compile it.

I tried it on windows and Ubuntu but I am still stuck with the issues. Can you provide an .exe file so I can test it on my hardware.

MjiS commented 11 months ago

OpenCV errors are gone and now I'm getting these error related to NCNN.

Command I used: g++ -o main gfpgan-ncnn-vulkan-demo.cpp face.cpp gfpgan.cpp realesrgan.cpp -I/home/mji/opencv-4.0.0/build/lib/include/opencv4 -I/home/mji/opencv-4.0.0/build/lib -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core -I/home/mji/Pictures/GFPGAN-ncnn-vulkan/src/external/ncnn/src -I/home/mji/Pictures/GFPGAN-ncnn-vulkan/src/build/external/ncnn/src -I/home/mji/Pictures/GFPGAN-ncnn-vulkan/src/include -I/usr/include/opencv4

Error Log: /usr/bin/ld: warning: libopencv_imgproc.so.4.0, needed by /usr/local/lib/libopencv_gapi.so, may conflict with libopencv_imgproc.so.4.5d /usr/bin/ld: warning: libopencv_core.so.4.0, needed by /usr/local/lib/libopencv_gapi.so, may conflict with libopencv_core.so.4.5d /usr/bin/ld: /tmp/ccx8osO7.o: in function Face::Face()': face.cpp:(.text+0x1084): undefined reference toncnn::Net::Net()' /usr/bin/ld: /tmp/ccx8osO7.o: in function Face::~Face()': face.cpp:(.text+0x10b6): undefined reference toncnn::Net::clear()' /usr/bin/ld: face.cpp:(.text+0x10c2): undefined reference to ncnn::Net::~Net()' /usr/bin/ld: /tmp/ccx8osO7.o: in functionFace::load(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)': face.cpp:(.text+0x10fa): undefined reference to ncnn::Net::load_param(char const*)' /usr/bin/ld: face.cpp:(.text+0x1152): undefined reference toncnn::Net::load_model(char const)' /usr/bin/ld: /tmp/ccx8osO7.o: in function Face::detect(cv::Mat const&, std::vector<Object, std::allocator<Object> >&, float, float)': face.cpp:(.text+0x18a3): undefined reference toncnn::Mat::from_pixels_resize(unsigned char const, int, int, int, int, int, ncnn::Allocator)' /usr/bin/ld: face.cpp:(.text+0x1970): undefined reference to ncnn::Option::Option()' /usr/bin/ld: face.cpp:(.text+0x19fc): undefined reference toncnn::copy_make_border(ncnn::Mat const&, ncnn::Mat&, int, int, int, int, int, float, ncnn::Option const&)' /usr/bin/ld: face.cpp:(.text+0x1a3f): undefined reference to `ncnn::Mat::substract_mean_normalize(float const, float const)' /usr/bin/ld: face.cpp:(.text+0x1a58): undefined reference to ncnn::Net::create_extractor() const' /usr/bin/ld: face.cpp:(.text+0x1a78): undefined reference toncnn::Extractor::input(char const, ncnn::Mat const&)' /usr/bin/ld: face.cpp:(.text+0x1b1d): undefined reference to ncnn::Extractor::extract(char const*, ncnn::Mat&, int)' /usr/bin/ld: face.cpp:(.text+0x1bb8): undefined reference toncnn::Mat::create(int, unsigned long, ncnn::Allocator)' /usr/bin/ld: face.cpp:(.text+0x20a8): undefined reference to `ncnn::Extractor::extract(char const, ncnn::Mat&, int)' /usr/bin/ld: face.cpp:(.text+0x2143): undefined reference to ncnn::Mat::create(int, unsigned long, ncnn::Allocator*)' /usr/bin/ld: face.cpp:(.text+0x2c11): undefined reference toncnn::Extractor::~Extractor()' /usr/bin/ld: face.cpp:(.text+0x3460): undefined reference to ncnn::Extractor::~Extractor()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionGFPGAN::GFPGAN()': gfpgan.cpp:(.text+0x12e): undefined reference to ncnn::Net::Net()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionGFPGAN::~GFPGAN()': gfpgan.cpp:(.text+0x2d8): undefined reference to ncnn::Net::clear()' /usr/bin/ld: gfpgan.cpp:(.text+0x2ea): undefined reference toncnn::Net::~Net()' /usr/bin/ld: /tmp/ccSKszU8.o: in function generate_noise(int const&, int const&, int const&, float const*)': gfpgan.cpp:(.text+0x5e5): undefined reference toncnn::Mat::create(int, int, int, unsigned long, ncnn::Allocator)' /usr/bin/ld: /tmp/ccSKszU8.o: in function relu(ncnn::Mat&, float const&)': gfpgan.cpp:(.text+0x807): undefined reference toncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x825): undefined reference to `ncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x83b): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x85c): undefined reference toncnn::ParamDict::set(int, float)' /usr/bin/ld: gfpgan.cpp:(.text+0x921): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x948): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in function binary_add(ncnn::Mat const&, ncnn::Mat const&, ncnn::Mat&)': gfpgan.cpp:(.text+0x99e): undefined reference toncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x9bc): undefined reference to ncnn::create_layer(char const*)' /usr/bin/ld: gfpgan.cpp:(.text+0x9d2): undefined reference toncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x9eb): undefined reference to ncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x12df): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x136d): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionbinary_mul(ncnn::Mat const&, ncnn::Mat const&, ncnn::Mat&)': gfpgan.cpp:(.text+0x13c3): undefined reference to ncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x13e1): undefined reference toncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x13f7): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x1410): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x1d04): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x1d92): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in function `innerproduct(ncnn::Mat const&, float const, float const, int const&, int const&, ncnn::Mat&)': gfpgan.cpp:(.text+0x1e02): undefined reference to ncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x1e30): undefined reference toncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x1e46): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x1e63): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x1e7c): undefined reference to ncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x1ea5): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x1fc4): undefined reference to ncnn::Mat::create(int, unsigned long, ncnn::Allocator*)' /usr/bin/ld: gfpgan.cpp:(.text+0x1fe9): undefined reference toncnn::Mat::create(int, unsigned long, ncnn::Allocator)' /usr/bin/ld: gfpgan.cpp:(.text+0x2142): undefined reference to `ncnn::ModelBinFromMatArray::ModelBinFromMatArray(ncnn::Mat const)' /usr/bin/ld: gfpgan.cpp:(.text+0x2161): undefined reference to ncnn::ModelBinFromMatArray::~ModelBinFromMatArray()' /usr/bin/ld: gfpgan.cpp:(.text+0x2382): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x23b0): undefined reference to ncnn::ModelBinFromMatArray::~ModelBinFromMatArray()' /usr/bin/ld: gfpgan.cpp:(.text+0x254d): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in function concat(ncnn::Mat const&, ncnn::Mat const&, int, ncnn::Mat&)': gfpgan.cpp:(.text+0x25af): undefined reference toncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x25cd): undefined reference to ncnn::create_layer(char const*)' /usr/bin/ld: gfpgan.cpp:(.text+0x25e3): undefined reference toncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x25fd): undefined reference to ncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x2ef1): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x2f7f): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionconvolution(ncnn::Mat const&, float const, int, int, int, int, ncnn::Mat&)': gfpgan.cpp:(.text+0x2ff8): undefined reference to ncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x3020): undefined reference toncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x3036): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x3050): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x306a): undefined reference to ncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x3083): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x30b4): undefined reference to ncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x30cd): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: /tmp/ccSKszU8.o:gfpgan.cpp:(.text+0x30e7): more undefined references to ncnn::ParamDict::set(int, int)' follow /usr/bin/ld: /tmp/ccSKszU8.o: in functionconvolution(ncnn::Mat const&, float const, int, int, int, int, ncnn::Mat&)': gfpgan.cpp:(.text+0x3254): undefined reference to `ncnn::Mat::create(int, unsigned long, ncnn::Allocator)' /usr/bin/ld: gfpgan.cpp:(.text+0x32fb): undefined reference to ncnn::ModelBinFromMatArray::ModelBinFromMatArray(ncnn::Mat const*)' /usr/bin/ld: gfpgan.cpp:(.text+0x331a): undefined reference toncnn::ModelBinFromMatArray::~ModelBinFromMatArray()' /usr/bin/ld: gfpgan.cpp:(.text+0x3532): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x3560): undefined reference toncnn::ModelBinFromMatArray::~ModelBinFromMatArray()' /usr/bin/ld: gfpgan.cpp:(.text+0x36f4): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionscale(ncnn::Mat const&, float const&, int, ncnn::Mat&)': gfpgan.cpp:(.text+0x375b): undefined reference to ncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x377c): undefined reference toncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x3792): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x37ac): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x37c5): undefined reference to ncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x38cd): undefined reference toncnn::Mat::create(int, unsigned long, ncnn::Allocator)' /usr/bin/ld: gfpgan.cpp:(.text+0x394c): undefined reference to ncnn::ModelBinFromMatArray::ModelBinFromMatArray(ncnn::Mat const*)' /usr/bin/ld: gfpgan.cpp:(.text+0x396b): undefined reference toncnn::ModelBinFromMatArray::~ModelBinFromMatArray()' /usr/bin/ld: gfpgan.cpp:(.text+0x3b83): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x3bb1): undefined reference toncnn::ModelBinFromMatArray::~ModelBinFromMatArray()' /usr/bin/ld: gfpgan.cpp:(.text+0x3d45): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionupsample(ncnn::Mat const&, float const&, ncnn::Mat&)': gfpgan.cpp:(.text+0x3da1): undefined reference to ncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x3dbf): undefined reference toncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x3dd5): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x3dee): undefined reference toncnn::ParamDict::set(int, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x3e0f): undefined reference to ncnn::ParamDict::set(int, float)' /usr/bin/ld: gfpgan.cpp:(.text+0x3e30): undefined reference toncnn::ParamDict::set(int, float)' /usr/bin/ld: gfpgan.cpp:(.text+0x3ef9): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x3f20): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in function clip(ncnn::Mat&, float const&, float const&)': gfpgan.cpp:(.text+0x3f76): undefined reference toncnn::Option::Option()' /usr/bin/ld: gfpgan.cpp:(.text+0x3f94): undefined reference to `ncnn::create_layer(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x3faa): undefined reference to ncnn::ParamDict::ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x3fcb): undefined reference toncnn::ParamDict::set(int, float)' /usr/bin/ld: gfpgan.cpp:(.text+0x3fec): undefined reference to ncnn::ParamDict::set(int, float)' /usr/bin/ld: gfpgan.cpp:(.text+0x40b1): undefined reference toncnn::ParamDict::~ParamDict()' /usr/bin/ld: gfpgan.cpp:(.text+0x40d8): undefined reference to ncnn::ParamDict::~ParamDict()' /usr/bin/ld: /tmp/ccSKszU8.o: in functionGFPGAN::modulated_conv(ncnn::Mat&, ncnn::Mat&, float const, float const, float const, int, int, int, int, int, int, ncnn::Mat&)': gfpgan.cpp:(.text+0x42d3): undefined reference to `ncnn::Mat::create(int, int, int, int, unsigned long, ncnn::Allocator)' /usr/bin/ld: gfpgan.cpp:(.text+0x4f29): undefined reference to ncnn::Mat::create(int, int, int, int, unsigned long, ncnn::Allocator*)' /usr/bin/ld: /tmp/ccSKszU8.o: in functionGFPGAN::to_rgbs(ncnn::Mat&, ncnn::Mat&, ncnn::Mat&, int, int, int, float const, float const, float const, float const)': gfpgan.cpp:(.text+0x6500): undefined reference to ncnn::Mat::reshape(int, int, int, ncnn::Allocator*) const' /usr/bin/ld: /tmp/ccSKszU8.o: in functionGFPGAN::style_convs_modulated_conv(ncnn::Mat&, ncnn::Mat, int, int, ncnn::Mat&, int, int, int, float const, float const, float const, float const, float const)': gfpgan.cpp:(.text+0x7068): undefined reference to `ncnn::Mat::reshape(int, int, int, ncnn::Allocator) const' /usr/bin/ld: /tmp/ccSKszU8.o: in function GFPGAN::load_weights(char const*, std::vector<StyleConvWeights, std::allocator<StyleConvWeights> >&, std::vector<ToRgbConvWeights, std::allocator<ToRgbConvWeights> >&, ncnn::Mat&)': gfpgan.cpp:(.text+0x838b): undefined reference toncnn::Mat::reshape(int, int, int, ncnn::Allocator) const' /usr/bin/ld: gfpgan.cpp:(.text+0x83a9): undefined reference to `ncnn::Mat::clone(ncnn::Allocator) const' /usr/bin/ld: /tmp/ccSKszU8.o: in function GFPGAN::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': gfpgan.cpp:(.text+0x8eb3): undefined reference toncnn::Net::load_param(char const)' /usr/bin/ld: gfpgan.cpp:(.text+0x8f15): undefined reference to `ncnn::Net::load_model(char const)' /usr/bin/ld: /tmp/ccSKszU8.o: in function GFPGAN::process(cv::Mat const&, ncnn::Mat&)': gfpgan.cpp:(.text+0x905d): undefined reference toncnn::Mat::from_pixels_resize(unsigned char const, int, int, int, int, int, ncnn::Allocator)' /usr/bin/ld: gfpgan.cpp:(.text+0x9085): undefined reference to ncnn::Mat::substract_mean_normalize(float const*, float const*)' /usr/bin/ld: gfpgan.cpp:(.text+0x90a5): undefined reference toncnn::Net::create_extractor() const' /usr/bin/ld: gfpgan.cpp:(.text+0x90c5): undefined reference to ncnn::Extractor::input(char const*, ncnn::Mat const&)' /usr/bin/ld: gfpgan.cpp:(.text+0x915b): undefined reference toncnn::Extractor::extract(char const, ncnn::Mat&, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x9274): undefined reference to `ncnn::Extractor::extract(char const, ncnn::Mat&, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x9296): undefined reference to ncnn::Extractor::extract(char const*, ncnn::Mat&, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x93d2): undefined reference toncnn::Extractor::extract(char const, ncnn::Mat&, int)' /usr/bin/ld: gfpgan.cpp:(.text+0x93f4): undefined reference to `ncnn::Extractor::extract(char const, ncnn::Mat&, int)' /usr/bin/ld: /tmp/ccSKszU8.o:gfpgan.cpp:(.text+0x9530): more undefined references to ncnn::Extractor::extract(char const*, ncnn::Mat&, int)' follow /usr/bin/ld: /tmp/ccSKszU8.o: in functionGFPGAN::process(cv::Mat const&, ncnn::Mat&)': gfpgan.cpp:(.text+0xe90c): undefined reference to ncnn::Extractor::~Extractor()' /usr/bin/ld: gfpgan.cpp:(.text+0x11021): undefined reference toncnn::Extractor::~Extractor()' /usr/bin/ld: /tmp/cc2aVPxj.o: in function RealESRGAN::RealESRGAN()': realesrgan.cpp:(.text+0x4f): undefined reference toncnn::Net::Net()' /usr/bin/ld: /tmp/cc2aVPxj.o: in function RealESRGAN::~RealESRGAN()': realesrgan.cpp:(.text+0xa6): undefined reference toncnn::Net::clear()' /usr/bin/ld: realesrgan.cpp:(.text+0xb6): undefined reference to ncnn::Net::~Net()' /usr/bin/ld: /tmp/cc2aVPxj.o: in functionRealESRGAN::load(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)': realesrgan.cpp:(.text+0xf2): undefined reference to ncnn::Net::load_param(char const*)' /usr/bin/ld: realesrgan.cpp:(.text+0x14e): undefined reference toncnn::Net::load_model(char const)' /usr/bin/ld: /tmp/cc2aVPxj.o: in function RealESRGAN::inference(cv::Mat const&, ncnn::Mat&, int, int)': realesrgan.cpp:(.text+0x1186): undefined reference toncnn::Mat::from_pixels(unsigned char const, int, int, int, ncnn::Allocator)' /usr/bin/ld: realesrgan.cpp:(.text+0x11a2): undefined reference to `ncnn::Mat::substract_mean_normalize(float const, float const)' /usr/bin/ld: realesrgan.cpp:(.text+0x11bc): undefined reference to ncnn::Net::create_extractor() const' /usr/bin/ld: realesrgan.cpp:(.text+0x11d6): undefined reference toncnn::Extractor::input(char const, ncnn::Mat const&)' /usr/bin/ld: realesrgan.cpp:(.text+0x11f5): undefined reference to ncnn::Extractor::extract(char const*, ncnn::Mat&, int)' /usr/bin/ld: realesrgan.cpp:(.text+0x1206): undefined reference toncnn::Extractor::~Extractor()' /usr/bin/ld: realesrgan.cpp:(.text+0x1377): undefined reference to `ncnn::Extractor::~Extractor()' collect2: error: ld returned 1 exit status

onuralpszr commented 11 months ago

Do not include opencv twice from 2 different source and please USE "cmake" it will make easier. just install cmake and

git clone --recursive https://github.com/onuralpszr/GFPGAN-ncnn-vulkan.git
cd GFPGAN-ncnn-vulkan
mkdir build
cd build
cmake ..
make -j2

If you already install opencv and vulkanSDK , which I can see that you have opencv part done you should be able to install without problem.

MjiS commented 11 months ago

I did use cmake and here are the log for cmake .. `$ cmake .. -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Found Vulkan: /usr/lib/x86_64-linux-gnu/libvulkan.so
-- Vulkan_INCLUDE_DIRS: /usr/include -- Vulkan_LIBRARIES: /usr/lib/x86_64-linux-gnu/libvulkan.so -- Vulkan_LIBRARY: /usr/lib/x86_64-linux-gnu/libvulkan.so -- Vulkan_FOUND: TRUE -- Found glslangValidator: /usr/bin/glslangValidator -- Found OpenCV: /usr/local (found version "4.0.0") -- OpenCV_LIBS: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hfs;opencv_img_hash;opencv_line_descriptor;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto -- OpenCV_INCLUDE_DIRS: /usr/local/include/opencv4 -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
OPENMP FOUND -- CMAKE_INSTALL_PREFIX = /usr/local -- NCNN_VERSION_STRING = 1.0.20231003 -- Performing Test NCNN_COMPILER_SUPPORT_GNU_INLINE_ASM -- Performing Test NCNN_COMPILER_SUPPORT_GNU_INLINE_ASM - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_FMA -- Performing Test NCNN_COMPILER_SUPPORT_X86_FMA - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_XOP -- Performing Test NCNN_COMPILER_SUPPORT_X86_XOP - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_F16C -- Performing Test NCNN_COMPILER_SUPPORT_X86_F16C - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX2 -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX2 - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512 -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512 - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX_VNNI -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX_VNNI - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512_VNNI -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512_VNNI - Success -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512_BF16 -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512_BF16 - Failed -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512_FP16 -- Performing Test NCNN_COMPILER_SUPPORT_X86_AVX512_FP16 - Failed CMake Warning at external/ncnn/CMakeLists.txt:496 (message): The compiler does not support avx512 bf16 extension. NCNN_AVX512BF16 will be OFF.

CMake Warning at external/ncnn/CMakeLists.txt:503 (message): The compiler does not support avx512 fp16 extension. NCNN_AVX512FP16 will be OFF.

-- Target arch: x86 64bit -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Performing Test HAVE_BUILTIN_BSWAP16 -- Performing Test HAVE_BUILTIN_BSWAP16 - Success -- Performing Test HAVE_BUILTIN_BSWAP32 -- Performing Test HAVE_BUILTIN_BSWAP32 - Success -- Performing Test HAVE_BUILTIN_BSWAP64 -- Performing Test HAVE_BUILTIN_BSWAP64 - Success -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Performing Test HAVE_MATH_LIBRARY -- Performing Test HAVE_MATH_LIBRARY - Failed -- Adding -lm flag. -- Looking for include file GLUT/glut.h -- Looking for include file GLUT/glut.h - not found -- Looking for include file GL/glut.h -- Looking for include file GL/glut.h - not found -- Looking for include file OpenGL/glut.h -- Looking for include file OpenGL/glut.h - not found -- Looking for include file shlwapi.h -- Looking for include file shlwapi.h - not found -- Looking for include file unistd.h -- Looking for include file unistd.h - found -- Looking for include file wincodec.h -- Looking for include file wincodec.h - not found -- Looking for include file windows.h -- Looking for include file windows.h - not found -- Performing Test WEBP_HAVE_FLAG_SSE41 -- Performing Test WEBP_HAVE_FLAG_SSE41 - Failed -- Performing Test WEBP_HAVE_FLAG_SSE41 -- Performing Test WEBP_HAVE_FLAG_SSE41 - Success -- Performing Test WEBP_HAVE_FLAG_SSE2 -- Performing Test WEBP_HAVE_FLAG_SSE2 - Success -- Performing Test WEBP_HAVE_FLAG_MIPS32 -- Performing Test WEBP_HAVE_FLAG_MIPS32 - Failed -- Performing Test WEBP_HAVE_FLAG_MIPS32 -- Performing Test WEBP_HAVE_FLAG_MIPS32 - Failed -- Performing Test WEBP_HAVE_FLAG_MIPS_DSP_R2 -- Performing Test WEBP_HAVE_FLAG_MIPS_DSP_R2 - Failed -- Performing Test WEBP_HAVE_FLAG_MIPS_DSP_R2 -- Performing Test WEBP_HAVE_FLAG_MIPS_DSP_R2 - Failed -- Performing Test HAS_COMPILE_FLAG -- Performing Test HAS_COMPILE_FLAG - Failed -- Performing Test WEBP_HAVE_FLAG_NEON -- Performing Test WEBP_HAVE_FLAG_NEON - Failed -- Performing Test WEBP_HAVE_FLAG_NEON -- Performing Test WEBP_HAVE_FLAG_NEON - Failed -- Performing Test WEBP_HAVE_FLAG_MSA -- Performing Test WEBP_HAVE_FLAG_MSA - Failed -- Performing Test WEBP_HAVE_FLAG_MSA -- Performing Test WEBP_HAVE_FLAG_MSA - Failed -- Performing Test HAS_COMPILE_FLAG -- Performing Test HAS_COMPILE_FLAG - Failed -- Configuring done -- Generating done -- Build files have been written to: /home/mji/Music/GFPGAN-ncnn-vulkan/src/build`

Here is the command for compilation:

g++ -o main gfpgan-ncnn-vulkan-demo.cpp face.cpp gfpgan.cpp realesrgan.cpp -L/home/mji/Documents/ncnn/build/install/lib -lncnn -fopenmp -lvulkan -L/home/mji/opencv-4.0.0/build/lib -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core -I/home/mji/Music/GFPGAN-ncnn-vulkan/src/external/ncnn/src -I/home/mji/Music/GFPGAN-ncnn-vulkan/src/build/external/ncnn/src -I/home/mji/Music/GFPGAN-ncnn-vulkan/src/include -I/usr/include/opencv4 -L/usr/lib/x86_64-linux-gnu/ -lglslang

Here are the logs: /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in functionncnn::destroy_gpu_instance()': gpu.cpp:(.text+0xead): undefined reference to glslang::FinalizeProcess()' /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in functionncnn::create_gpu_instance()': gpu.cpp:(.text+0x4a18): undefined reference to glslang::InitializeProcess()' /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in functionncnn::compile_spirv_module(char const, int, ncnn::Option const&, std::vector<unsigned int, std::allocator >&)': gpu.cpp:(.text+0xabc5): undefined reference to glslang::TShader::TShader(EShLanguage)' /usr/bin/ld: gpu.cpp:(.text+0xabe7): undefined reference toglslang::TShader::setStringsWithLengths(char const const, int const, int)' /usr/bin/ld: gpu.cpp:(.text+0xac04): undefined reference to glslang::TShader::addProcesses(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)' /usr/bin/ld: gpu.cpp:(.text+0xac16): undefined reference toglslang::TShader::setEntryPoint(char const)' /usr/bin/ld: gpu.cpp:(.text+0xac21): undefined reference to `glslang::TShader::setSourceEntryPoint(char const)' /usr/bin/ld: gpu.cpp:(.text+0xae1d): undefined reference to glslang::TShader::parse(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)' /usr/bin/ld: gpu.cpp:(.text+0xae5c): undefined reference toglslang::TShader::getInfoLog()' /usr/bin/ld: gpu.cpp:(.text+0xae7c): undefined reference to glslang::TShader::getInfoDebugLog()' /usr/bin/ld: gpu.cpp:(.text+0xaea6): undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: gpu.cpp:(.text+0xafb1): undefined reference to glslang::GlslangToSpv(glslang::TIntermediate const&, std::vector<unsigned int, std::allocator<unsigned int> >&, glslang::SpvOptions*)' /usr/bin/ld: gpu.cpp:(.text+0xafc0): undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in function ncnn::compile_spirv_module(char const*, int, ncnn::Option const&, std::vector<unsigned int, std::allocator<unsigned int> >&) [clone .cold]': gpu.cpp:(.text.unlikely+0x317): undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: /tmp/ccahi8bk.o: in function to_ocv(ncnn::Mat const&, cv::Mat&)': gfpgan-ncnn-vulkan-demo.cpp:(.text+0xd69): undefined reference tocv::Mat::Mat()' /usr/bin/ld: /tmp/ccahi8bk.o: in function paste_faces_to_input_image(cv::Mat const&, cv::Mat&, cv::Mat&)': gfpgan-ncnn-vulkan-demo.cpp:(.text+0xf67): undefined reference tocv::Mat::Mat()' /usr/bin/ld: gfpgan-ncnn-vulkan-demo.cpp:(.text+0x10ed): undefined reference to cv::Mat::Mat()' /usr/bin/ld: gfpgan-ncnn-vulkan-demo.cpp:(.text+0x11e0): undefined reference tocv::Mat::Mat()' /usr/bin/ld: gfpgan-ncnn-vulkan-demo.cpp:(.text+0x1323): undefined reference to cv::Mat::Mat()' /usr/bin/ld: /tmp/ccahi8bk.o:gfpgan-ncnn-vulkan-demo.cpp:(.text+0x146e): more undefined references tocv::Mat::Mat()' follow /usr/bin/ld: /tmp/ccd8ZbuM.o: in function Object::Object(Object&&)': face.cpp:(.text._ZN6ObjectC2EOS_[_ZN6ObjectC5EOS_]+0x7a): undefined reference tocv::Mat::Mat(cv::Mat&&)' /usr/bin/ld: /tmp/ccd8ZbuM.o: in function void __gnu_cxx::new_allocator<cv::Mat>::construct<cv::Mat, cv::Mat>(cv::Mat*, cv::Mat&&)': face.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN2cv3MatEE9constructIS2_JS2_EEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN2cv3MatEE9constructIS2_JS2_EEEvPT_DpOT0_]+0x47): undefined reference tocv::Mat::Mat(cv::Mat&&)' /usr/bin/ld: /tmp/ccDZB8rU.o: in function RealESRGAN::to_ocv(cv::Mat const&, ncnn::Mat const&)': realesrgan.cpp:(.text+0xe88): undefined reference tocv::Mat::Mat()' /usr/bin/ld: /tmp/ccDZB8rU.o: in function RealESRGAN::tile_process(cv::Mat const&, cv::Mat&)': realesrgan.cpp:(.text+0x14df): undefined reference tocv::Mat::Mat()' /usr/bin/ld: realesrgan.cpp:(.text+0x15e0): undefined reference to cv::Mat::Mat(cv::Size_<int>, int)' collect2: error: ld returned 1 exit status

MjiS commented 11 months ago

Update: Command g++ -o main gfpgan-ncnn-vulkan-demo.cpp face.cpp gfpgan.cpp realesrgan.cpp -L/home/mji/Documents/ncnn/build/install/lib -lncnn -fopenmp -lvulkan -I/home/mji/opencv-4.0.0/build/lib/include/opencv4 -L/home/mji/opencv-4.0.0/build/lib -lopencv_gapi -lopencv_core -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/external/ncnn/src -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/build/external/ncnn/src -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/include -I/usr/include/opencv4 -L/usr/lib/x86_64-linux-gnu -lglslang -lSPIRV -lHLSL -lOSDependent -lOGLCompiler

Error Log: /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in function ncnn::destroy_gpu_instance()': gpu.cpp:(.text+0xead): undefined reference toglslang::FinalizeProcess()' /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in function ncnn::create_gpu_instance()': gpu.cpp:(.text+0x4a18): undefined reference toglslang::InitializeProcess()' /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in function ncnn::compile_spirv_module(char const*, int, ncnn::Option const&, std::vector<unsigned int, std::allocator<unsigned int> >&)': gpu.cpp:(.text+0xabc5): undefined reference toglslang::TShader::TShader(EShLanguage)' /usr/bin/ld: gpu.cpp:(.text+0xabe7): undefined reference to glslang::TShader::setStringsWithLengths(char const* const*, int const*, int)' /usr/bin/ld: gpu.cpp:(.text+0xac04): undefined reference toglslang::TShader::addProcesses(std::vector<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::cxx11::basic_string<char, std::char_traits, std::allocator > > > const&)' /usr/bin/ld: gpu.cpp:(.text+0xac16): undefined reference to glslang::TShader::setEntryPoint(char const*)' /usr/bin/ld: gpu.cpp:(.text+0xac21): undefined reference toglslang::TShader::setSourceEntryPoint(char const)' /usr/bin/ld: gpu.cpp:(.text+0xae1d): undefined reference to `glslang::TShader::parse(TBuiltInResource const, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)' /usr/bin/ld: gpu.cpp:(.text+0xae5c): undefined reference to glslang::TShader::getInfoLog()' /usr/bin/ld: gpu.cpp:(.text+0xae7c): undefined reference toglslang::TShader::getInfoDebugLog()' /usr/bin/ld: gpu.cpp:(.text+0xaea6): undefined reference to glslang::TShader::~TShader()' /usr/bin/ld: gpu.cpp:(.text+0xafc0): undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: /home/mji/Documents/ncnn/build/install/lib/libncnn.a(gpu.cpp.o): in function ncnn::compile_spirv_module(char const*, int, ncnn::Option const&, std::vector<unsigned int, std::allocator<unsigned int> >&) [clone .cold]': gpu.cpp:(.text.unlikely+0x317): undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function std::_Rb_tree_node<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > >* std::_Rb_tree<int, std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> >, std::_Select1st<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > >, std::less<int>, glslang::pool_allocator<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > > >::_M_copy<false, std::_Rb_tree<int, std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> >, std::_Select1st<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > >, std::less<int>, glslang::pool_allocator<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > > >::_Alloc_node>(std::_Rb_tree_node<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > >*, std::_Rb_tree_node_base*, std::_Rb_tree<int, std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> >, std::_Select1st<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > >, std::less<int>, glslang::pool_allocator<std::pair<int const, glslang::TVector<glslang::TIntermConstantUnion const*> > > >::_Alloc_node&) [clone .isra.0]': (.text+0xb23): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text+0xb32): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0xb67): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text+0xbfb): undefined reference to glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text+0xc0a): undefined reference toglslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0xc42): undefined reference to glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in functionstd::_Rb_tree_node<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > > std::_Rb_tree<int, std::pair<int const, glslang::TVector<glslang::TIntermTyped const> >, std::_Select1st<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > >, std::less, glslang::pool_allocator<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > > >::_M_copy<false, std::_Rb_tree<int, std::pair<int const, glslang::TVector<glslang::TIntermTyped const> >, std::_Select1st<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > >, std::less, glslang::pool_allocator<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > > >::_Alloc_node>(std::_Rb_tree_node<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > >, std::_Rb_tree_node_base, std::_Rb_tree<int, std::pair<int const, glslang::TVector<glslang::TIntermTyped const> >, std::_Select1st<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > >, std::less, glslang::pool_allocator<std::pair<int const, glslang::TVector<glslang::TIntermTyped const> > > >::_Alloc_node&) [clone .isra.0]': (.text+0xd23): undefined reference to glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text+0xd32): undefined reference toglslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0xd67): undefined reference to glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text+0xdfb): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text+0xe0a): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0xe42): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function (anonymous namespace)::TGlslangToSpvTraverser::convertGlslangToSpvType(glslang::TType const&, glslang::TLayoutPacking, glslang::TQualifier const&, bool, bool)': (.text+0xffc2): undefined reference toglslang::TIntermediate::getMemberAlignment(glslang::TType const&, int&, int&, glslang::TLayoutPacking, bool)' /usr/bin/ld: (.text+0x100c9): undefined reference to glslang::TIntermediate::getMemberAlignment(glslang::TType const&, int&, int&, glslang::TLayoutPacking, bool)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function(anonymous namespace)::TGlslangToSpvTraverser::convertGlslangStructToSpvType(glslang::TType const&, glslang::TVector const, glslang::TLayoutPacking, glslang::TQualifier const&)': (.text+0x11fa9): undefined reference to glslang::TIntermediate::getMemberAlignment(glslang::TType const&, int&, int&, glslang::TLayoutPacking, bool)' /usr/bin/ld: (.text+0x12088): undefined reference toglslang::TIntermediate::improperStraddle(glslang::TType const&, int, int)' /usr/bin/ld: (.text+0x125ef): undefined reference to glslang::TIntermediate::getMemberAlignment(glslang::TType const&, int&, int&, glslang::TLayoutPacking, bool)' /usr/bin/ld: (.text+0x12d5f): undefined reference toglslang::TIntermediate::getBaseAlignmentScalar(glslang::TType const&, int&)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function `(anonymous namespace)::TGlslangToSpvTraverser::visitBinary(glslang::TVisit, glslang::TIntermBinary)': (.text+0x1bd5b): undefined reference to glslang::TIntermediate::getBaseAlignmentScalar(glslang::TType const&, int&)' /usr/bin/ld: (.text+0x1c5cc): undefined reference toglslang::TIntermediate::getBaseAlignmentScalar(glslang::TType const&, int&)' /usr/bin/ld: (.text+0x1c750): undefined reference to glslang::TIntermediate::getBaseAlignmentScalar(glslang::TType const&, int&)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function(anonymous namespace)::TGlslangToSpvTraverser::getSymbolId(glslang::TIntermSymbol const)': (.text+0x2089a): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0x21060): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function `(anonymous namespace)::TGlslangToSpvTraverser::visitUnary(glslang::TVisit, glslang::TIntermUnary)': (.text+0x261b1): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function(anonymous namespace)::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit, glslang::TIntermAggregate)': (.text+0x29b65): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0x2acc9): undefined reference toglslang::TIntermediate::findLinkerObjects() const' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function `glslang::GlslangToSpv(glslang::TIntermediate const&, std::vector<unsigned int, std::allocator >&, spv::SpvBuildLogger, glslang::SpvOptions)': (.text+0x2c8b5): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0x2c8bd): undefined reference toglslang::TPoolAllocator::push()' /usr/bin/ld: (.text+0x2c8f0): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0x2c963): undefined reference toglslang::GetKhronosToolId()' /usr/bin/ld: (.text+0x2d1e3): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0x2d1eb): undefined reference toglslang::TPoolAllocator::pop()' /usr/bin/ld: (.text+0x2d597): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text+0x2d659): undefined reference toglslang::GetThreadPoolAllocator()' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function glslang::TType::setFieldName(std::__cxx11::basic_string<char, std::char_traits<char>, glslang::pool_allocator<char> > const&)': (.text._ZN7glslang5TType12setFieldNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE[_ZN7glslang5TType12setFieldNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE]+0x1a): undefined reference toglslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text._ZN7glslang5TType12setFieldNameERKNSt7cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE[_ZN7glslang5TType12setFieldNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE]+0x27): undefined reference to `glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text._ZN7glslang5TType12setFieldNameERKNSt7cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE[_ZN7glslang5TType12setFieldNameERKNSt7cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE]+0x2f): undefined reference to `glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text._ZN7glslang5TType12setFieldNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE[_ZN7glslang5TType12setFieldNameERKNSt7cxx1112basic_stringIcSt11char_traitsIcENS_14pool_allocatorIcEEEE]+0x98): undefined reference to glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in functionglslang::TType::TType(glslang::TType const&, int, bool)': (.text._ZN7glslang5TTypeC2ERKS0_ib[_ZN7glslang5TTypeC5ERKS0_ib]+0x247): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text._ZN7glslang5TTypeC2ERKS0_ib[_ZN7glslang5TTypeC5ERKS0_ib]+0x254): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text._ZN7glslang5TTypeC2ERKS0_ib[_ZN7glslang5TTypeC5ERKS0_ib]+0x2b2): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text._ZN7glslang5TTypeC2ERKS0_ib[_ZN7glslang5TTypeC5ERKS0_ib]+0x2bf): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: (.text._ZN7glslang5TTypeC2ERKS0_ib[_ZN7glslang5TTypeC5ERKS0_ib]+0x2c7): undefined reference to glslang::GetThreadPoolAllocator()' /usr/bin/ld: (.text._ZN7glslang5TTypeC2ERKS0_ib[_ZN7glslang5TTypeC5ERKS0_ib]+0x325): undefined reference toglslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function glslang::TType::operator==(glslang::TType const&) const': (.text._ZNK7glslang5TTypeeqERKS0_[_ZNK7glslang5TTypeeqERKS0_]+0x3e0): undefined reference toglslang::TSpirvTypeParameter::operator==(glslang::TSpirvTypeParameter const&) const' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSPIRV.a(GlslangToSpv.cpp.o): in function `glslang::TIntermConstantUnion const& std::vector<glslang::TIntermConstantUnion const, glslang::pool_allocator<glslang::TIntermConstantUnion const> >::emplace_back<glslang::TIntermConstantUnion const>(glslang::TIntermConstantUnion const&&)': (.text._ZNSt6vectorIPKN7glslang20TIntermConstantUnionENS0_14pool_allocatorIS3_EEE12emplace_backIJS3_EEERS3DpOT[_ZNSt6vectorIPKN7glslang20TIntermConstantUnionENS0_14pool_allocatorIS3_EEE12emplace_backIJS3_EEERS3DpOT]+0xfd): undefined reference to glslang::TPoolAllocator::allocate(unsigned long)' /usr/bin/ld: /tmp/cczFxPGm.o: in functionto_ocv(ncnn::Mat const&, cv::Mat&)': gfpgan-ncnn-vulkan-demo.cpp:(.text+0xd69): undefined reference to cv::Mat::Mat()' /usr/bin/ld: /tmp/cczFxPGm.o: in functionpaste_faces_to_input_image(cv::Mat const&, cv::Mat&, cv::Mat&)': gfpgan-ncnn-vulkan-demo.cpp:(.text+0xf67): undefined reference to cv::Mat::Mat()' /usr/bin/ld: gfpgan-ncnn-vulkan-demo.cpp:(.text+0x10ed): undefined reference tocv::Mat::Mat()' /usr/bin/ld: gfpgan-ncnn-vulkan-demo.cpp:(.text+0x11e0): undefined reference to cv::Mat::Mat()' /usr/bin/ld: gfpgan-ncnn-vulkan-demo.cpp:(.text+0x1323): undefined reference tocv::Mat::Mat()' /usr/bin/ld: /tmp/cczFxPGm.o:gfpgan-ncnn-vulkan-demo.cpp:(.text+0x146e): more undefined references to cv::Mat::Mat()' follow /usr/bin/ld: /tmp/ccGocYoK.o: in functionObject::Object(Object&&)': face.cpp:(.text.ZN6ObjectC2EOS[ZN6ObjectC5EOS]+0x7a): undefined reference to cv::Mat::Mat(cv::Mat&&)' /usr/bin/ld: /tmp/ccGocYoK.o: in functionvoid gnu_cxx::new_allocator::construct<cv::Mat, cv::Mat>(cv::Mat*, cv::Mat&&)': face.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN2cv3MatEE9constructIS2_JS2_EEEvPTDpOT0[_ZN9gnu_cxx13new_allocatorIN2cv3MatEE9constructIS2_JS2_EEEvPTDpOT0]+0x47): undefined reference to cv::Mat::Mat(cv::Mat&&)' /usr/bin/ld: /tmp/ccN0MHMH.o: in functionRealESRGAN::to_ocv(cv::Mat const&, ncnn::Mat const&)': realesrgan.cpp:(.text+0xe88): undefined reference to cv::Mat::Mat()' /usr/bin/ld: /tmp/ccN0MHMH.o: in functionRealESRGAN::tileprocess(cv::Mat const&, cv::Mat&)': realesrgan.cpp:(.text+0x14df): undefined reference to cv::Mat::Mat()' /usr/bin/ld: realesrgan.cpp:(.text+0x15e0): undefined reference tocv::Mat::Mat(cv::Size, int)' collect2: error: ld returned 1 exit status

onuralpszr commented 11 months ago

g++ -o main gfpgan-ncnn-vulkan-demo.cpp face.cpp gfpgan.cpp realesrgan.cpp -L/home/mji/Documents/ncnn/build/install/lib -lncnn -fopenmp -lvulkan -I/home/mji/opencv-4.0.0/build/lib/include/opencv4 -L/home/mji/opencv-4.0.0/build/lib -lopencv_gapi -lopencv_core -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/external/ncnn/src -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/build/external/ncnn/src -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/include -I/usr/include/opencv4 -L/usr/lib/x86_64-linux-gnu -lglslang -lSPIRV -lHLSL -lOSDependent -lOGLCompiler

Did you type this yourself ?

onuralpszr commented 11 months ago

First please remove that opencv 4.0.0 from path and do this commands. I see that you have vulkan so that should be fine.

sudo apt update
sudo apt install libopencv-dev python3-opencv -y
git clone --recursive https://github.com/onuralpszr/GFPGAN-ncnn-vulkan.git
cd GFPGAN-ncnn-vulkan
mkdir build && cd build
cmake ../src
cmake --build . -j 2
MjiS commented 11 months ago

g++ -o main gfpgan-ncnn-vulkan-demo.cpp face.cpp gfpgan.cpp realesrgan.cpp -L/home/mji/Documents/ncnn/build/install/lib -lncnn -fopenmp -lvulkan -I/home/mji/opencv-4.0.0/build/lib/include/opencv4 -L/home/mji/opencv-4.0.0/build/lib -lopencv_gapi -lopencv_core -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/external/ncnn/src -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/build/external/ncnn/src -I/home/mji/Documents/GFPGAN-ncnn-vulkan/src/include -I/usr/include/opencv4 -L/usr/lib/x86_64-linux-gnu -lglslang -lSPIRV -lHLSL -lOSDependent -lOGLCompiler

Did you type this yourself ?

I used gpt for this command as per gpt's suggestion, order of import matters. Previous commands were typed by me.

Don't use this and use what I sent and also please install opencv via commands I typed as well. Use "cmake" it is so much easier to control and compile, you don't need to think THOSE commands at all. And remove opencv 4.0.0 from your path and etc. Re-check my workflow and my commands I sent you.