EDK2 Error 3FFF: Sources is not a valid section Name, Fix? - edk2

This is in my Dsc file
[Sources]
UEFI.c
This is my error while compiling Error 3FFF: Sources is not a valid section Name
I tried moving My [Sources] Section checking for any errors But It still wont compile

Related

'Undefined Reference' in unit test project

I am using TinyEmbeddedTest and VisualGDB in Visual Studio 2015, and attempting to create a unit test project as part of my solution. My main project builds and runs fine, but the unit test project is getting linker errors and will not build.
The tests are in a source file, ADCTests.cpp, which has
#include “ADC.c”
Which I believe is appropriate for TinyEmbeddedTest.
The file ADC.c contains the following include lines:
#include “ADC.h”
#include “fault.h”
The errors are thrown in ADC.c, on the following statements:
if (status == SUCCESS)
{
Fault_Clear(FAULT_ADC_FAILURE);
rawADCValue = HAL_ADC_GetValue(hADC);
}
else
{
Fault_Set(FAULT_ADC_FAILURE);
rawADCValue = 0u;
}
The errors are:
undefined reference to ‘Fault_Clear’
undefined reference to ‘Fault_Set’
From this I can see that the header file, fault.h, where these functions are declared, is accessible to the toolchain, because otherwise there would be a compilation error, but the source file. fault.c, where these functions are defined, does not seem to be accessible. Both of these files are in the same project.
I do not get these errors when running my main project, only in the unit test project.
I thought that perhaps the answer might lie in the project linker settings, and so I added a line to the Linker->[Additional Inputs] as follows:
C:\Development\myProject\VisualGDB\Debug\Src
I assumed that this would give the linker access to the .o files, created by the compiler. Unfortunately this created a new problem. The build now fails without any error messages. The list of build messages simply says
Build failed: arm-none-eabi-g++.exe exited with code 1 Id returned 1
exit status
and when I look at the log, it says
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe:
cannot find C:/Development/myProject/VisualGDB/Debug/Src: Permission
denied
Interestingly, that last path is a hyperlink, and when I click on it, I get an error dialog box
Failed to open
‘C:\SysGCC\arm-eabi\Development\myProject\VisualGDB\Debug\Src’
This is especially odd, because I know that path does not exist, and that is definitely not the path that I entered in the Linker settings.
Any guidance would be much appreciated.

Cause and remedy for gcc linker error on export of dll

Windows C utility program (Pname.c) being compiled and linked as a dll. I am doing this on Windows 10 using CodeBlocks and Mingw/gcc. The link step produces 1 error as follows:
Cannot export NULL_IMPORT_DESCRIPTOR: symbol not found
Cannot export SP2_IMPORT_DESCRIPTOR: symbol not found
collect2.exe: error: ld returned 1 exit status
SP2 is a dll called to handle the Windows display of error messages. These IMPORT_DESCRIPTOR parameters are in the "libPname.def" file, and my understanding is they are used in the "libPname.a" files. Other than that, I have no idea what causes the error, why the symbols are not resolved since they are in "libPname.def" file, or where to start to fix the error.
The other kicker about this is, "Pname.c" is structured the same way many other programs are structured and the others link and run just fine. I have never seen this error before.

absolute path in static compiled library removing

sorry I know it is repeated and it is similar to this question but there was only one answer which doesn't satisfy the objective :)
The compilation of uamqp library is pretty easy. I end up with 2 static libraries to be used when linking in my project in eclipse. During run time and if an error happens, the error message shows the path, where the static libraries are originally compiled. I get something like this:
Error: Time:Tue May 22 09:04:45 2018 File:/home/hostname/azure-uamqp-c/src/saslclientio.c Func:on_underlying_io_error Line:243 Error callback received in unexpected state
I have no problem with the error message. The issue is only when the error occurs, then it shows the path /home/hostname/azure-uamqp-c/saslclientio.c
Please how can I compile the uamqp library, so that no absolute paths are stored inside? is it a cmake command option that I do have to configure?
Thanks
Message "Error callback received in unexpected state" is emitted by LogError() call, and LogError macro eventually uses preprocessor expression __FILE__ for refer to the path of source file.
According to that answer, expression __FILE__ is expanded to path, which is passed in compiler's command line.
Unfortunately, CMake always uses absolute paths for source files when pass them to the compiler. So there is no easy way for generate relative paths in logs.
You may write a wrapper around compiler, which transforms absolute paths to relative and calls compiler.

Using D2XX of FTDI with C

I'm trying to use ftd2xx.lib with lcc-win32 compiler but the linker fails. I used CDM v2.12.14 but also previous FTDI driverd give the same errors. I tried to compile on Windows XP and Windows7; same results.
If I link the static library I will get these kind of errors:
File ftd2xx.lib contains unknown section .text$mn.
.text section assumed
File ftd2xx.lib contains unknown section .data$r.
.data section assumed
.data$r: undefined reference to '??_7type_info##6B#'
.text$mn: undefined reference to '__imp__SetupDiGetClassDevsA#16'
.text$mn: undefined reference to '__imp__SetupDiEnumDeviceInterfaces#20'
If I link the dynamic ftd2xx.lib (with ftd2xx.dll placed in the same dir of .exe file) I will get this:
Error e:\c\ftdi_cnt\main.c 11 undefined reference to __imp__FT_Open
(Note that main.c used for this test contains just a single FT_Open() call).
Is there anyone that was able to run ftd2xx.lib with lcc-win32 compiler or that is currently using lcc-win32 and can make a quick test? Here is the latest FTDI driver. Thank you.
Finally it works!
Here is what I did:
1) Ian suggested I should use "Utils --> Import foreign library"; as a matter of fact this is the same of running from the command line:
pedump /EXP ftd2xx.lib >ftd2xx.exp
buildlib ftd2xx.exp ftd2xxy.lib
I've already tried that using for ftd2xx.lib the dynamic .lib but without success.
2) I ran pedump again, this time using the static .lib and I got a warning message about unknown dll name, so I edited the first line of ftd2xx.exp adding that name (ftd2xx.dll).
3) I defined FTD2XX_STATIC before including ftd2xx.h
4) I linked the new library ftd2xxy.lib
Note that you can't use "Utils --> Import foreign library" because you need to modify ftd2xx.exp before re-building the library.
I hope this could be helpful for others.

Compiler Error Message Customization

I'm trying to get error numbers or error IDs printed with the error messages from my C compiler. I am currently using GCC but if it would be easier using Clang, that would be okay too.
This is an example for an error message as I get it:
error: syntax error before '}' token
This is how I want it to be instead:
error(ERRID): syntax error before '}' token --
ERRID is a number or unique string for that error.
Is that possible with GCC or Clang? And if it is possible, how to do it?
I want this feature to make error messages searchable and identifiable for easy parsing and analyzing of errors.
Error messages are localized, you could change the error message catalog for your language to suite your needs.
Alternatively, you could modify some passes reporting the error e.g. with your plugin (or even some MELT extension).
But I am surprized you are asking, the GCC source code contains a catalog of error messages, in the gcc/po/ subdirectory of the source code.
Notice that the message catalog is using the gettext(3) machinery, so the message id is actually the English (C locale) message itself.

Resources