On Fri, 26 Apr 2024 at 08:55, Maohui Lei (Fujitsu) <leimao...@fujitsu.com> wrote: > From the build log and the source code of libbsd, I found that libbsd does > provide header file in overlay mode by default as the man page says. > ----------------------------------------------------------------------- > $ ls tmp/work/cortexa57-poky-linux/libbsd/0.12.2/image/usr/lib64/pkgconfig/ > libbsd-ctor.pc libbsd-overlay.pc libbsd.pc > $ grep include > tmp/work/cortexa57-poky-linux/libbsd/0.12.2/temp/log.do_compile -r > ...... -I.. -isystem ../../libbsd-0.12.2/include/bsd/...... > ...... -I.. -isystem ../../libbsd-0.12.2/include/bsd/...... > ...... > $ vim > tmp/work/cortexa57-poky-linux/libbsd/0.12.2/libbsd-0.12.2/include/bsd/stringlist.h > #ifdef LIBBSD_OVERLAY > #include <sys/cdefs.h> > #else > #include <bsd/sys/cdefs.h> > #endif > #include <sys/types.h> > ----------------------------------------------------------------------
The man page does not say overlay mode is default, it only says that it's recommended. And indeed the above shows that you need to opt into it by defining LIBBSD_OVERLAY. Let's see how example projects handle it. > And I Investigated several OSS(e.g. shadow, mg, libxdmcp) that depend on > libbsd. From the source code of theirs. I found that they does used libbsd in > overlay mode by default. > Such as shadow: > ----------------------------------------------------------------------- > vim > tmp/work/cortexa57-poky-linux/shadow/4.15.0/shadow-4.15.0/lib/readpassphrase.h > ...... > #ifdef LIBBSD_OVERLAY > #include <sys/cdefs.h> > #endif > ...... > ----------------------------------------------------------------------- shadow does not use overlay mode by default, it makes that decision based on other factors in configure.ac: if test "$with_libbsd" != "no"; then AC_SEARCH_LIBS([readpassphrase], [bsd], [], [ AC_MSG_ERROR([readpassphrase() is missing, either from libc or libbsd]) ]) AS_IF([test "$ac_cv_search_readpassphrase" = "-lbsd"], [ PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay]) ]) dnl Make sure either the libc or libbsd provide the header. save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $LIBBSD_CFLAGS" AC_CHECK_HEADERS([readpassphrase.h]) AS_IF([test "$ac_cv_header_readpassphrase_h" != "yes"], [ AC_MSG_ERROR([readpassphrase.h is missing]) ]) CFLAGS="$save_CFLAGS" AC_DEFINE(WITH_LIBBSD, 1, [Build shadow with libbsd support]) else AC_DEFINE(WITH_LIBBSD, 0, [Build shadow without libbsd support]) fi AM_CONDITIONAL(WITH_LIBBSD, test x$with_libbsd = xyes) > The same as mg : > ----------------------------------------------------------------------- > $ vim tmp/work/cortexa57-poky-linux/mg/20230501/git/CMakeLists.txt > if(CMAKE_SYSTEM_NAME MATCHES "Linux") > pkg_check_modules (BSD REQUIRED libbsd-overlay) > link_directories (${BSD_LIBRARY_DIRS}) > string (REPLACE ";" " " LIBBSD_FLAGS "${BSD_CFLAGS}") > target_link_libraries (mg ${BSD_LIBRARIES}) > set (CMAKE_C_FLAGS "-Wall -DREGEX -D_GNU_SOURCE ${LIBBSD_FLAGS} > ${NCURSES_FLAGS} -L${NCURSES_LIBRARY_DIRS}") > else() > set (CMAKE_C_FLAGS "-Wall -DREGEX ${LIBBSD_FLAGS} ${NCURSES_FLAGS} > -L${NCURSES_LIBRARY_DIRS}") > endif() > ----------------------------------------------------------------------- This one does use overlay mode by default, but that doesn't mean every other project does the same. We have to continue supporting both options until libbsd upstream provides only one option. > So, I think the header file after oe_multilib_header should be in overlay > mode as the other header files in libbsd. > Of course, If added "#ifdef LIBBSD_OVERLAY" into the header file after > oe_multilib_header, libbsd will have a better compatibility. What do you > think? I don't think this is correct. Without sed, both modes will work (unless you can demonstrate how it will break; I asked that, and there's no answer in the above). With sed, only overlay mode will work, and now you're proposing additional fixing to undo that effect. So I'd suggest you submit the patch without sed (just oe_multilib parts), and we can then consider if any further fixing is required. Again: please show what is the problem that would occur without sed. Alex
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#198717): https://lists.openembedded.org/g/openembedded-core/message/198717 Mute This Topic: https://lists.openembedded.org/mt/105725841/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-