Skip to main content

Building Open Source Software and the GNU Standard C Library (Lab 4 Part 2)

To download and build the glibc was quite simple thanks to the guide provided by Chris here. The main steps (provided by the article) are:

1) mkdir $HOME/src
2) cd $HOME/src
3) git clone git://sourceware.org/git/glibc.git
4) mkdir -p $HOME/build/glibc
5) cd $HOME/build/glibc
6) $HOME/src/glibc/configure --prefix=/usr
7) make

 This builds a fully functional glibc in the build directory which can be rebuilt anytime using the src directory. The c files present in the src directory must be altered to change the object files in the build directory. I made a small print program here that simply outputs a test message. When compiled with the installed system glibc it prints "hello world!" once. When compiled with my build of glibc it prints it twice due to the changes I made to the print.c file in the src directory. It is important to note that everytime the src directory is altrered in any way the build directory must be remade, and commenting out the proper code to test your code is VERY IMPORTANT. I had to rm -rf my directories a few times because I deleted important code to introduce a bug.

Override mechanisms: judging by the example here it appears to mean overwrtiting the previous application defintions with those that the system supports.

Multiarch mechanisms: "the capability of a system to install and run applications of multiple different binary targets on the same system."(Debian) In other words running a non-native application on a platform. Multiarch refers to the support the application has in this scenario.

Source by Debian here

Comments

Popular posts from this blog

Final Project Part 01 - Final Summary

To end part 1 I will summarize what information I have gathered for part 2: I am optimizing clib, a package manager. After benchmarking, it is clear there is a significant time delay in some advanced calls of the SHA1 function, such as ones that call update many times. To optimize, I am going to add the -O3 flag and remove a loop condition (currently). Some other observations: This project is relatively small with no ./configure for other platforms. The Sha1 code is unique and does not conform to the simple sha1 algorithm such as on    Wikipedia . The documentation (i.e. README) is relatively vague at describing the dependancies. It suggests only syntax that implies installation and isn't clear at documenting development vs. published code.   I have learned alot getting to this point in part 1. Firstly, I learned that library files can only be linked by using sudo ldconfig and the files must be in usr/lib. Secondly, I learned how to alter an advanced Makefile's fla

Final Project Part 02 - Sha1 Function Enhancements

To try to squeeze out a bit more performance I attempted to some compiler optimizations. Unfortunately, due to the sheer complexity of the algorithm, I was unable to find other logic complexities to simplify. I tried some loop unrolling to make the compiler have to work a little less, some examples are here below: I made a graph to demonstrate the minute differences this makes in the test vectors below: At most a few millisecond difference is all that can be acquired, and this is only from the finalcount[] array as the digest array produces errors if not compiled in a loop along with other for loops in the code. To test this I simply altered the sha1.c code and ran the make file to see if the vectors passed or failed. As mentioned this is a compiler optimzation, in other words it is completed already, especially at the -O3 level where the benchmarking was done. I would not  recommend this change to be pushed upstream normally due to the insignificant time change

Final Project Part 02 - Final Summary

In conclusion, the -O3 flag was the most important discovery with trying to optimize clib. It offered a significant speed up with no interference, and provided the chance to uniform a many times used function, strdup. Overall the function is built extremely well with very advanced logic. Attempting to alter said logic sprouted many errors and warnings and left only simple compiler optimizations such as loop unrolling which made small differences in speed up. Clib as a whole is a great idea, offering many compartmentalized features for the C programming language that programmers could definitely find useful when developing. I hope in the future I can get more involved in writing code for open source projects such as clib whether that be doing optimization work or building from the ground up. This project not only gave me an insight on how these open source projects work but also at real world coding and improvement opportunities. I can honestly say now that I have had some experience