Stress-Testing-bash-script
Stress-Testing-bash-script copied to clipboard
get error while ./stress_test -b brute.cpp -m main.cpp
i get this error when doing
./stress_test -b brute.cpp -m main.cpp
/usr/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status
Error when compiling: tc_generator.cpp
Hi, are you running this on windows or linux? Have you modified the script by any chance?
Looking at error, it's not able to find ld
binary on your system, but in original script we haven't used this tool.
Can you try adding set -x
in your bash script at line no.2 https://github.com/bhupixb/Stress-Testing-bash-script/blob/master/stress_test#L2 and re-run. Please share the output of this.
Hi,thank you for reply
I run it on Linux Ubuntu , I haven't modified the script
and this the output after adding set -x
++ tput setaf 71
+ green=''
++ tput setaf 1
+ red=''
++ tput setaf 32
+ blue=''
++ tput setaf 178
+ orange=''
++ tput bold
+ bold=''
++ tput sgr0
+ reset=''
+ CPP_VERSION=c++17
+ COMPILE_FLAGS=
+ TC_GENERATOR_FILE=tc_generator.cpp
+ MAX_TESTS=10
+ BRUTE_FILE=
+ MAIN_FILE=
+ main -b brute.cpp -m main.cpp
+ [[ 4 -gt 0 ]]
+ case $1 in
+ BRUTE_FILE=brute.cpp
+ shift
+ shift
+ [[ 2 -gt 0 ]]
+ case $1 in
+ MAIN_FILE=main.cpp
+ shift
+ shift
+ [[ 0 -gt 0 ]]
+ check_files_exists brute.cpp main.cpp tc_generator.cpp
+ cpp_files=("$1" "$2" "$3")
+ declare -a cpp_files
+ for file in "${cpp_files[@]}"
+ [[ -f brute.cpp ]]
+ for file in "${cpp_files[@]}"
+ [[ -f main.cpp ]]
+ for file in "${cpp_files[@]}"
+ [[ -f tc_generator.cpp ]]
+ compile tc_generator.cpp generator
+ local cpp_file=tc_generator.cpp
+ local executable_fname=generator
++ date +%s
+ local start_time=1662799139
+ g++ -std=c++17 tc_generator.cpp -o generator ''
/usr/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status
+ echo 'Error when compiling: tc_generator.cpp'
Error when compiling: tc_generator.cpp
+ exit 1
Seems like this ld
binary is used by g++ internally.
Could you please try running this directly and share output
g++ -std=c++17 tc_generator.cpp -o generator
Also check if you have c++17 installed on your system
$ g++ -std=c++17 tc_generator.cpp -o generator
$./generator
output :
28
20 16 5 6 15 1 16 7 11 11 3 20 17 18 17 7 7 9 19 17 8 5 8 9 3 4 10 12
This seems something specific to your env. Is it fixed?
Iam Getting same error Mine is Linux
Can u try to compile tc_generator.cpp
independently once if it's working? e.g.
g++ -std=c++17 tc_generator.cpp
Generating inputs perfectly But issue with compilation