Description
Code First Item Overview
The typical errors we get:
multiple definition of gYuNoMenuFormsetGuid and other standard GUIDs (gEfiHiiPackageListProtocolGuid, gEfiFormBrowser2ProtocolGuid, gEfiHiiDatabaseProtocolGuid):
/usr/bin/ld: GuidInstances.obj (symbol from plugin): in function gYuNoMenuFormsetGuid': (.text+0x0): multiple definition of
gYuNoMenuFormsetGuid'; App.obj (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: AutoGen.obj (symbol from plugin): in function ProcessLibraryConstructorList': (.text+0x0): multiple definition of
gEfiFormBrowser2ProtocolGuid'; GuidInstances.obj (symbol from plugin):(.text+0x0): first defined here
undefined reference to gEfiHiiConfigAccessProtocolGuid:
/usr/bin/ld: /tmp/ccAMmTJL.ltrans0.ltrans.o: in function _ModuleEntryPoint': ...: undefined reference to
gEfiHiiConfigAccessProtocolGuid'
VfrCompile syntax errors on the VFR file:
VfrCompile...
...YuNoMenu.vfr(12): ERROR 12288: ; : unexpected token
VfrCompile: ERROR 0003: Error parsing
What specification(s) are directly related?
UEFI
Anything else?
Hello colleagues,
I am trying to build my own UEFI HII driver (EDK2, Linux, GCC5). During build, I constantly run into linker errors like this:
/usr/bin/ld: GuidInstances.obj (symbol from plugin): in function gYuNoMenuFormsetGuid': (.text+0x0): multiple definition of
gYuNoMenuFormsetGuid'; App.obj (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: ... undefined reference to `gEfiHiiConfigAccessProtocolGuid'
...
My file structure:
App.c: main entrypoint, includes YuNoMenuHii.h
GuidInstances.c: contains only the definition for my own formset GUID:
#include <Uefi.h>
#include "YuNoMenuHii.h"
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gYuNoMenuFormsetGuid = YUNO_MENU_FORMSET_GUID;
The header file contains only the extern:
// YuNoMenuHii.h
#ifndef YUNO_MENU_HII_H
#define YUNO_MENU_HII_H
#define YUNO_MENU_FORMSET_GUID
{ 0x9d93537b, 0x8e8d, 0x404f, {0x90,0xfa,0x77,0x20,0x55,0x6a,0x21,0xab} }
extern EFI_GUID gYuNoMenuFormsetGuid;
#endif
In App.c the GUID definition is removed, only the include remains.
inf
[Sources]
App.c
GuidInstances.c
YuNoMenu.vfr
YuNoMenu.uni
Problems:
Even after removing all duplicate definitions, the linker still reports a multiple definition for gYuNoMenuFormsetGuid.
Sometimes there is an undefined reference to gEfiHiiConfigAccessProtocolGuid, even though <Protocol/HiiConfigAccess.h> is included and the protocol GUID is defined in the same way as my own.
I have tried cleaning, rebuilding, removing build cache — no effect.
Question:
What could cause this? Are there any EDK2/UEFI specifics about defining custom GUIDs in drivers to avoid conflicts with AutoGen and library code?
Thanks!
The typical errors we get:
multiple definition of gYuNoMenuFormsetGuid and other standard GUIDs (gEfiHiiPackageListProtocolGuid, gEfiFormBrowser2ProtocolGuid, gEfiHiiDatabaseProtocolGuid):
/usr/bin/ld: GuidInstances.obj (symbol from plugin): in function gYuNoMenuFormsetGuid': (.text+0x0): multiple definition of
gYuNoMenuFormsetGuid'; App.obj (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: AutoGen.obj (symbol from plugin): in function ProcessLibraryConstructorList': (.text+0x0): multiple definition of
gEfiFormBrowser2ProtocolGuid'; GuidInstances.obj (symbol from plugin):(.text+0x0): first defined here
undefined reference to gEfiHiiConfigAccessProtocolGuid:
/usr/bin/ld: /tmp/ccAMmTJL.ltrans0.ltrans.o: in function _ModuleEntryPoint': ...: undefined reference to
gEfiHiiConfigAccessProtocolGuid'
VfrCompile syntax errors on the VFR file:
VfrCompile...
...YuNoMenu.vfr(12): ERROR 12288: ; : unexpected token
VfrCompile: ERROR 0003: Error parsing