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

下载后编译直接报错 #336

Closed
liupengkd opened this issue Apr 8, 2018 · 14 comments
Closed

下载后编译直接报错 #336

liupengkd opened this issue Apr 8, 2018 · 14 comments

Comments

@liupengkd
Copy link

我直接操作如下

  1. cd ncnn 2. mkdir build && cd build 3. cmake .. 4. make
    make 时报错
    In file included from /usr/include/c++/5/atomic:38:0,
    from /usr/local/include/google/protobuf/io/coded_stream.h:113,
    from /home/liupeng/ncnn/tools/caffe/caffe2ncnn.cpp:24:
    /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
    #error This file requires compiler and library support
    ^
    In file included from /usr/local/include/google/protobuf/stubs/common.h:52:0,
    from /usr/local/include/google/protobuf/io/coded_stream.h:135,
    from /home/liupeng/ncnn/tools/caffe/caffe2ncnn.cpp:24:
    /usr/local/include/google/protobuf/stubs/mutex.h:58:8: error: ‘mutex’ in namespace ‘std’ does not name a type
    std::mutex mu_;
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Lock()’:
    /usr/local/include/google/protobuf/stubs/mutex.h:51:17: error: ‘mu_’ was not declared in this scope
    void Lock() { mu_.lock(); }
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h: In member function ‘void google::protobuf::internal::WrappedMutex::Unlock()’:
    /usr/local/include/google/protobuf/stubs/mutex.h:52:19: error: ‘mu_’ was not declared in this scope
    void Unlock() { mu_.unlock(); }
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
    /usr/local/include/google/protobuf/stubs/mutex.h:61:7: error: expected nested-name-specifier before ‘Mutex’
    using Mutex = WrappedMutex;
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h:66:28: error: expected ‘)’ before ‘*’ token
    explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); }
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h:69:3: error: ‘Mutex’ does not name a type
    Mutex const mu_;
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h: In destructor ‘google::protobuf::internal::MutexLock::~MutexLock()’:
    /usr/local/include/google/protobuf/stubs/mutex.h:67:24: error: ‘class google::protobuf::internal::MutexLock’ has no member named ‘mu_’
    ~MutexLock() { this->mu_->Unlock(); }
    ^
    /usr/local/include/google/protobuf/stubs/mutex.h: At global scope:
    /usr/local/include/google/protobuf/stubs/mutex.h:80:33: error: expected ‘)’ before ‘
    ’ token
    explicit MutexLockMaybe(Mutex *mu) :
    ^
    In file included from /usr/local/include/google/protobuf/arena.h:48:0,
    from /usr/local/include/google/protobuf/message.h:118,
    from /usr/local/include/google/protobuf/text_format.h:48,
    from /home/liupeng/ncnn/tools/caffe/caffe2ncnn.cpp:26:
    /usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
    /usr/include/c++/5/typeinfo:39:37: error: expected unqualified-id before end of line
    /usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
    /usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
    /usr/include/c++/5/typeinfo:39:37: error: expected ‘}’ before end of line
    /usr/include/c++/5/typeinfo:39:37: error: expected declaration before end of line
    tools/caffe/CMakeFiles/caffe2ncnn.dir/build.make:70: recipe for target 'tools/caffe/CMakeFiles/caffe2ncnn.dir/caffe2ncnn.cpp.o' failed
    make[2]: *** [tools/caffe/CMakeFiles/caffe2ncnn.dir/caffe2ncnn.cpp.o] Error 1
    CMakeFiles/Makefile2:203: recipe for target 'tools/caffe/CMakeFiles/caffe2ncnn.dir/all' failed
    make[1]: *** [tools/caffe/CMakeFiles/caffe2ncnn.dir/all] Error 2
    Makefile:129: recipe for target 'all' failed
    make: *** [all] Error 2
@liupengkd
Copy link
Author

同时还有一些警告

@nihui
Copy link
Member

nihui commented Apr 8, 2018

顶层 cmakelists.txt 添加 add_definitions(-std=c++11) 试试看...

@double-vane
Copy link

@nihui 你好这个CMakeLists.txt是在ncnn根目录下还是在tools下的?十分感谢

@double-vane
Copy link

@zhixuanli 你好,这个Makefile是指哪个啊?是Makefile2吗?还是在哪里?谢谢

@zhixuanli
Copy link

@double-vane
CMakeList.txt is under the root directory.
After running cmake .. , you will see the Makefile just at the place you will run make command.

@double-vane
Copy link

@zhixuanli 十分感谢收到回复,谢谢

@double-vane
Copy link

@zhixuanli 你好,又麻烦你了,我在CMakeList里加入add_definitions(-std=c++11)是可以编译成功的,但是在使用的时候会报错:
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Abort
我从网上查,说是在编译的时候加入-pthread
类似于 -std=c++11 -pthread 1.cpp
由于我不熟悉c++,所以我不清楚在哪里加。
然后试了试你说的方法,编译不成功,所以能帮帮我在哪里加-pthread

@zhixuanli
Copy link

zhixuanli commented Jun 22, 2018

@double-vane Actually I was searching for another problem when I saw this issue. I have no experience about ncnn, but I know a little about cmake and make.
May be you can try to add add_definitions(-std=c++11 -pthread) to the CMakeList file.

Good Luck!

@double-vane
Copy link

@zhixuanli 感谢收到你的回复,我也是这样加的,但是还是出这个错:
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Abort
请问你那里可以用tensorflow2ncnn吗?

@zhixuanli
Copy link

zhixuanli commented Jun 22, 2018

@double-vane Sorry, I don't know how to solve this problem😂
Waiting for others' help~

@double-vane
Copy link

@zhixuanli 还是特别感谢你,我再找找解决方法,如果能解决,再告你一声

@zhixuanli
Copy link

@double-vane 😉😉

@nihui nihui closed this as completed Dec 18, 2018
@double-vane
Copy link

double-vane commented Jun 11, 2021 via email

@zhixuanli
Copy link

您好,特别感谢收到您的解决方案,十分感谢

不客气:)

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

4 participants