Re: [PATCH v2 1/2] CMakeLists.txt: enable SHARED and STATIC lib creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 10, 2021 at 10:31 AM Arnaldo Carvalho de Melo
<arnaldo.melo@xxxxxxxxx> wrote:
>
> Em Tue, Jun 08, 2021 at 12:50:13AM +0530, Deepak Kumar Mishra escreveu:
> > CMakeLists.txt does not allow creation of static library and link applications
> > accordingly.
> >
> > Creation of SHARED and STATIC should be allowed using -DBUILD_SHARED_LIBS
> > If -DBUILD_SHARED_LIBS option is not supplied, CMakeLists.txt sets it to ON.
> >
> > Ex:
> > cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF ..
> > cmake -D__LIB=lib -DBUILD_SHARED_LIBS=ON ..
>
> Had to do some fixups due to a previous patch touching CMakeLists.txt,
> please check below.
>
> I tested it and added some performance notes.

Hey Arnaldo, Deepak,

I think this commit actually breaks libbpf's CI (see [0]) and my local
setup as well (see output below). It seems like now we are using
system-wide libbpf headers, while still building local libbpf sources.
This is pretty bad because system-wide headers might be too old or
just missing.

Is it possible to make sure that we always use local libbpf headers
when building pahole with libbpf built from sources (the default case,
right?). It's also important to use UAPI headers distributed with
libbpf when building libbpf itself, I don't know if that's what is
done right now or not.

Note how libbpf CI case shows that system-wide bpf/btf.h is not
available at all because we don't have system-wide libbpf installed.
In my local case, you can see that my system-wide header is outdated
and doesn't have BTF_LITTLE_ENDIAN/BTF_BIG_ENDIAN constants defined in
libbpf.h.

BTW, I tried -D__LIB=lib -DBUILD_SHARED_LIBS=OFF options and they
didn't help. Maybe I'm doing something wrong.

  [0] https://travis-ci.com/github/kernel-patches/bpf/builds/228673352


$ make -j60
-- Setting BUILD_SHARED_LIBS = ON
-- Checking availability of DWARF and ELF development libraries
-- Checking availability of DWARF and ELF development libraries - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andriin/local/pahole/build

....

/home/andriin/local/pahole/btf_encoder.c:900:28: error:
‘BTF_LITTLE_ENDIAN’ undeclared (first use in this function)
   btf__set_endianness(btf, BTF_LITTLE_ENDIAN);
                            ^
/home/andriin/local/pahole/btf_encoder.c:900:28: note: each undeclared
identifier is reported only once for each function it appears in
/home/andriin/local/pahole/btf_encoder.c:903:28: error:
‘BTF_BIG_ENDIAN’ undeclared (first use in this function)
   btf__set_endianness(btf, BTF_BIG_ENDIAN);
                            ^
...


>
> Thanks!
>
> - Arnaldo
>
> commit aa2027708659f172780f85698f14303c7de6a1d2
> Author: Deepak Kumar Mishra <deepakkumar.mishra@xxxxxxx>
> Date:   Tue Jun 8 00:50:13 2021 +0530
>
>     CMakeLists.txt: Enable SHARED and STATIC lib creation
>
>     CMakeLists.txt does not allow creation of static library and link applications
>     accordingly.
>
>     Creation of SHARED and STATIC should be allowed using -DBUILD_SHARED_LIBS
>     If -DBUILD_SHARED_LIBS option is not supplied, CMakeLists.txt sets it to ON.
>
>     Ex:
>
>       $ cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF ..
>       $ cmake -D__LIB=lib -DBUILD_SHARED_LIBS=ON ..
>

[...]




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux