21576, "kwaters4", "writef leading to linking error when making binary (some platforms)", "2023-02-11T20:15:04Z"
Summary of Problem
I was working on one of my machines (RockyLinux) and using a writef statement and generates a linker error making the binary. I was unable to reproduce this on my MacOS (BigSur) machine.
I have been building Chapel following the quick start instructions. In terms of Chapel itself the MacOS and RockyLinux builds are identical outside of the tools used to build it. I have provided the configurations of the install with the problem below.
Please let me know what additional information is needed.
Steps to Reproduce
Source Code:
writef("My favorite %s is %i\n", "number", 7);
ATO Link:
I think I was able to reproduce the error using ATO. I am not 100%, the output is as follows:
/ATO/runner: line 6: 3 Killed /ATO/yargs % /ATO/options chpl % /ATO/code.chpl -o /ATO/exe
yargs: execvp: No such file or directory
I am not sure if ATO would print out linker errors.
Compile command:
chpl foo.chpl
Error
(Some sanitation occured to clean up the path and spacing)
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(re2.o): In function `re2::Fanout(re2::Prog*, std::vector<int, std::allocator<int> >*)':
re2.cc:(.text+0x13fa): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(re2.o): In function `LogMessage::LogMessage(char const*, int)':
re2.cc:(.text._ZN10LogMessageC2EPKci[_ZN10LogMessageC2EPKci]+0x18): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(regexp.o): In function `re2::Regexp::ConcatOrAlternate(re2::RegexpOp, re2::Regexp**, int, re2::Regexp::ParseFlags, bool)':
regexp.cc:(.text+0xe51): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(regexp.o): In function `re2::ConvertRunesToBytes(bool, int*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
regexp.cc:(.text+0x2057): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(regexp.o): In function `std::deque<re2::WalkState<int>, std::allocator<re2::WalkState<int> > >::_M_reallocate_map(unsigned long, bool)':
regexp.cc:(.text._ZNSt5dequeIN3re29WalkStateIiEESaIS2_EE17_M_reallocate_mapEmb[_ZNSt5dequeIN3re29WalkStateIiEESaIS2_EE17_M_reallocate_mapEmb]+0x14d): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(regexp.o): In function `std::deque<re2::WalkState<re2::Range>, std::allocator<re2::WalkState<re2::Range> > >::_M_reallocate_map(unsigned long, bool)':
regexp.cc:
(.text._ZNSt5dequeIN3re29WalkStateINS0_5RangeEEESaIS3_EE17_M_reallocate_mapEmb[_ZNSt5dequeIN3re29WalkStateINS0_5RangeEEESaIS3_EE17_M_reallocate_mapEmb]+0x14d): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(bitstate.o): In function `re2::BitState::GrowStack()':
bitstate.cc:(.text+0x98): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(bitstate.o): In function `re2::BitState::Push(int, char const*)':
bitstate.cc:(.text+0x29b): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(bitstate.o): In function
`re2::BitState::Search(re2::StringPiece const&, re2::StringPiece const&, bool, bool, re2::StringPiece*, int)':
bitstate.cc:(.text+0xa1c): undefined reference to `std::__throw_bad_array_new_length()'
/Chapel/source/chapel-1.29.0/third-party/re2/install/linux64-x86_64-native-llvm-none/lib/libre2.a(compile.o):compile.cc:(.text+0x25d):
more undefined references to `std::__throw_bad_array_new_length()' follow
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
error: Make Binary - Linking
Configuration Information
Output of chpl --version:
chpl version 1.29.0
built with LLVM version 14.0.0
Copyright 2020-2022 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
Output of $CHPL_HOME/util/printchplenv --anonymize: