Closed cnlangzi closed 1 year ago
Could you use g++-10 instead of g++-11? https://www.google.com/search?client=firefox-b-d&q=std%3A%3A__throw_bad_array_new_length%28%29+
Could you use g++-10 instead of g++-11? https://www.google.com/search?client=firefox-b-d&q=std%3A%3A__throw_bad_array_new_length%28%29+
it worked in previous release. let me try g++-10 as you suggested.
refs
I don't remember seeing this issue on Fedora, sorry. And there is no problem with libstdc++, the problem described on the gcc mailing list was user error, or tool error ... Oleg's libtool was adding -L arguments for gcc-9 libs when compiling with gcc-11. That caused an old libstdc++.so to be found by the linker, which did not provide the necessary symbols that the objects needed (because they'd just been compiled with gcc-11).
The Ubuntu problem is probably the same. Something is being compiled with a new gcc that causes the code to refer to the std::__throw_bad_array_new_length() but then the linker is being told to use libs from an old gcc that missing that symbol.
The commands I gave in https://gcc.gnu.org/pipermail/gcc-help/2021-June/140496.html should help to diagnose if that's the case (or just careful inspection of the -L options passed to the linker).
@jwakely That was very useful! Adding -Wl,--trace-symbol=_ZSt28__throw_bad_array_new_lengthv to the libvotca_xtp.so link lines shows:
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libecpint.a(ecp.cpp.o): reference to _ZSt28__throw_bad_array_new_lengthv
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libecpint.a(ecpint.cpp.o): reference to _ZSt28__throw_bad_array_new_lengthv
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libecpint.a(gaussquad.cpp.o): reference to _ZSt28__throw_bad_array_new_lengthv
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libecpint.a(angular.cpp.o): reference to _ZSt28__throw_bad_array_new_lengthv
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libecpint.a(bessel.cpp.o): reference to _ZSt28__throw_bad_array_new_lengthv
So the problem is actually in the libecpint package, we get from Debian.
try to build it with gcc-10 and clang++-15 on ubuntu. but it doesn't work
lz@lz-Ubuntu:~/code/github.com/cnlangzi/bls-go-binary$ clang -v
Ubuntu clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
lz@lz-Ubuntu:~/code/github.com/cnlangzi/bls-go-binary$ make CXX=clang
make -f src//bls/Makefile.onelib BLS_DIR=src//bls MCL_DIR=src//bls/mcl OUT_DIR=/home/lz/code/github.com/cnlangzi/bls-go-binary ETH_CFLAGS= all
make[1]: Entering directory '/home/lz/code/github.com/cnlangzi/bls-go-binary'
clang -c src//bls/src/bls_c384_256.cpp -o obj/bls_c384_256.o -O3 -fno-exceptions -fno-threadsafe-statics -fno-rtti -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_SIZEOF_UNIT=8 -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc//bls/include -Isrc//bls/mcl/include -std=c++03 -fpic -DMCL_USE_LLVM=1
clang -c src//bls/mcl/src/fp.cpp -o obj/fp.o -O3 -fno-exceptions -fno-threadsafe-statics -fno-rtti -fno-stack-protector -DNDEBUG -DMCL_DONT_USE_OPENSSL -DMCL_SIZEOF_UNIT=8 -DMCL_MAX_BIT_SIZE=384 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -D_FORTIFY_SOURCE=0 -Isrc//bls/include -Isrc//bls/mcl/include -std=c++03 -fpic -DMCL_USE_LLVM=1
In file included from src//bls/mcl/src/fp.cpp:4:
In file included from src//bls/mcl/include/mcl/op.hpp:9:
In file included from src//bls/mcl/include/mcl/gmp_util.hpp:17:
In file included from src//bls/mcl/include/mcl/randgen.hpp:33:
src//bls/mcl/include/cybozu/random_generator.hpp:133:19: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
^
In file included from src//bls/mcl/src/fp.cpp:19:
In file included from src//bls/mcl/src/xbyak/xbyak_util.h:20:
src//bls/mcl/src/xbyak/xbyak.h:18:10: fatal error: 'list' file not found
#include <list>
^~~~~~
1 warning and 1 error generated.
make[1]: *** [src//bls/Makefile.onelib:77: obj/fp.o] Error 1
make[1]: Leaving directory '/home/lz/code/github.com/cnlangzi/bls-go-binary'
make: *** [Makefile:6: all] Error 2
lz@lz-Ubuntu:~/code/github.com/cnlangzi/bls-go-binary$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 10.3.0-1ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-S4I5Pr/gcc-10-10.3.0/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04)
g++ --version
g++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```
@herumi tried build it with gcc 9, it still throws __throw_bad_array_new_length
.
It's due to old Ubuntu not having __throw_bad_array_new_length. It occurs when running a library built with the new gcc on an old Ubuntu. Would you be able to build with gcc-8?
fixed it by upgrading ubuntu.
it happens everywhere now. alpine, debain, windows ... . @herumi do you think it is possible to downgrade it? it worked everything as default installation in previous release.
re windows, which dll should be installed for latest release on user's computer, not developer's?
we have got 3 dlls installed on user's computer
they are enough for previous bls-go-binary, but doesn't work on latest release.
is it an option to compile it with -static-libstdc++
?
https://stackoverflow.com/a/73970018
Thank you for the information. I'll check it later.
throw error on alpine
40.31 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libOpenEXR-3_1.so.30: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)'
#0 40.31 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libOpenEXR-3_1.so.30: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
#0 40.31 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libIlmThread-3_1.so.30: undefined reference to `std::thread::_State::~_State()'
#0 40.31 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libOpenEXR-3_1.so.30: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)'
#0 40.31 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libOpenEXR-3_1.so.30: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()'
#0 40.31 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/libOpenEXR-3_1.so.30: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const'
#0 40.31 collect2: error: ld returned 1 exit status
------
@herumi it has to install packages from edge instead of stable on alpine.
RUN apk upgrade
RUN apk del libstdc++ gmp-dev openssl-dev vips-dev
RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main libstdc++ gmp-dev openssl-dev vips-dev
bls/Makefile.onelib
MIN_CFLAGS+=-std=c++03
+MIN_CFLAGS+=-static-libstdc++ -static-libgcc
I've tried the option, but it does not affect libbls384_256.a.
@herumi I tried to install msys2 on windows 10 pro. it shows some errors that I can't find solution in google.
install msys2 : https://github.com/msys2/msys2-installer/releases/download/2023-05-26/msys2-x86_64-20230526.exe
install packages: pacman -S base-devel git gcc make
in MSYS2 MINGW64
shell
# command-line-arguments
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
/usr/lib/gcc/x86_64-pc-msys/11.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lmingwex: No such
file or directory
/usr/lib/gcc/x86_64-pc-msys/11.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lmingw32: No such
file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:32: zbox] Error 2
cnlan@x260 MINGW64 /d/geax/github.com/0chain/zboxcli
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-msys/11.3.0/lto-wrapper.exe
Target: x86_64-pc-msys
Configured with: /c/S/gcc/src/gcc-11.3.0/configure --build=x86_64-pc-msys --prefix=/usr --libexecdir=/usr/lib --enable-bootstrap --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --with-arch=x86-64 --with-tune=generic --disable-multilib --enable-__cxa_atexit --with-dwarf2 --enable-languages=c,c++,fortran,lto --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-check --enable-checking=release --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.3.0 (GCC)
cnlan@x260 MINGW64 /d/geax/github.com/0chain/zboxcli
$ clang++ -v
-bash: clang++: command not found
cnlan@x260 MINGW64 /d/geax/github.com/0chain/zboxcli
$ cat /proc/version
MINGW64_NT-10.0-19045 version 3.4.6.x86_64 (runneradmin@fv-az411-253) (gcc version 11.3.0 (GCC) ) 2023-04-01 11:43 UTC
nvm, fixed it by pacman -S mingw-w64-x86_64-clang
@herumi got both of them fixed. thanks.
command-line-arguments
/root/docker-build-actions-runner/_work/_tool/go/1.20.0/x64/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /usr/bin/ld: /root/go/pkg/mod/github.com/cnlangzi/bls-go-binary@v1.29.0/bls/lib/linux/amd64/libbls384_256.a(fp.o): in function, std::tr1::hash, std::tr1:: detail::_Mod_range_hashing, std::tr1::detail::_Default_ranged_hash, std::tr1::detail::_Prime_rehash_policy, false, false, true>::_M_insert_bucket(std::pair<unsigned long const, Xbyak::MmapAllocator::Allocation> const&, unsigned long, unsigned long)':
fp.cpp:(.text._ZNSt3tr110_HashtableImSt4pairIKmN5Xbyak13MmapAllocator10AllocationEESaIS6_ESt10_Select1stIS6_ESt8equal_toImENS_4hashImEENS_8detail18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyELb0ELb0ELb1EE16_M_insert_bucketERKS6_mm[_ZNSt3tr110_HashtableImSt4pairIKmN5Xbyak13MmapAllocator10AllocationEESaIS6_ESt10_Select1stIS6_ESt8equal_toImENS_4hashImEENS_8detail18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyELb0ELb0ELb1EE16_M_insert_bucketERKS6_mm]+0x3d1): undefined reference to , std::tr1::hash, std::tr1::__detail::_Mod_range_hashing, std::tr1:: detail::_Default_ranged_hash, std::tr1::detail::_Prime_rehash_policy, false, false, true>::_M_insert_bucket(std::pair<int const, Xbyak::LabelManager::ClabelVal> const&, unsigned long, unsigned long)':
fp.cpp:(.text._ZNSt3tr110_HashtableIiSt4pairIKiN5Xbyak12LabelManager9ClabelValEESaIS6_ESt10_Select1stIS6_ESt8equal_toIiENS_4hashIiEENS_8detail18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyELb0ELb0ELb1EE16_M_insert_bucketERKS6_mm[_ZNSt3tr110_HashtableIiSt4pairIKiN5Xbyak12LabelManager9ClabelValEESaIS6_ESt10_Select1stIS6_ESt8equal_toIiENS_4hashIiEENS_8detail18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyELb0ELb0ELb1EE16_M_insert_bucketERKS6_mm]+0x3f1): undefined reference to
std::tr1::_Hashtable<int, std::pair<int const, Xbyak::JmpLabel const>, std::allocator<std::pair<int const, Xbyak::JmpLabel const> >, std::_Select1st<std::pair<int const, Xbyak::JmpLabel const> >, std::equal_to<int>, std::tr1::hash<int>, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, false>::_M_insert(std::pair<int const, Xbyak::JmpLabel const> const&, std::tr1::integral_constant<bool, false>) [clone .isra.0]': fp.cpp:(.text+0x217b): undefined reference to
std::throw_bad_array_new_length()' /usr/bin/ld: /root/go/pkg/mod/github.com/cnlangzi/bls-go-binary@v1.29.0/bls/lib/linux/amd64/libbls384_256.a(fp.o): in functionmcl::fp::Op::createFpGenerator()': fp.cpp:(.text+0xd7fb): undefined reference to
std::throw_bad_array_new_length()' /usr/bin/ld: /root/go/pkg/mod/github.com/cnlangzi/bls-go-binary@v1.29.0/bls/lib/linux/amd64/libbls384_256.a(fp.o): in function `std::tr1::_Hashtable<unsigned long, std::pair<unsigned long const, Xbyak::MmapAllocator::Allocation>, std::allocator<std::pair<unsigned long const, Xbyak::MmapAllocator::Allocation> >, std::_Select1st<std::pair<unsigned long const, Xbyak::MmapAllocator::Allocation> >, std::equal_tostd::__throw_bad_array_new_length()' /usr/bin/ld: /root/go/pkg/mod/github.com/cnlangzi/bls-go-binary@v1.29.0/bls/lib/linux/amd64/libbls384_256.a(fp.o): in function
std::tr1::_Hashtable<int, std::pair<int const, Xbyak::LabelManager::ClabelVal>, std::allocator<std::pair<int const, Xbyak::LabelManager::ClabelVal> >, std::_Select1st<std::pair<int const, Xbyak::LabelManager::ClabelVal> >, std::equal_tostd::__throw_bad_array_new_length()' /usr/bin/ld: /root/go/pkg/mod/github.com/cnlangzi/bls-go-binary@v1.29.0/bls/lib/linux/amd64/libbls384_256.a(fp.o): in function
Xbyak::LabelManager::defineClabel(Xbyak::Label&)': fp.cpp:(.text._ZN5Xbyak12LabelManager12defineClabelERNS_5LabelE[_ZN5Xbyak12LabelManager12defineClabelERNS_5LabelE]+0x4f8): undefined reference to `std::throw_bad_array_new_length()' /usr/bin/ld: /root/go/pkg/mod/github.com/cnlangzi/bls-go-binary@v1.29.0/bls/lib/linux/amd64/libbls384_256.a(fp.o):fp.cpp:(.text._ZN5Xbyak12LabelManager5resetEv[_ZN5Xbyak12LabelManager5resetEv]+0xe1f): more undefined references to `std::__throw_bad_array_new_length()' follow collect2: error: ld returned 1 exit status