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

cmake link error in stringpiece #2439

Closed
dzhwinter opened this issue Jun 12, 2017 · 2 comments · Fixed by #2446
Closed

cmake link error in stringpiece #2439

dzhwinter opened this issue Jun 12, 2017 · 2 comments · Fixed by #2446
Assignees

Comments

@dzhwinter
Copy link
Contributor

when it compile the stringpiece, compiler goes in wrong way of using the gcc instead of g++.

Undefined symbols for architecture x86_64:
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced
 from:
      paddle::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, paddle::StringPiece) in libstringpiece.a(stringpiece.cc.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[2]: *** [paddle/strings/stringpiece_test] Error 1
make[1]: *** [paddle/strings/CMakeFiles/stringpiece_test.dir/all] Error 2
make: *** [all] Error 2
@dzhwinter dzhwinter assigned dzhwinter and gangliao and unassigned dzhwinter Jun 12, 2017
@gangliao
Copy link
Contributor

I did not get this error on my computer.

@gangliao gangliao assigned ghost Jun 12, 2017
@gangliao
Copy link
Contributor

[ 85%] Linking CXX executable stringpiece_test
cd /Users/liaogang/baidu/Paddle/build/paddle/strings && /usr/local/Cellar/cmake/3.7.1/
bin/cmake -E cmake_link_script CMakeFiles/stringpiece_test.dir/link.txt --verbose=1
/usr/local/bin/ccache /Library/Developer/CommandLineTools/usr/bin/c++    -std=c++11 -f
PIC -fno-omit-frame-pointer -Wall -Wextra -Werror -Wnon-virtual-dtor -Wdelete-non-virt
ual-dtor -Wno-unused-parameter -Wno-unused-function -Wno-error=sign-compare -Wno-error
=unused-local-typedefs -mavx -O2 -g -DNDEBUG -arch x86_64 -Wl,-search_paths_first -Wl,
-headerpad_max_install_names  CMakeFiles/stringpiece_test.dir/stringpiece_test.cc.o  -
o stringpiece_test  libstringpiece.a ../../../third_party/install/glog/lib/libglog.a .
./../../third_party/install/gflags/lib/libgflags.a ../../../third_party/install/gtest/
lib/libgtest.a ../../../third_party/install/gtest/lib/libgtest_main.a
Undefined symbols for architecture x86_64:
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<c
har, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<
char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_trai
ts<char>, std::__1::allocator<char> > const&)", referenced from:
      paddle::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&,
 paddle::StringPiece) in libstringpiece.a(stringpiece.cc.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[3]: *** [paddle/strings/stringpiece_test] Error 1
make[2]: *** [paddle/strings/CMakeFiles/stringpiece_test.dir/all] Error 2
make[1]: *** [paddle/strings/CMakeFiles/stringpiece_test.dir/rule] Error 2
make: *** [stringpiece_test] Error 2

Same problem on my machine. I think it only happens on Mac OS X. @cxwangyi @wangkuiyi

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

Successfully merging a pull request may close this issue.

2 participants