Stress-Testing-bash-script icon indicating copy to clipboard operation
Stress-Testing-bash-script copied to clipboard

get error while ./stress_test -b brute.cpp -m main.cpp

Open AbdelrahmanFawzyMesbah opened this issue 2 years ago • 8 comments

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

AbdelrahmanFawzyMesbah avatar Sep 09 '22 16:09 AbdelrahmanFawzyMesbah

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.

bhupixb avatar Sep 10 '22 07:09 bhupixb

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

AbdelrahmanFawzyMesbah avatar Sep 10 '22 08:09 AbdelrahmanFawzyMesbah

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

bhupixb avatar Sep 10 '22 08:09 bhupixb

$ 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 

AbdelrahmanFawzyMesbah avatar Sep 10 '22 09:09 AbdelrahmanFawzyMesbah

This seems something specific to your env. Is it fixed?

bhupixb avatar Oct 28 '22 16:10 bhupixb

Iam Getting same error Mine is Linux

MdNihal05 avatar Nov 28 '23 16:11 MdNihal05

Can u try to compile tc_generator.cpp independently once if it's working? e.g.

g++ -std=c++17 tc_generator.cpp

bhupixb avatar Nov 28 '23 17:11 bhupixb

Generating inputs perfectly But issue with compilation

IMG_20231129_002718

MdNihal05 avatar Nov 28 '23 18:11 MdNihal05