Intel PIN can't find `linux/compiler.h` header

I want to install PIN tool on my system.
When I try to make the tool it gives me below error:

$ cd source/tools/ManualExamples 
$ make all
...
In file included from /usr/include/c++/11.1.0/x86_64-pc-linux-gnu/bits/c++config.h:571,
                 from /usr/include/c++/11.1.0/iostream:38,
                 from inscount0.cpp:12:
/usr/include/c++/11.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:44:19: error: missing binary operator before token "("
   44 | #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
      |                   ^
/usr/include/c++/11.1.0/x86_64-pc-linux-gnu/bits/os_defines.h:52:19: error: missing binary operator before token "("
   52 | #if __GLIBC_PREREQ(2, 27)
      |                   ^
In file included from /usr/local/include/os-apis/ipc.h:28,
                 from /usr/local/include/os-apis.h:55,
                 from /usr/local/include/stdio.h:73,
                 from /usr/local/include/wchar.h:47,
                 from /usr/include/c++/11.1.0/cwchar:44,
                 from /usr/include/c++/11.1.0/bits/postypes.h:40,
                 from /usr/include/c++/11.1.0/iosfwd:40,
                 from /usr/include/c++/11.1.0/ios:38,
                 from /usr/include/c++/11.1.0/ostream:38,
                 from /usr/include/c++/11.1.0/iostream:39,
                 from inscount0.cpp:12:
/usr/local/include/sys/socket.h:65:10: fatal error: linux/compiler.h: No such file or directory
   65 | #include <linux/compiler.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated

I just wonder about last error and why it couldn’t find linux/compiler.h.
I’m sure I’ve installed linux-headers because when I try to install it using yay:

$ yay linux-headers

I can see below line which states clearly I have it installed already:

core/linux54-headers 5.4.159-1 (26.8 MiB 113.6 MiB) (Installed)

Why there is no such header on my system? and how can I install it?

For linux54-headers compiler.h is located at

/usr/lib/modules/5.4.159-1-MANJARO/build/include/linux/compiler.h

However I don’t know how to pass this information to the Intel program

(moving to third party)

Did you try the pin package from AUR?

the pin pkgbuild on the AUR builds fine

Yeah I had installed it using below command:

$ yay pin A tool for the dynamic
1 aur/pin 3.21.r98484-1 (+4 0.00) (Installed)
    A tool for the dynamic instrumentation of programs

But it was not recognized by terminal which is not a problem because I found it under /opt/pin .
It worked fine but how to build the Manual Examples? it gave me permission denied!

After your suggestion I tried to make ManualExamples by sudo access which is not preferred but it was the only way for me.

Thank you, Your suggestion made me return to AUR package and find solution :pray:

The most undesirable aspect of this solution is uisng root space.

I found the solution with help of all guys replied under this topic and now I’ll share it with you.

1. First why this problem happend?
If you download pin from main site and then try to make ./source/tools/ManualExamples/ it gives you error that some library such as types_marker.h are not found:

../../../source/include/pin/pin.H:24:10: fatal error: types_marker.h: No such file or directory
         24 | #include "types_marker.h"
            |           ^--------------
Compilation terminated.

This error is indicating that compiler couldn’t find types_marker.h which you can find it in below path:

./extras/crt/include/types_marker.h

I don’t know why this problem happens, I’m just sure this problem is associated with makefiles and the strange point is that my friends doesn’t have this problem which raise just one possibility for me:

  • My compiler version was 11.1.0 but their version was 9.x.x which means maybe this causes this problem. Anyway if you’re using Manjaro/Arch you’re up to date but your problems are up to date too :grinning_face_with_smiling_eyes:

So to solve this problem I stupidly decided to copy all content of ./extras/crt/include to /usr/local/include to make sure gcc/g++ can find these headers but I strongly recommend you to avoid doing this.
Does it solved the problem? Of course it fixed the problem but it causes another problem which is showed in the topic :slightly_smiling_face:.

The gcc/g++ first look at /usr/local/include to find the headers and if it didn’t find them it checks other directories and by changing the content of this directory you’re overwriting other headers indirectly, e.g. the compiler wasn’t able even to include <iostream> header for me because it was overloaded(or maybe overwrote) by pin headers which I copied them manually.

2. How to solve it
Undo every changes you made on /usr/local/include and install AUR package:

$ yay pin A tool for the dynamic
1 aur/pin 3.21.r98484-1 (+4 0.00) (Installed)
    A tool for the dynamic instrumentation of programs

select first option and go on.
After installing, you can find it and all directories under /opt/pin/. go to this directory and subsequently to ./source/tools/ManualExamples and then:

$ sudo make all

It will give you some permission denied yet which I don’t know why:) but it’s fine! it compile all examples in this directory.
NOTE: you need root access to make because /opt is write-protected

Does it fix the problem? Yes of course it fixed it without any side effects(at least yet).
Now how it can find its libraries? I don’t know and it’s my question too :slight_smile: I just shared with you what I experienced.

3. Even Better
Install PIN from AUR. In other hand, download the same version of PIN manually from site, untar it and build the ManualExamples inside this downloaded version of your PIN.

How does it find the libraries now? I still don’t know :sneezing_face:

Advantages: It doesn’t need root access and it doesn’t consume root space

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.