Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
6741 Discussions

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

SZBKDCSM
Beginner
2,964 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
2,931 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
2,932 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
2,896 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
2,896 Views

.

mecej4
Black Belt
2,877 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
2,825 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
1,945 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