简体   繁体   中英

Bash command: export BLAS_LIBS=“-L$LAPACKHOME/lib -lblas”

Can any body explain to me what does the whole sentence mean?

I know this is to set Macro BLAS_LIBS as another string.

But I'm not sure what's the "-lblas" mean and I don't know how to use it. Similar as the following code. "-llapack"

export LAPACK_LIBS="-L$LAPACKHOME/lib -llapack"

How can the program find out the BLAS and LAPACK libraries just by "-lblas" and "-llapack" ?

Thanks for advance.

I'm not sure why you say "just by -llapack " because that's not what is happening here. Specifically, the -L option just before it specifies a directory path to add to the library resolution path. This works roughly like PATH in the shell.

For example, with the command line fragment gcc -Lfoodir -Lbardir -lfoo -lbar , you basically instruct the linker to search the directories foodir and bardir for the library files libfoo.a and libbar.a .

The -l option is described in GCC: Options for Linking and -L and friends in the following section GCC: Options for Directory Search .

This build arrangement -- configure the build to show where the required files are before compiling -- is common for libraries, where if a user has already downloaded and compiled a required library for some other project, they don't need to rebuild it; they can just point the compiler to wherever they already have the stuff needed for this project.

Building your own libraries is becoming increasingly unnecessary anyway, as prepackaged binaries of most common libraries are available for most systems these days. But of course, if you are on an unusual platform, or have specialized needs which dictate recompilation with different options than any available prebuilt binary, you will still need to understand how to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM