Re: Fwd: Linking lapack and C standard library
On Thu, 14 Mar 2013, Francesco Pietra wrote: As to the problem of linking lapack, I wonder whether this is because it deal of a C-language code, requiring a fine-tuned calling. Is any C interface to lapack in Debian? Ciao Francesco. There are several implementation of lapack in debian. You should make sure to link against its dependencies as well. On my wheezy computer, if I do ls -l /usr/lib/liblapack.so I get /usr/lib/liblapack.so -> /etc/alternatives/liblapack.so and in turn /etc/alternatives/liblapack.so -> /usr/lib/lapack/liblapack.so /usr/lib/lapack/liblapack.so belongs to liblapack-dev. So in my case liblapack.so points to the alternative installed by the liblapack-dev package (there is another alternative, for example, in /usr/lib/atlas-base/atlas, installed by libatlas-base-dev). If I do ldd /usr/lib/liblapack.so, I get: ldd /usr/lib/liblapack.so linux-vdso.so.1 => (0x7fff153fe000) libblas.so.3 => /usr/lib/libblas.so.3 (0x7ffe79e46000) libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x7ffe79b2f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7ffe798ad000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x7ffe79697000) libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x7ffe79461000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7ffe790d7000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x7ffe78ebb000) /lib64/ld-linux-x86-64.so.2 (0x7ffe7c02a000) So I know from the above that if I want to link a code with liblapack, I also need to link against libblas, libpthread and libm at least. If the compiler does not include them automatically (i.e. if I am not using gfortran to compile) I also need to explicitly include libgfortran, and if I am not using gcc compilers at all, I need to even add libgcc_s and libquadmath (but using these libraries compiled with gnu compilers with another compiler would be looking for trouble). As to explicitely linking against libstdc++, here you may have another problem: I don't have a libstdc++.so or a libstdc++.a in my library path, it is in /usr/lib/gcc/x86_64-linux-gnu/4.x and is usually never explicitely linked, it is always automatically included by the compiler. In any case you will not find it in /usr/lib, nor in /usr/lib/x86_64-linux-gnu (the default directory for 64bit libs in a multiarch system, as debian is since wheezy). So in my case I would need to do LIBS="-llapack -lblas -lpthread -lm -L/usr/lib/gcc/x86_64-linux-gnu/4.7 \ -lstdc++" As to headers, liblapack is fortran native, it can be called from C/C++ but still it is a fortran library. If you want the native C/C++ library, you should use liblapacke, which comes with the liblapacke and liblapacke-dev packages in debian. But while I sometimes used it in my codes, I have yet to see a released package using it. The liblapacke-dev package does include header files. Ciao Giacomo -- _ Giacomo Mulas _ OSSERVATORIO ASTRONOMICO DI CAGLIARI Str. 54, Loc. Poggio dei Pini * 09012 Capoterra (CA) Tel. (OAC): +39 070 71180 248 Fax : +39 070 71180 222 Tel. (UNICA): +39 070 675 4916 _ "When the storms are raging around you, stay right where you are" (Freddy Mercury) _ -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/alpine.deb.2.02.1303141906330.1...@capitanata.oa-cagliari.inaf.it
Fwd: Linking lapack and C standard library
I just came across liblapacke liblapacke-dev for amd64 wheezy. Are these packages what is needed to link lapack header files and so files for a C-language program? If so, can these packages be installed in addition to those already installed: liblapack3gf liblapack3gf-dev thanks francesco pietra -- Forwarded message -- From: Francesco Pietra Date: Thu, Mar 14, 2013 at 6:53 PM Subject: Fwd: Linking lapack and C standard library To: amd64 Debian , debian-users As to the problem of linking lapack, I wonder whether this is because it deal of a C-language code, requiring a fine-tuned calling. Is any C interface to lapack in Debian? thanks francesco -- Forwarded message -- From: Francesco Pietra Date: Thu, Mar 14, 2013 at 6:35 PM Subject: Fwd: Linking lapack and C standard library To: amd64 Debian , debian-users No, it is not correct. With the indicated links, patching reports all correct Hunk(s), while a post script is incorrect. So that "make depends" for the program+plugin does not correlate anything. I tried the link to "-L/usr" with same error. It is not clear to me whether it is a problem of path, or of lacking headers. While I see the headers for stdc++ (commanding "locate ...", I don't see headers for lapack (having installed liblapack3gf-dev). Perhaps some other lapack package is required. I tried to have a more verbose patching, as the error indicated both on "patching" and on "make depends": plugin.inc:39: *** missing separator. Stop DONE! does not point to a remedy. francesco -- Forwarded message -- From: Francesco Pietra Date: Thu, Mar 14, 2013 at 3:54 PM Subject: Re: Linking lapack and C standard library To: João Luis Meloni Assirati , amd64 Debian , debian-users Hello João Luis: Sorry for my lack of care in setting the addresses. What I did was: install liblapack3gf-dev to complete the installations, according to previous suggestions. Now, my guess for the link is LIBS="-L/usr/lib -llapack -L/usr/lib -lstdc++" According to the README, a link to both lapack and lstc++ libraries is needed. No link to the C++ compiler, as the above link is for a plugin for a program that is C++ compiled. Should those LIBS above not be correctly linked, the program complises without the plugin. I am going to try with the above link. If it works, I have to consider whether faster libraries would speed up the plugin. I don't know how heavy the mathematical computations are. I have the MKL libraries, though as rpm package. And since a few years, alien alone is no more capable of transforming that rpm to deb. Probably rpm would install with Debian, though one never knows where the files are. Thanks francesco On Thu, Mar 14, 2013 at 1:19 PM, João Luis Meloni Assirati wrote: > Em 14-03-2013 08:54, Francesco Pietra escreveu: > >> Please see my previous answer, and action. >> >> Directions how to compile that program tell that links to both lapack >> and lstc++ libraries are required in LIBS=. No link to the C++ >> compiler is required. > > > Francesco, please answer to the list. I could not see your previous answer > nor action. I'm a subscriber of the debian-users list only. > > João Luis. > > >> >> francesco >> >> On Thu, Mar 14, 2013 at 12:21 PM, João Luis Meloni Assirati >> wrote: >>> >>> Em 14-03-2013 08:00, Francesco Pietra escreveu: >>> >>>> Hello >>>> May I ask how to correctly link lapack and C standard libraries with >>>> Debian amd64 wheezy? >>> >>> >>> You mean how to compile a C program, linking both lapack and the standard >>> C >>> library to it? I suppose so in the following. >>> >>> >>>> Packages installed: liblapack3gf liblapack3 libblas3 libc6 libc6-dev >>>> ** >>> >>> >>> You probably need liblapack-dev also, which contains the header files >>> needed >>> to compile our program. >>> >>> >>>> The code to compile makes a generic example: >>>> >>>> LIBS="-llapack -lstdc++" >>> >>> >>> If it's a C program, you don't need the C++ standard library. Suppose >>> your >>> program is a file program.c. Try >>> >>> gcc -llapack -lm -o program program.c >>> >>> Usually you don't have to explicitly link the standard C library (because >>> it >>> is standard), except the math portions of it (so use the -lm switch if >>> you >>> are using math functions from the standard lib). >>> >>> >>>> thanks >>>> >>>> francesco pietra >>>> >>> João Luis. >>> > -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAEv0nmvYtZnNUo+ZD4Mac7dAWgM1hJBBeWFuDaHG6KhEg=w...@mail.gmail.com
Fwd: Linking lapack and C standard library
As to the problem of linking lapack, I wonder whether this is because it deal of a C-language code, requiring a fine-tuned calling. Is any C interface to lapack in Debian? thanks francesco -- Forwarded message -- From: Francesco Pietra Date: Thu, Mar 14, 2013 at 6:35 PM Subject: Fwd: Linking lapack and C standard library To: amd64 Debian , debian-users No, it is not correct. With the indicated links, patching reports all correct Hunk(s), while a post script is incorrect. So that "make depends" for the program+plugin does not correlate anything. I tried the link to "-L/usr" with same error. It is not clear to me whether it is a problem of path, or of lacking headers. While I see the headers for stdc++ (commanding "locate ...", I don't see headers for lapack (having installed liblapack3gf-dev). Perhaps some other lapack package is required. I tried to have a more verbose patching, as the error indicated both on "patching" and on "make depends": plugin.inc:39: *** missing separator. Stop DONE! does not point to a remedy. francesco -- Forwarded message -- From: Francesco Pietra Date: Thu, Mar 14, 2013 at 3:54 PM Subject: Re: Linking lapack and C standard library To: João Luis Meloni Assirati , amd64 Debian , debian-users Hello João Luis: Sorry for my lack of care in setting the addresses. What I did was: install liblapack3gf-dev to complete the installations, according to previous suggestions. Now, my guess for the link is LIBS="-L/usr/lib -llapack -L/usr/lib -lstdc++" According to the README, a link to both lapack and lstc++ libraries is needed. No link to the C++ compiler, as the above link is for a plugin for a program that is C++ compiled. Should those LIBS above not be correctly linked, the program complises without the plugin. I am going to try with the above link. If it works, I have to consider whether faster libraries would speed up the plugin. I don't know how heavy the mathematical computations are. I have the MKL libraries, though as rpm package. And since a few years, alien alone is no more capable of transforming that rpm to deb. Probably rpm would install with Debian, though one never knows where the files are. Thanks francesco On Thu, Mar 14, 2013 at 1:19 PM, João Luis Meloni Assirati wrote: > Em 14-03-2013 08:54, Francesco Pietra escreveu: > >> Please see my previous answer, and action. >> >> Directions how to compile that program tell that links to both lapack >> and lstc++ libraries are required in LIBS=. No link to the C++ >> compiler is required. > > > Francesco, please answer to the list. I could not see your previous answer > nor action. I'm a subscriber of the debian-users list only. > > João Luis. > > >> >> francesco >> >> On Thu, Mar 14, 2013 at 12:21 PM, João Luis Meloni Assirati >> wrote: >>> >>> Em 14-03-2013 08:00, Francesco Pietra escreveu: >>> >>>> Hello >>>> May I ask how to correctly link lapack and C standard libraries with >>>> Debian amd64 wheezy? >>> >>> >>> You mean how to compile a C program, linking both lapack and the standard >>> C >>> library to it? I suppose so in the following. >>> >>> >>>> Packages installed: liblapack3gf liblapack3 libblas3 libc6 libc6-dev >>>> ** >>> >>> >>> You probably need liblapack-dev also, which contains the header files >>> needed >>> to compile our program. >>> >>> >>>> The code to compile makes a generic example: >>>> >>>> LIBS="-llapack -lstdc++" >>> >>> >>> If it's a C program, you don't need the C++ standard library. Suppose >>> your >>> program is a file program.c. Try >>> >>> gcc -llapack -lm -o program program.c >>> >>> Usually you don't have to explicitly link the standard C library (because >>> it >>> is standard), except the math portions of it (so use the -lm switch if >>> you >>> are using math functions from the standard lib). >>> >>> >>>> thanks >>>> >>>> francesco pietra >>>> >>> João Luis. >>> > -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/caev0nmubvzh6g7tj3qwv4e5c42a_tm+qly3mcpnqk1gf9tt...@mail.gmail.com
Fwd: Linking lapack and C standard library
No, it is not correct. With the indicated links, patching reports all correct Hunk(s), while a post script is incorrect. So that "make depends" for the program+plugin does not correlate anything. I tried the link to "-L/usr" with same error. It is not clear to me whether it is a problem of path, or of lacking headers. While I see the headers for stdc++ (commanding "locate ...", I don't see headers for lapack (having installed liblapack3gf-dev). Perhaps some other lapack package is required. I tried to have a more verbose patching, as the error indicated both on "patching" and on "make depends": plugin.inc:39: *** missing separator. Stop DONE! does not point to a remedy. francesco -- Forwarded message -- From: Francesco Pietra Date: Thu, Mar 14, 2013 at 3:54 PM Subject: Re: Linking lapack and C standard library To: João Luis Meloni Assirati , amd64 Debian , debian-users Hello João Luis: Sorry for my lack of care in setting the addresses. What I did was: install liblapack3gf-dev to complete the installations, according to previous suggestions. Now, my guess for the link is LIBS="-L/usr/lib -llapack -L/usr/lib -lstdc++" According to the README, a link to both lapack and lstc++ libraries is needed. No link to the C++ compiler, as the above link is for a plugin for a program that is C++ compiled. Should those LIBS above not be correctly linked, the program complises without the plugin. I am going to try with the above link. If it works, I have to consider whether faster libraries would speed up the plugin. I don't know how heavy the mathematical computations are. I have the MKL libraries, though as rpm package. And since a few years, alien alone is no more capable of transforming that rpm to deb. Probably rpm would install with Debian, though one never knows where the files are. Thanks francesco On Thu, Mar 14, 2013 at 1:19 PM, João Luis Meloni Assirati wrote: > Em 14-03-2013 08:54, Francesco Pietra escreveu: > >> Please see my previous answer, and action. >> >> Directions how to compile that program tell that links to both lapack >> and lstc++ libraries are required in LIBS=. No link to the C++ >> compiler is required. > > > Francesco, please answer to the list. I could not see your previous answer > nor action. I'm a subscriber of the debian-users list only. > > João Luis. > > >> >> francesco >> >> On Thu, Mar 14, 2013 at 12:21 PM, João Luis Meloni Assirati >> wrote: >>> >>> Em 14-03-2013 08:00, Francesco Pietra escreveu: >>> >>>> Hello >>>> May I ask how to correctly link lapack and C standard libraries with >>>> Debian amd64 wheezy? >>> >>> >>> You mean how to compile a C program, linking both lapack and the standard >>> C >>> library to it? I suppose so in the following. >>> >>> >>>> Packages installed: liblapack3gf liblapack3 libblas3 libc6 libc6-dev >>>> ** >>> >>> >>> You probably need liblapack-dev also, which contains the header files >>> needed >>> to compile our program. >>> >>> >>>> The code to compile makes a generic example: >>>> >>>> LIBS="-llapack -lstdc++" >>> >>> >>> If it's a C program, you don't need the C++ standard library. Suppose >>> your >>> program is a file program.c. Try >>> >>> gcc -llapack -lm -o program program.c >>> >>> Usually you don't have to explicitly link the standard C library (because >>> it >>> is standard), except the math portions of it (so use the -lm switch if >>> you >>> are using math functions from the standard lib). >>> >>> >>>> thanks >>>> >>>> francesco pietra >>>> >>> João Luis. >>> > -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/caev0nmupspmkrr+bjcp4zeld3+p8n2z+r0xsnrzx9-qirus...@mail.gmail.com
Re: Linking lapack and C standard library
Hello João Luis: Sorry for my lack of care in setting the addresses. What I did was: install liblapack3gf-dev to complete the installations, according to previous suggestions. Now, my guess for the link is LIBS="-L/usr/lib -llapack -L/usr/lib -lstdc++" According to the README, a link to both lapack and lstc++ libraries is needed. No link to the C++ compiler, as the above link is for a plugin for a program that is C++ compiled. Should those LIBS above not be correctly linked, the program complises without the plugin. I am going to try with the above link. If it works, I have to consider whether faster libraries would speed up the plugin. I don't know how heavy the mathematical computations are. I have the MKL libraries, though as rpm package. And since a few years, alien alone is no more capable of transforming that rpm to deb. Probably rpm would install with Debian, though one never knows where the files are. Thanks francesco On Thu, Mar 14, 2013 at 1:19 PM, João Luis Meloni Assirati wrote: > Em 14-03-2013 08:54, Francesco Pietra escreveu: > >> Please see my previous answer, and action. >> >> Directions how to compile that program tell that links to both lapack >> and lstc++ libraries are required in LIBS=. No link to the C++ >> compiler is required. > > > Francesco, please answer to the list. I could not see your previous answer > nor action. I'm a subscriber of the debian-users list only. > > João Luis. > > >> >> francesco >> >> On Thu, Mar 14, 2013 at 12:21 PM, João Luis Meloni Assirati >> wrote: >>> >>> Em 14-03-2013 08:00, Francesco Pietra escreveu: >>> Hello May I ask how to correctly link lapack and C standard libraries with Debian amd64 wheezy? >>> >>> >>> You mean how to compile a C program, linking both lapack and the standard >>> C >>> library to it? I suppose so in the following. >>> >>> Packages installed: liblapack3gf liblapack3 libblas3 libc6 libc6-dev ** >>> >>> >>> You probably need liblapack-dev also, which contains the header files >>> needed >>> to compile our program. >>> >>> The code to compile makes a generic example: LIBS="-llapack -lstdc++" >>> >>> >>> If it's a C program, you don't need the C++ standard library. Suppose >>> your >>> program is a file program.c. Try >>> >>> gcc -llapack -lm -o program program.c >>> >>> Usually you don't have to explicitly link the standard C library (because >>> it >>> is standard), except the math portions of it (so use the -lm switch if >>> you >>> are using math functions from the standard lib). >>> >>> thanks francesco pietra >>> João Luis. >>> > -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/caev0nmuhw+np+yxdmtsymqz5zk6fw7wm+p5viq6-1xmvps7...@mail.gmail.com
Re: Linking lapack and C standard library
On Thu, Mar 14, 2013 at 12:00:43PM +0100, Francesco Pietra wrote: > Hello > May I ask how to correctly link lapack and C standard libraries with > Debian amd64 wheezy? > > Packages installed: liblapack3gf liblapack3 libblas3 libc6 libc6-dev > ** Try installing the "-dev" packages for those libraries. libfoo will usually just give you the library for use at runtime, libfoo-dev will bring in the headers, too. > > The code to compile makes a generic example: > > LIBS="-llapack -lstdc++" > > thanks > > francesco pietra > > > -- > To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org > Archive: > http://lists.debian.org/caev0nmukjyv54+r5d5534jh+-hjuhpgbs+rggav0m1kd0yz...@mail.gmail.com > signature.asc Description: Digital signature
Linking lapack and C standard library
Hello May I ask how to correctly link lapack and C standard libraries with Debian amd64 wheezy? Packages installed: liblapack3gf liblapack3 libblas3 libc6 libc6-dev ** The code to compile makes a generic example: LIBS="-llapack -lstdc++" thanks francesco pietra -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/caev0nmukjyv54+r5d5534jh+-hjuhpgbs+rggav0m1kd0yz...@mail.gmail.com