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

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

SZBKDCSM
Beginner
1,509 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
Black Belt
1,476 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
Black Belt
1,477 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
1,441 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?

SZBKDCSM
Beginner
1,441 Views

.

mecej4
Black Belt
1,422 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.

AbhishekD_Intel
Moderator
1,370 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


A_P
Beginner
490 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

Reply