zhy520xp / mace-makefile-project

makefile 交叉编译 libmace.a,并能在嵌入式端调用GPU来跑深度学习模型
96 stars 18 forks source link

arm-linux gpu库编译出错 #9

Closed leeburt closed 6 years ago

leeburt commented 6 years ago

出错的log如下: g++ -O3 -std=c++11 -fpermissive -DMACE_ENABLE_OPENCL -I.. -I../include/protobuf3.4.0 -I../include -I../include/opencl_clhpp -I../include/opencl20 -I../mace -I../mace/publics -c -o ../mace/core/runtime/opencl/opencl_runtime.o ../mace/core/runtime/opencl/opencl_runtime.cc ../mace/core/runtime/opencl/opencl_runtime.cc: In constructor ‘mace::OpenCLRuntime::OpenCLRuntime()’: ../mace/core/runtime/opencl/opencl_runtime.cc:383:47: error: call of overloaded ‘Context(, int, std::nullptr_t, std::nullptr_t, cl_int)’ is ambiguous nullptr, nullptr, &err)); ^ ../mace/core/runtime/opencl/opencl_runtime.cc:383:47: note: candidates are: In file included from ../mace/core/runtime/opencl/cl2_header.h:23:0, from ../mace/core/runtime/opencl/opencl_runtime.h:26, from ../mace/core/runtime/opencl/opencl_runtime.cc:15: ../include/opencl_clhpp/include/CL/cl2.hpp:2674:5: note: cl::Context::Context(const cl::Device&, cl_context_properties, void ()(const char, const void, cl::size_type, void), void, cl_int) Context( ^ ../include/opencl_clhpp/include/CL/cl2.hpp:2643:5: note: cl::Context::Context(cl::vector&, cl_context_properties, void ()(const char, const void, cl::size_type, void), void, cl_int) Context( ^ ../mace/core/runtime/opencl/opencl_runtime.cc:393:49: error: call of overloaded ‘Context(, int, std::nullptr_t, std::nullptr_t, cl_int)’ is ambiguous nullptr, nullptr, &err)); ^ ../mace/core/runtime/opencl/opencl_runtime.cc:393:49: note: candidates are: In file included from ../mace/core/runtime/opencl/cl2_header.h:23:0, from ../mace/core/runtime/opencl/opencl_runtime.h:26, from ../mace/core/runtime/opencl/opencl_runtime.cc:15: ../include/opencl_clhpp/include/CL/cl2.hpp:2674:5: note: cl::Context::Context(const cl::Device&, cl_context_properties, void ()(const char, const void, cl::size_type, void), void, cl_int) Context( ^ ../include/opencl_clhpp/include/CL/cl2.hpp:2643:5: note: cl::Context::Context(cl::vector&, cl_context_properties, void ()(const char, const void, cl::size_type, void), void, cl_int) Context( ^ ../mace/core/runtime/opencl/opencl_runtime.cc:396:70: error: call of overloaded ‘Context(, std::nullptr_t, std::nullptr_t, std::nullptr_t, clint)’ is ambiguous new cl::Context({device}, nullptr, nullptr, nullptr, &err)); ^ ../mace/core/runtime/opencl/opencl_runtime.cc:396:70: note: candidates are: In file included from ../mace/core/runtime/opencl/cl2_header.h:23:0, from ../mace/core/runtime/opencl/opencl_runtime.h:26, from ../mace/core/runtime/opencl/opencl_runtime.cc:15: ../include/opencl_clhpp/include/CL/cl2.hpp:2674:5: note: cl::Context::Context(const cl::Device&, cl_context_properties, void ()(const char, const void, cl::size_type, void), void, cl_int) Context( ^ ../include/opencl_clhpp/include/CL/cl2.hpp:2643:5: note: cl::Context::Context(cl::vector&, cl_context_properties, void ()(const char, const void, cl::size_type, void), void, cl_int) Context( ^ make: *** [../mace/core/runtime/opencl/opencl_runtime.o] Error 1

zhy520xp commented 6 years ago

你的编译器应该不支持c++11吧

leeburt commented 6 years ago

编译器时支持的c++11的。对于编译器还需要什么条件吗?

zhy520xp commented 6 years ago

把c++11改成c++14试试。

leeburt commented 6 years ago

我的编译器目前只支持c++11,请问有什么其他方法吗?

leeburt commented 6 years ago

我已经编过了,将三处new cl::Context({device_}, (cl_context_properties)contextproperties.data(), nullptr, nullptr, &err)改为new cl::Context(*device, (cl_context_properties*)context_properties.data(), nullptr, nullptr, &err)即可。

zhy520xp commented 6 years ago

mace里面有些c++代码,用了c++的高级特征,有些编译器支持不了。所以最好自己要具备修改源码的能力