Warning: Declaration of mosaic_walker_nav_menu_dropdown::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Declaration of mosaic_walker_nav_menu_dropdown::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = Array) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Declaration of mosaic_walker_nav_menu_dropdown::end_el(&$output, $item, $depth) should be compatible with Walker_Nav_Menu::end_el(&$output, $item, $depth = 0, $args = Array) in /home/linkevin/public_html/wp-content/themes/mosaic/functions.php on line 537

Warning: Parameter 2 to wp_hide_post_Public::query_posts_join() expected to be a reference, value given in /home/linkevin/public_html/wp-includes/class-wp-hook.php on line 286How To Install the GMP Library on Ubuntu - The Notepad Blog

How To Install the GMP Library on Ubuntu

In my Data Structures and Algorithms II class (more like Algorithms and Algorithms class), our professor assigned us to write a RSA encryption program to complement our coursework on modular arithmetic and primality testing. Because we needed large numbers (1024 bits) which would absolutely not fit inside normal primitive data types, we were suggested to use the GMP library for C++, or BigInteger for Java. Being a C++ guy, I choose GMP.

Now, what I found out while writing this lab was that installing GMP was actually harder than writing the program! To cut to the chase, here is how to download and install GMP onto your Ubuntu system. This approach uses the source file downloaded from GMP’s official page and the Ubuntu terminal.

Installing the GMP Library

No pictures today because the instructions are quite simple and straightforward.

When you have downloaded the file, extract the contents from the tar.lz file to a temporary folder. I created my temporary folder on my desktop for simplicity’s sake.

Once extracted, open your terminal and wiggle your way to the temporary folder’s directory. For example, mine would be at

~/Desktop/GMP

If you forgot, the “ls” command displays the list of items in your current directory, and the “cd” command can be used to go to specific locations. “cd ..” can be used to go back to the previous directory.

cd Desktop/GMP

Once at the directory, type in the command:

./configure

To what I understand, “./configure” will check your system to see if all the dependencies are met, and then create the makefile.

(Optional) If you are met with the error: No usable M4 in $PATH or /usr5bin, then you need to install the M4 macro processor onto your Ubuntu system. Luckily, doing so is quite easy if you have Internet access. You must have root access as we will be using sudo apt-get:

sudo apt-get install m4

Don’t forget to run “./configure” again once you are done!

Now you are ready to build the GMP library’s files, awesome! Proceed with the command:

make

Do note that this process may take a few minutes for some computers. For mine (Ubuntu virtualized within Windows), it took me around 3 minutes. The terminal window will start printing out words in supersonic speed. If you have a friend nearby, grab him over so you can tell him you’re hacking GMail’s servers.

When you are ready to install the library, type in this command:

sudo make install

GMP’s documentation prompts us to check to see if our installing was correct. To do so:

I am a senior at Wake Forest University currently pursuing my BS in Computer Science, and I love technology! To learn a little more about me, please visit the "Meet Kevin" widget on the top right on the screen!

Wonderful. It works. I use R programming. The GMP library installation showing error there. But after installing the GMP library as per your instruction, I’ve installed gmp in R successfully.
Thanks for your deep and system-level suggestions.

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Search for:

Meet Kevin

I work as a software engineer for Qualtrics in Seattle. I love technology, and that's why I decided to start this blog during college to share my troubles and successes with the folks of the Internet. Outside of work, I love to play and watch soccer. Occasionally, I also enjoy playing DotA 2 and FIFA online with my friends.