{"id":525,"date":"2011-12-07T21:59:06","date_gmt":"2011-12-08T05:59:06","guid":{"rendered":"http:\/\/www.partofthething.com\/thoughts\/?p=525"},"modified":"2011-12-07T21:59:06","modified_gmt":"2011-12-08T05:59:06","slug":"my-experience-compiling-against-trilinos-on-ubuntu","status":"publish","type":"post","link":"https:\/\/partofthething.com\/thoughts\/my-experience-compiling-against-trilinos-on-ubuntu\/","title":{"rendered":"my experience compiling against Trilinos on Ubuntu"},"content":{"rendered":"<p>I&#8217;m just embarking on a historic journey to learn a bit about the <a href=\"http:\/\/trilinos.sandia.gov\/index.html\" target=\"_blank\">Trilinos math library.<\/a>\u00a0 To get started, I&#8217;ve gone through the <a href=\"http:\/\/code.google.com\/p\/trilinos\/wiki\/TrilinosHandsOnTutorial\" target=\"_blank\">hands-on tutorial<\/a> a bit and after a few tries, I&#8217;ve gotten something compiled.<\/p>\n<p>Trilinos 10.4 is available in the repositories for Ubuntu (11.10 confirmed). But Trilinos 10.8 is out now, so I had to build my own. Their instructions with CMAKE were quite good and the build process didn&#8217;t have too many hiccups. I found that the cmake gui is the way to go. Make sure you enable Didasko (the tutorial) in the cmake gui. When you do this, a few more Didasko options show up so you have to go enable those too.<br \/>\n<!--more--><br \/>\nWhat, in retrospect, should have been obvious from the documentation, the way to build your own programs against Trilinos is to use the<a href=\"http:\/\/trilinos.sandia.gov\/Export_Makefile.txt\" target=\"_blank\"> Makefile.export files<\/a>. Once built, there will be a Makefile.export.[PackageName] for each packages in the \/build\/packages directories. That file has all the variables needed to tell your custom Makefile how to include Trilinos. So, you take your makefile and just say &#8220;include Makefile.export.Epetra&#8221; for example. I used the makefile at the bottom of the previous link as a skeleton for my first sample program. One problem I ran into with the skeleton is that it includes the Makefile.export.Trilinos and my build of Trilinos was in a long-named folder and has all the packages enabled, so I kept getting<\/p>\n<p><code>c++: error trying to exec '\/usr\/lib\/gcc\/x86_64-linux-gnu\/4.6.1\/collect2': execv: Argument list too long<\/code><\/p>\n<p>This is because the argument list generated in my Trilinos makefile was literally 133469 characters long, and according to<\/p>\n<p><code>xargs --show-limits<\/code><\/p>\n<p>my limit is 131072. Too bad. I haven&#8217;t found out how to increase this limit other than <a href=\"http:\/\/www.linuxjournal.com\/article\/6060?page=0,0\" target=\"_blank\">recompiling the kernel,<\/a> which I&#8217;m not about to do. Solution? Forget about the full Makefile and just add the packages I&#8217;m using. In this sample case, I&#8217;m compiling the first example from Didasko, ex1.cpp.<\/p>\n<p>Another error I had was<\/p>\n<p><code>ex1.cpp:35:32: fatal error: Didasko_ConfigDefs.h: No such file or directory<\/code><\/p>\n<p>To get around that, I edited ex1.cpp and removed the outer #ifdef loop that provided the error message. This included removing calls to Didasko_ConfigDefs.h.<\/p>\n<p>Final trick: In the skeletal Makefile, all the variables are defined as Trilinos_CXX, etc. When you include a specific package&#8217;s makefile, you have to change them to Epetra_CXX, etc. So I did a find\/replace Trilinos-&gt;Epetra and hit make. Check it out:<\/p>\n<pre>user@computer:~\/Desktop\/trilinos-10.8.3\/build\/Testing\/Temporary$ make\nFound Epetra!\u00a0 Here are the details:\n Epetra_VERSION =\n Epetra_PACKAGE_LIST = Epetra\n Epetra_LIBRARIES = -lepetra\n Epetra_INCLUDE_DIRS = -I~\/Desktop\/trilinos-10.8.3\/build -I~\/Desktop\/trilinos-10.8.3\/build\/packages\/epetra\/src -I~\/Desktop\/trilinos-10.8.3\/packages\/epetra\/src\n Epetra_LIBRARY_DIRS = -L~\/Desktop\/trilinos-10.8.3\/build\/packages\/epetra\/src\n Epetra_TPL_LIST = LAPACK BLAS\n Epetra_TPL_INCLUDE_DIRS =\n Epetra_TPL_LIBRARIES = \/usr\/lib\/liblapack.so \/usr\/lib\/libblas.so\n Epetra_TPL_LIBRARY_DIRS =\n Epetra_BUILD_SHARED_LIBS = OFF\n End of Epetra details\n\/usr\/bin\/c++\u00a0\u00a0 ex1.o\u00a0 -o ex1\u00a0 -I~\/Desktop\/trilinos-10.8.3\/build -I~\/Desktop\/trilinos-10.8.3\/build\/packages\/epetra\/src -I~\/Desktop\/trilinos-10.8.3\/packages\/epetra\/src\u00a0\u00a0 -DMYAPP_EPETRA -L~\/Desktop\/trilinos-10.8.3\/build\/packages\/epetra\/src\u00a0 -lepetra \/usr\/lib\/liblapack.so \/usr\/lib\/libblas.so<\/pre>\n<p>Compiled! Sweet. More on this as it progresses.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m just embarking on a historic journey to learn a bit about the Trilinos math library.\u00a0 To get started, I&#8217;ve gone through the hands-on tutorial a bit and after a few tries, I&#8217;ve gotten something compiled. Trilinos 10.4 is available in the repositories for Ubuntu (11.10 confirmed). But Trilinos 10.8 is out now, so I &hellip; <a href=\"https:\/\/partofthething.com\/thoughts\/my-experience-compiling-against-trilinos-on-ubuntu\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">my experience compiling against Trilinos on Ubuntu<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-525","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/posts\/525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/comments?post=525"}],"version-history":[{"count":0,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/posts\/525\/revisions"}],"wp:attachment":[{"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/media?parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/categories?post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/partofthething.com\/thoughts\/wp-json\/wp\/v2\/tags?post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}