• Jerome Marchand's avatar
    Translate arch into source directory when ARCH is set (#2122) · 28949f17
    Jerome Marchand authored
    When ARCH is not defined, bcc get the architecture from uname. It then
    modifies it to get the name of arch directory in linux source.
    
    When ARCH is defined however, it just copy it as is, without the
    translation to the arch directory. If for instance ARCH is set to
    x86_64, it tries to look into the include directory
    build/arch/x86_64/, which doesn't exist.
    
    It fixes the following issue:
    $ echo $ARCH
    x86_64
    $ /usr/share/bcc/tools/bashreadline
    In file included from <built-in>:2:
    In file included from /virtual/include/bcc/bpf.h:12:
    In file included from /lib/modules/4.18.0-49.el8.x86_64/build/include/linux/types.h:6:
    /lib/modules/4.18.0-49.el8.x86_64/build/include/uapi/linux/types.h:5:10: fatal error: 'asm/types.h' file
          not found
             ^~~~~~~~~~~~~
    1 error generated.
    Traceback (most recent call last):
      File "/usr/share/bcc/tools/bashreadline", line 51, in <module>
        b = BPF(text=bpf_text)
      File "/usr/lib/python3.6/site-packages/bcc/__init__.py", line 318, in __init__
        raise Exception("Failed to compile BPF text")
    Exception: Failed to compile BPF text
    28949f17
kbuild_helper.cc 3.93 KB