From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from rn-mailsvcp-ppex-lapp44.apple.com (rn-mailsvcp-ppex-lapp44.apple.com [17.179.253.48]) by mx.groups.io with SMTP id smtpd.web09.16047.1653537848480346974 for ; Wed, 25 May 2022 21:04:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=oRh+qXcU; spf=pass (domain: apple.com, ip: 17.179.253.48, mailfrom: afish@apple.com) Received: from pps.filterd (rn-mailsvcp-ppex-lapp44.rno.apple.com [127.0.0.1]) by rn-mailsvcp-ppex-lapp44.rno.apple.com (8.16.1.2/8.16.1.2) with SMTP id 24Q409HS024104; Wed, 25 May 2022 21:04:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : content-type : mime-version : subject : date : references : to : in-reply-to : message-id; s=20180706; bh=hf4bsSJjqTVvP/8irT9t8njhrrgbP7stwihd9IKyaYo=; b=oRh+qXcUVsfI9S57DR3CuZvf5HmK45IbOoaxrr3mGJGmbzcIYOITrRPRAFoLdIR5/SRQ IUmfRKBvPpNxeJik1n3686sxbcLWyD7bFNbwnl36rakWcdMji3aJ4R5cpJLWQmp3QLl2 lEBdg00tdm1ad75mvIdZN40qpjlHPPjWSWV6NA+bxxITAploOk6SQRLP3FrcMIQQhnVO 7a6OvoxAiR/lrEv/CkrKVQGRiywZw6IqOXFkZOsCq5okgPmGkGyXV1xlyo4o3Jab7pXy 8aXNLNVkrsokVMiz5xHv+LaBDtFJH6rYBKO3pkxZ3fnKV0Msvziq2IOIxNLRVoM1pZST pg== Received: from rn-mailsvcp-mta-lapp03.rno.apple.com (rn-mailsvcp-mta-lapp03.rno.apple.com [10.225.203.151]) by rn-mailsvcp-ppex-lapp44.rno.apple.com with ESMTP id 3g93vy4en2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 25 May 2022 21:04:07 -0700 Received: from rn-mailsvcp-mmp-lapp02.rno.apple.com (rn-mailsvcp-mmp-lapp02.rno.apple.com [17.179.253.15]) by rn-mailsvcp-mta-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) with ESMTPS id <0RCH00R9Q1YUFL40@rn-mailsvcp-mta-lapp03.rno.apple.com>; Wed, 25 May 2022 21:04:07 -0700 (PDT) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp02.rno.apple.com by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) id <0RCH00A001S3VA00@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Wed, 25 May 2022 21:04:06 -0700 (PDT) X-Va-A: X-Va-T-CD: 3f3055e4d85de42beb4b6a155ae3678a X-Va-E-CD: 4c3770dc4d507cd1d231a50137551d1b X-Va-R-CD: 83ffc66b64bb84ade298839f1d0f4894 X-Va-CD: 0 X-Va-ID: b1fea2d8-adc9-4cce-923e-fe16c2a19c5b X-V-A: X-V-T-CD: 3f3055e4d85de42beb4b6a155ae3678a X-V-E-CD: 4c3770dc4d507cd1d231a50137551d1b X-V-R-CD: 83ffc66b64bb84ade298839f1d0f4894 X-V-CD: 0 X-V-ID: 55794cf7-dcca-4190-abca-dca292b3c44a X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-26_01:2022-05-25,2022-05-26 signatures=0 Received: from smtpclient.apple (unknown [17.11.163.155]) by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) with ESMTPSA id <0RCH010BE1YT6J00@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Wed, 25 May 2022 21:04:06 -0700 (PDT) From: "Andrew Fish" MIME-version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Subject: Re: [edk2-devel] including redfish libs results in multiple definitions of symbols Date: Wed, 25 May 2022 21:04:05 -0700 References: To: edk2-devel-groups-io , xzavierpower@gmail.com, "Chang, Abner" In-reply-to: Message-id: <2BD5DBA6-E682-4983-A17A-1A61400CC383@apple.com> X-Mailer: Apple Mail (2.3693.20.0.1.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-26_01:2022-05-25,2022-05-26 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_DB0FEEBD-F5C2-416B-A61D-24A8C1DEB767" --Apple-Mail=_DB0FEEBD-F5C2-416B-A61D-24A8C1DEB767 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 25, 2022, at 9:23 AM, M.T. wrote: >=20 > Hello >=20 > I'm working on a small UEFI shell app. > I was hoping to make use of the JsonLib found in the Redfish Package. >=20 > When I include the Redfish JsonLib and it's dependencies: > JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf > Ucs2Utf8Lib|RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf > RedfishCrtLib|RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf > BaseSortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf >=20 > BaseSortLib has symbol clashes with SortLib resulting in the following: >=20 It looks like BaseSortLib and and SortLib are the same library class so you= should only have one.=20 /Volumes/Case/edk2(master)>git grep --recurse-submodules SortLib -- \*.inf= | grep LIBRARY_CLASS=20 MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf:18: LIBRARY_CLASS = =3D SortLib MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf:18: LIBRARY_CLASS = =3D SortLib|UEFI_APPLICATION UEFI_DRIVER UEFI_DRIVER DXE_RUNTIME_= DRIVER DXE_DRIVER /Volumes/Case/edk2(master)>git grep --recurse-submodules BaseSortLib -- \*= .inc RedfishPkg/RedfishLibs.dsc.inc:16: BaseSortLib|MdeModulePkg/Library/BaseSo= rtLib/BaseSortLib.inf OK bingo bingo bingo=E2=80=A6. The way the edk2 works is you have a library class that maps to the include= file. This is the name in the INF file that resolves linking. You can have= as many instances of the library class as you like. This is why the DSC fi= les have the | syntax as you are lett= ing the build pick which instance of the library to use. You can control th= is per driver/app if you want. It looks to me like BaseSortLib is an alias for SortLib and that is a bit o= f hack.=20 You could try making sure that BaseSortLib and SortLib point to the same li= brary instance=20 The other option would be to edit RedfishCrtLib.inf and make BaseSortLib So= rtLib /Volumes/Case/edk2(master)>git grep --recurse-submodules BaseSortLib -- \*= .inf MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf:13: BASE_NAME = =3D BaseSortLib MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf:14: MODULE_UNI_FILE = =3D BaseSortLib.uni MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf:25: BaseSortLib.c RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf:28: BaseSortLib I=E2=80=99m note sure why this fake BaseSortLib exists. Looks like we would= need to ask Abner? commit 6e9233f968735219b2038c5dd23a46be2c021807 Author: Abner Chang Date: Fri Dec 4 12:30:05 2020 +0800 RedfishPkg/RedfishCrtLib: Redfish C runtime library =20 Redfish CRT library is currently used by edk2 JsonLib (open source jansson project) and edk2 RedfishLib (libredfish open source project). Redfish CrtLib library provides the necessary C runtime equivalent edk2 functions for open source projects. =20 Signed-off-by: Abner Chang =20 Cc: Leif Lindholm Cc: Nickle Wang Cc: Peter O'Hanley Reviewed-by: Nickle Wang Acked-by: Leif Lindholm Reviewed-by: Michael D Kinney Thanks, Andrew Fish > /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQu= ickSort': > (.text+0x0): multiple definition of `PerformQuickSort'; BaseSortLib.obj (= symbol from plugin):(.text+0x0): first defined here > /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQu= ickSort': > (.text+0x0): multiple definition of `DevicePathCompare'; BaseSortLib.obj = (symbol from plugin):(.text+0x0): first defined here > /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQu= ickSort': > (.text+0x0): multiple definition of `StringNoCaseCompare'; BaseSortLib.ob= j (symbol from plugin):(.text+0x0): first defined here > /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQu= ickSort': > (.text+0x0): multiple definition of `StringCompare'; BaseSortLib.obj (sym= bol from plugin):(.text+0x0): first defined here >=20 > I need SortLib for UEFIShell dependencies, and I need BaseSortLib for Jso= nLib. > Is there some way around this? Or is Redfish meant to be standalone? >=20 > Thank you in advance > xp >=20 --Apple-Mail=_DB0FEEBD-F5C2-416B-A61D-24A8C1DEB767 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On May 25, 20= 22, at 9:23 AM, M.T. <xzavierpower@gmail.com> wrote:

Hello

I'm working on a small UEFI shell app= .
I was hoping to make use of the JsonLib found in the= Redfish Package.

When I include the Redfish JsonLib and it's dependencies:
JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf
Ucs2= Utf8Lib|RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
RedfishCrtLib|RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.infBaseSortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf

Bas= eSortLib has symbol clashes with SortLib resulting in the following:
<= div class=3D"">

It looks like BaseSortLib and and SortLib are the same lib= rary class so you should only have one. 

/Volu= mes/Case/edk2(master)&g= t;git grep --recurse-submodules SortLib  -- \*.inf | grep LIBRA= RY_CLASS 
MdeModulePkg/Library/BaseSortLib/BaseSortLib.= inf:18:  LIBRARY_CLASS             =     =3D SortLib
MdeModulePkg/Library/UefiSortLib/= UefiSortLib.inf:18:  LIBRARY_CLASS          &= nbsp;       =3D SortLib|UEFI_APPLICATION UEFI_DRIVER UEFI_DR= IVER DXE_RUNTIME_DRIVER DXE_DRIVER

=

/Volumes/Case/edk2(master)>git grep --recurse-submodules BaseSortLib  -- \= *.inc
RedfishPkg/RedfishLibs.dsc.inc:1= 6:  BaseSortLib= |MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf

OK = bingo bingo bingo=E2=80=A6.

The way the= edk2 works is you have a library class that maps to the include file. This= is the name in the INF file that resolves linking. You can have as many in= stances of the library class as you like. This is why the DSC files have th= e <library class name>|<path to INF file> syntax as you are let= ting the build pick which instance of the library to use. You can control t= his per driver/app if you want.

It look= s to me like BaseSortLib is an alias for SortLib and that is a bit of hack.=  

You could try making sure that B= aseSortLib and SortLib point to the same library instance 
<= br class=3D"">
The other option would be to edit RedfishCrtL= ib.inf and make BaseSortLib SortLib

/Volumes/Case/edk2(master)>git grep= --recurse-submodules BaseSortLib  -- \*.inf
MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf= :13:  BASE_NAME  &nbs= p;                   =3D BaseSortLib
MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf:14:  MODULE_UNI_FILE  &nbs= p;             =3D BaseSortLib.uni
MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf:25:  Base= SortLib.c
Redfis= hPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf:2= 8:  BaseSortLib=

I=E2= =80=99m note sure why this fake BaseSortLib exists. Looks like we would nee= d to ask Abner?

commit 6e9233f968735219b2038c5dd23a4= 6be2c021807
Author: Abner Chang <abner.chang@hpe.com>
Date:   Fri Dec 4 12:30:05 2020 +08= 00

    RedfishPkg/RedfishCrtLib: Re= dfish C runtime library

    

    Redfish CRT library is currently used by = edk2 JsonLib
    (open source jansson project) and edk2 RedfishLib<= /span>
&n= bsp;   (libredfish open source project). Redfish CrtLib library=
  &= nbsp; provides the necessary C runtime equivalent edk2 functions
   = ; for open source projects.

    

    Signed-off-by: Abner Chang <abner.chang@hpe.com>

    
=

  &nb= sp; Cc: Leif Lindholm <l= eif@nuviainc.com>
    Cc: Nickle Wang <nickle.wang@hpe.com>
    C= c: Peter O'Hanley <p= eter.ohanley@hpe.com>
    Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
= &nbs= p;   Acked-by: Leif Lindholm <leif@nuviainc.com>
    Reviewed-by: Michael D Kin= ney <michael.d.= kinney@intel.com>


=
Thanks,

Andrew Fish

/usr/bin/ld: UefiSortLib= .obj (symbol from plugin): in function `PerformQuickSort':
(.= text+0x0): multiple definition of `PerformQuickSort'; BaseSortLib.obj (symb= ol from plugin):(.text+0x0): first defined here
/usr/bin/ld: = UefiSortLib.obj (symbol from plugin): in function `PerformQuickSort':
(.text+0x0): multiple definition of `DevicePathCompare'; BaseSortL= ib.obj (symbol from plugin):(.text+0x0): first defined here
/= usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuick= Sort':
(.text+0x0): multiple definition of `StringNoCaseCompa= re'; BaseSortLib.obj (symbol from plugin):(.text+0x0): first defined here/usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function= `PerformQuickSort':
(.text+0x0): multiple definition of `Str= ingCompare'; BaseSortLib.obj (symbol from plugin):(.text+0x0): first define= d here

I need SortLib for UEFIShell dependencies, and I need BaseSortLib for= JsonLib.
Is there some way around this?  Or is R= edfish meant to be standalone?

Thank you in advance
xp
=20

--Apple-Mail=_DB0FEEBD-F5C2-416B-A61D-24A8C1DEB767--