Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6975 Discussions

fatal error : mkl.h : no such file or directory

SZBKDCSM
Beginner
4,551 Views

I'm a beginner.Recently installed mkl in oneapi basekit on ubuntu server20, trying to compile the c program with gcc.

I've set up environment variables using files setvars.sh according to the instructions and written them to the module file.The command "Module List" also shows that mkl is loaded.
But use the command: sudo gcc -o i2fast i2fast .c -lmkl_ rt -lm -mcmodel-large, it will show: fatal error: mkl.h: There is no file or directory.

How do I fix it?

0 Kudos
1 Solution
mecej4
Honored Contributor III
4,518 Views

The problem may be related to your using SUDO. Without the use of a SUDO option to preserve environment variables, any variables that GCC uses, such as C_INCLUDE_PATH will not be available to the compiler. 

Do you really need to use SUDO?

View solution in original post

6 Replies
mecej4
Honored Contributor III
4,519 Views

The problem may be related to your using SUDO. Without the use of a SUDO option to preserve environment variables, any variables that GCC uses, such as C_INCLUDE_PATH will not be available to the compiler. 

Do you really need to use SUDO?

SZBKDCSM
Beginner
4,483 Views

wow~,thanks a lot! You have successfully solved the problem for me. But I don't understand that sudo should have the highest permissions, but why do it affect environmental variables?

0 Kudos
SZBKDCSM
Beginner
4,483 Views

.

0 Kudos
mecej4
Honored Contributor III
4,464 Views

The issue is not about permissions -- SUDO gives you higher levels of permissions than an ordinary user may have -- but about the child process inheriting the environment of the parent process.

See, for example, this article.

0 Kudos
AbhishekD_Intel
Moderator
4,412 Views

Hi,


Glad to know that your issue got resolved, thanks to the valuable response from @mecej4.

As your issue is resolved, we will no longer monitor this thread. If you require any additional assistance from Intel, please start a new thread. 

Any further interaction in this thread will be considered community only.


Warm Regards,

Abhishek


0 Kudos
A_P
Beginner
3,532 Views

Hi, I am new to this Environment and I have downloaded the intel oneAPI base toolkit but I don't understand how to set up environment variables using files setvars.sh or generally how to make the command line recognizes the MKL library. can you tel me how you did this?

thanks

0 Kudos
Reply