Lab 3 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

45crtbe gino no such file no such file or dire ctory

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: nx445ctn. /s/i6/rno iu/../redo urlb4ct. If you e ncounte r e rror w ith "ld: /usr/lib/gcc/x 86_64-re dha t-linux /4.4.5/crtbe gin.o: No such file : No such file or dire ctory" Change 4.4.5 in above ins truc tion into 4.4.7. Unfortunately , y ou need a lot of ex tra arguments to get "ld" to work on the EW S mac hines . You c an als o jus t invok e "gc c " and have it do the above c all to "ld" for y ou: gc- hlowrd- chlowrdo c o el-ol l el-ol. The important part of this is "-l c " whic h means "link with the s tandard C library ". This library provides the implementation for the "puts " func tion, s o we link with it to pac k age every thing we need in our ex ec utable. Step 5: Load ldhlowrd d el-ol The "ldd" utility tells y ou what libraries an ex ec utable will load into memory when it's run. Run the above c ommand. Do y ou rec ogniz e one of the libraries ? Step 6: Execute Ok ay s o after all that, go ahead and run the program y ou produc ed: .hlowrd /el-ol This will load the program into memory and run it. You now have c reated a program that y ou c an run jus t lik e any other Unix program, c ongratulations ! W hy the ./ ? Rec all that the Unix c ommand c onventions is : program [arg1] ... W hile the program c an be a path (c ontaining s las hes ), it c an als o jus t be the name of a program (no s las hes ) to mak e a c ommand line us er's life eas ier. W hen y ou jus t s pec ify a name, the operating s y s tem s earc hes through s tandard loc ations for binaries (s uc h as /us r/bin ) to find the program with that name. By default, mos t Unix s y s tems will not s earc h the c urrent work ing direc tory (whic h is generally a good thing, bec aus e y ou don't want to be ac c identally ex ec uting s omething y ou happen to be in the direc tory of). So y ou need to provide a path (s omething with s las hes ) to ex ec ute a program not in the s tandard loc ations . Adding ./ is us ually the eas ies t way to do this . If y ou move to the parent direc tory , this would als o work : hw3/hello-world T he r ecommended way to do it Now that y ou k now the bas ic s teps of the building proc es s , we c an...
View Full Document

This document was uploaded on 03/22/2014.

Ask a homework question - tutors are online