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

程序编译错误 #2

Open
ningyuwhut opened this issue Aug 6, 2017 · 7 comments
Open

程序编译错误 #2

ningyuwhut opened this issue Aug 6, 2017 · 7 comments

Comments

@ningyuwhut
Copy link

hi,我这两天在看这份代码,今天打算运行一下,发现有编译错误,我运行的是example/wordseg里面的例子,刚开始make的时候提示wordseg.cpp中的SeqLossLayer找不到,我看了下源码,好像layers目录下面没有定义这个类,不知道是不是这个类废弃了但是代码没更新?
我把SeqLossLayer换成CrossEntropyLossLayer后继续make,遇到如下错误:
g++ -pg -w -DDEBUGALL -I. -I../../matrix -I../../layers -I../../utils -I../../net -o test_mnist ./wordseg.o
Undefined symbols for architecture x86_64:
"sub_dl::GruCell::GruCell(int, int)", referenced from:
sub_dl::BiCellWrapper<sub_dl::GruCell>::BiCellWrapper(int, int, int) in wordseg.o
"sub_dl::RnnCell::RnnCell(int, int)", referenced from:
sub_dl::BiCellWrapper<sub_dl::RnnCell>::BiCellWrapper(int, int, int) in wordseg.o
"sub_dl::LstmCell::LstmCell(int, int, bool)", referenced from:
sub_dl::BiCellWrapper<sub_dl::LstmCell>::BiCellWrapper(int, int, bool, bool, int) in wordseg.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build] Error 1

完整的日志如下:
g++ -c -v -pg -w -DDEBUGALL -I. -I../../matrix -I../../layers -I../../utils -I../../net ./wordseg.cpp
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name wordseg.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -coverage-file /Users/songwei/machineLearning/SUDL/example/wordseg/wordseg.cpp -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -D DEBUGALL -I . -I ../../matrix -I ../../layers -I ../../utils -I ../../net -stdlib=libc++ -w -fdeprecated-macro -fdebug-compilation-dir /Users/songwei/machineLearning/SUDL/example/wordseg -ferror-limit 19 -fmessage-length 203 -pg -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o wordseg.o -x c++ ./wordseg.cpp
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.5.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
.
../../matrix
../../layers
../../utils
../../net
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks (framework directory)
End of search list.
g++ -pg -w -DDEBUGALL -I. -I../../matrix -I../../layers -I../../utils -I../../net -o test_mnist ./wordseg.o
Undefined symbols for architecture x86_64:
"sub_dl::GruCell::GruCell(int, int)", referenced from:
sub_dl::BiCellWrapper<sub_dl::GruCell>::BiCellWrapper(int, int, int) in wordseg.o
"sub_dl::RnnCell::RnnCell(int, int)", referenced from:
sub_dl::BiCellWrapper<sub_dl::RnnCell>::BiCellWrapper(int, int, int) in wordseg.o
"sub_dl::LstmCell::LstmCell(int, int, bool)", referenced from:
sub_dl::BiCellWrapper<sub_dl::LstmCell>::BiCellWrapper(int, int, bool, bool, int) in wordseg.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build] Error 1

对c++不太熟,在网上找到的方法都没解决。
还请帮忙看下是哪里的问题。
多谢!

@kymo
Copy link
Owner

kymo commented Aug 6, 2017

你好,wordseg依赖了layers里的.o,需要在layers里先make哈~ 另外CrossEntropyLoss是针对非序列样本的,RNN的话需要用SeqCrossEntropyLossLayer哈~ 样例数据在example下的readme.md里给出了,可以下载试试~

@ningyuwhut
Copy link
Author

多谢,按照你的提示make成功了,test_mnist也运行起来了,不过有个建议哈,因为这个是word_seg,所以生成的可执行文件是不是应该改个名?另外,有数据集相关的网页介绍吗,我看了下数据文件,不太明白样本的含义,多谢了啊

@kymo
Copy link
Owner

kymo commented Aug 6, 2017

382 7 84 385 625 915 191 108;2 3 0 2 0 2 0 2
;前面的是word_id,后面的 是标注id(分词用的是bems形式). 我这个语料是处理成了每8个为一个序列~
生成的文件名可以改makefile哈. 目前运行速度略慢,但是效果还可以,你可以看下收敛情况哈~

@ningyuwhut
Copy link
Author

是说这个数据集并不是一个公开的数据集是吗,查了一下bems,样本含义还是可以理解的。晚上运行了一下,早上起来发现还没有跑完,大概跑了九个小时吧,这个时间正常吗

@kymo
Copy link
Owner

kymo commented Aug 7, 2017 via email

@ningyuwhut
Copy link
Author

恩,我在mac上跑的,双向rnn还没看,不太懂,我再跑一遍看看。 有一个问题哈,数据集的文件名是train_text.seg.10w,但是好像才有一万条数据,是不是命名有问题哈。还有就是每个epoch样本的顺序都是确定的,我记得打乱顺序最好,请问这个有计划吗

@kymo
Copy link
Owner

kymo commented Aug 7, 2017 via email

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

2 participants