Hi, Alex

> 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.

I' sorry. But my first V1 version patch without sed (just oe_multilib parts) 
did not pass Khem Raj's compile test (bitbake mg 
https://errors.yoctoproject.org/Errors/Details/759473/). I'm not sure if it is 
the problem you want to know.
So, I reproduce the build error and found that the cdefs.h that created by 
multilib_header has the path "#include <bsd/sys/cdefs-32.h>".
But mg find herder files without namespaced with bsd/. So, it failed. Shadow 
has the same build issue. 
So, I submitted V2 patch with sed.


> With sed, only overlay mode will work, and now you're proposing additional
> fixing to undo that effect.
Yes, I just tested my patch with sed on two recipes (mg and shadow) . The 
recipes that depend on libbsd are too few to have more test.



Best regards
Lei




> -----Original Message-----
> From: Alexander Kanavin <[email protected]>
> Sent: Friday, April 26, 2024 4:40 PM
> To: Lei, Maohui <[email protected]>
> Cc: [email protected]
> Subject: Re: [OE-core][PATCH v3] libbsd: Fix conflict error when enable 
> multilib.
> 
> On Fri, 26 Apr 2024 at 08:55, Maohui Lei (Fujitsu) <[email protected]>
> 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/readpass
> > phrase.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 (#198726): 
https://lists.openembedded.org/g/openembedded-core/message/198726
Mute This Topic: https://lists.openembedded.org/mt/105725841/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to