全网首发:Undefined symbols for architecture x86_64: “std::__1::locale::use_facet(std::__1::locale::id&)

简介: 全网首发:Undefined symbols for architecture x86_64: “std::__1::locale::use_facet(std::__1::locale::id&)
  • 吾是在MAC上编译OpenJDK8出的这个错误。而且这个错误是编译openjdk8u242时出现的。u252就没有这个错误。
  • gcc改为g++

试了无效果。

  • 增加-lstdc++

有时是必须的,有时不是。建议加上。

  • 具体错误:
Making adlc
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
Undefined symbols for architecture x86_64:
  "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in filebuff.o
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in filebuff.o
  "std::__1::ctype<char>::id", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in filebuff.o
  "std::__1::locale::~locale()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in filebuff.o
  "std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) in filebuff.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int) in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush() in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() in filebuff.o
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in filebuff.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[6]: *** [../generated/adfiles/adlc] Error 1
make[5]: *** [ad_stuff] Error 2
make[4]: *** [product] Error 2
make[3]: *** [generic_build2] Error 2
make[2]: *** [product] Error 2
make[1]: *** [/Users/taishansoft/Downloads/openjdk8-u242/jdk8u242/build/macosx-x86_64-normal-server-release/hotspot/_hotspot.timestamp] Error 2
make: *** [hotspot-only] Error 2
  • 解决办法

经过一番辛苦搜索学习,连蒙带猜,找到的解决办法竟然是:

# NEW_INCLUDE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
NEW_INCLUDE=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
export   CFLAGS="-I$NEW_INCLUDE"
export CXXFLAGS="-I$NEW_INCLUDE"
目录
相关文章
undefined reference to symbol 'dlsym@@GLIBC_2.17' libdl.so: error adding symbols: DSO missing from c
undefined reference to symbol 'dlsym@@GLIBC_2.17' libdl.so: error adding symbols: DSO missing from c
575 0
|
6月前
|
Swift
use_frameworks引起的Undefined symbols for architecture arm64
use_frameworks引起的Undefined symbols for architecture arm64
53 0
|
6月前
|
iOS开发
部分库不支持32位系统archive报错:Undefined symbols for architecture armv7
部分库不支持32位系统archive报错:Undefined symbols for architecture armv7
46 0
|
6月前
|
Swift
swift相关项目包含私有库引起的Undefined symbols for architecture arm64
swift相关项目包含私有库引起的Undefined symbols for architecture arm64
62 0
|
iOS开发 MacOS
Qt 报错:Undefined symbols for architecture arm64
MacBook Pro Apple M1 使用 Qt 6.4.1 的时候碰到的报错,做了不同的尝试,最后解决了这个报错。
683 0
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_ZMCertification", referenced from:解决方法
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_ZMCertification", referenced from:解决方法
201 0
|
开发工具 iOS开发 Perl
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
179 0
iOS开发 - undefined symbols for architecture x86_64,大多数都是缺少静态库,缺少静态库分下面几种
MAC编译出错:Undefined symbols for architecture x86_64: “_CFRelease“, referenced from:
MAC编译出错:Undefined symbols for architecture x86_64: “_CFRelease“, referenced from:
216 0
|
3月前
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
3月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
71 0

热门文章

最新文章