My Matomo installation doesn't work on desktop - matomo

Matomo doesn't work on desktop release.
Ooops ... there was a problem during the request. Maybe the server had
a temporary problem or maybe you requested a report with too much
data.
This is the matomo.log:
'''
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] Uncaught exception: /membri/impressionism/matomo/plugins/Live/templates/_visitorLogIcons.twig(16): The string to escape is not a valid UTF-8 string.
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] The string to escape is not a valid UTF-8 string.
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #0 /membri/impressionism/matomo/core/Twig.php(69): twig_escape_filter(Object(Twig\Environment), 'San Mart\xEDn de l...', 'html_attr', 'UTF-8', false)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #1 /membri/impressionism/matomo/tmp/templates_c/8f/8f3293af9e355d51978f0a1005aca83f01464bfbc8d55751a8d3178f9975d9bf.php(64): Piwik\piwik_escape_filter(Object(Twig\Environment), 'San Mart\xEDn de l...', 'html_attr')
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #2 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(455): __TwigTemplate_48ad10421548dbe27c8ef303b7c040c271a9b7e5cb17d293981650bfb3aee5ce->doDisplay(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #3 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(422): Twig\Template->displayWithErrorHandling(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #4 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(434): Twig\Template->display(Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #5 /membri/impressionism/matomo/vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->render(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #6 /membri/impressionism/matomo/vendor/twig/twig/src/Environment.php(384): Twig\TemplateWrapper->render(Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #7 /membri/impressionism/matomo/core/View.php(311): Twig\Environment->render('#Live/_visitorL...', Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #8 /membri/impressionism/matomo/core/View.php(295): Piwik\View->renderTwigTemplate()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #9 /membri/impressionism/matomo/plugins/Live/VisitorDetails.php(126): Piwik\View->render()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #10 /membri/impressionism/matomo/plugins/Live/Live.php(138): Piwik\Plugins\Live\VisitorDetails->renderIcons(Object(Piwik\DataTable\Row))
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #11 [internal function]: Piwik\Plugins\Live\Live->renderVisitorIcons('', Object(Piwik\DataTable\Row))
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #12 /membri/impressionism/matomo/core/EventDispatcher.php(141): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #13 /membri/impressionism/matomo/core/Piwik.php(775): Piwik\EventDispatcher->postEvent('Live.renderVisi...', Array, false, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #14 /membri/impressionism/matomo/core/Twig.php(289): Piwik\Piwik::postEvent('Live.renderVisi...', Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #15 /membri/impressionism/matomo/tmp/templates_c/47/4700797b9f5741a2216205f8c2053127fd14c140de58d5313fc3939e2f7b25b9.php(123): Piwik\Twig->Piwik{closure}('Live.renderVisi...', Object(Piwik\DataTable\Row))
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #16 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(455): __TwigTemplate_f7387213c57911a4fe2fa844a9dea404f3cc42ae869b2de1f203141fa4f2e5f3->doDisplay(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #17 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(422): Twig\Template->displayWithErrorHandling(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #18 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(434): Twig\Template->display(Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #19 /membri/impressionism/matomo/vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->render(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #20 /membri/impressionism/matomo/vendor/twig/twig/src/Environment.php(384): Twig\TemplateWrapper->render(Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #21 /membri/impressionism/matomo/core/View.php(311): Twig\Environment->render('#Live/getLastVi...', Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #22 /membri/impressionism/matomo/core/View.php(295): Piwik\View->renderTwigTemplate()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #23 /membri/impressionism/matomo/plugins/Live/Controller.php(58): Piwik\View->render()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #24 /membri/impressionism/matomo/plugins/Live/Controller.php(101): Piwik\Plugins\Live\Controller->render(Object(Piwik\View))
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #25 /membri/impressionism/matomo/plugins/Live/Controller.php(41): Piwik\Plugins\Live\Controller->getLastVisitsStart()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #26 [internal function]: Piwik\Plugins\Live\Controller->widget()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #27 /membri/impressionism/matomo/core/FrontController.php(590): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #28 /membri/impressionism/matomo/core/FrontController.php(165): Piwik\FrontController->doDispatch('Live', 'widget', Array)
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #29 /membri/impressionism/matomo/core/dispatch.php(34): Piwik\FrontController->dispatch()
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #30 /membri/impressionism/matomo/index.php(27): require_once('/membri/impress...')
ERROR Piwik\FrontController[2020-05-31 18:25:07 UTC] [b5304] #31 {main}
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] Uncaught exception: /membri/impressionism/matomo/plugins/Live/templates/_visitorLogIcons.twig(16): The string to escape is not a valid UTF-8 string.
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] The string to escape is not a valid UTF-8 string.
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #0 /membri/impressionism/matomo/core/Twig.php(69): twig_escape_filter(Object(Twig\Environment), 'San Mart\xEDn de l...', 'html_attr', 'UTF-8', false)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #1 /membri/impressionism/matomo/tmp/templates_c/8f/8f3293af9e355d51978f0a1005aca83f01464bfbc8d55751a8d3178f9975d9bf.php(64): Piwik\piwik_escape_filter(Object(Twig\Environment), 'San Mart\xEDn de l...', 'html_attr')
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #2 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(455): __TwigTemplate_48ad10421548dbe27c8ef303b7c040c271a9b7e5cb17d293981650bfb3aee5ce->doDisplay(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #3 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(422): Twig\Template->displayWithErrorHandling(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #4 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(434): Twig\Template->display(Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #5 /membri/impressionism/matomo/vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->render(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #6 /membri/impressionism/matomo/vendor/twig/twig/src/Environment.php(384): Twig\TemplateWrapper->render(Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #7 /membri/impressionism/matomo/core/View.php(311): Twig\Environment->render('#Live/_visitorL...', Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #8 /membri/impressionism/matomo/core/View.php(295): Piwik\View->renderTwigTemplate()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #9 /membri/impressionism/matomo/plugins/Live/VisitorDetails.php(126): Piwik\View->render()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #10 /membri/impressionism/matomo/plugins/Live/Live.php(138): Piwik\Plugins\Live\VisitorDetails->renderIcons(Object(Piwik\DataTable\Row))
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #11 [internal function]: Piwik\Plugins\Live\Live->renderVisitorIcons('', Object(Piwik\DataTable\Row))
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #12 /membri/impressionism/matomo/core/EventDispatcher.php(141): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #13 /membri/impressionism/matomo/core/Piwik.php(775): Piwik\EventDispatcher->postEvent('Live.renderVisi...', Array, false, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #14 /membri/impressionism/matomo/core/Twig.php(289): Piwik\Piwik::postEvent('Live.renderVisi...', Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #15 /membri/impressionism/matomo/tmp/templates_c/47/4700797b9f5741a2216205f8c2053127fd14c140de58d5313fc3939e2f7b25b9.php(123): Piwik\Twig->Piwik{closure}('Live.renderVisi...', Object(Piwik\DataTable\Row))
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #16 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(455): __TwigTemplate_f7387213c57911a4fe2fa844a9dea404f3cc42ae869b2de1f203141fa4f2e5f3->doDisplay(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #17 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(422): Twig\Template->displayWithErrorHandling(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #18 /membri/impressionism/matomo/vendor/twig/twig/src/Template.php(434): Twig\Template->display(Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #19 /membri/impressionism/matomo/vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->render(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #20 /membri/impressionism/matomo/vendor/twig/twig/src/Environment.php(384): Twig\TemplateWrapper->render(Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #21 /membri/impressionism/matomo/core/View.php(311): Twig\Environment->render('#Live/getLastVi...', Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #22 /membri/impressionism/matomo/core/View.php(295): Piwik\View->renderTwigTemplate()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #23 /membri/impressionism/matomo/plugins/Live/Controller.php(58): Piwik\View->render()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #24 /membri/impressionism/matomo/plugins/Live/Controller.php(101): Piwik\Plugins\Live\Controller->render(Object(Piwik\View))
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #25 /membri/impressionism/matomo/plugins/Live/Controller.php(41): Piwik\Plugins\Live\Controller->getLastVisitsStart()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #26 [internal function]: Piwik\Plugins\Live\Controller->widget()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #27 /membri/impressionism/matomo/core/FrontController.php(590): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #28 /membri/impressionism/matomo/core/FrontController.php(165): Piwik\FrontController->doDispatch('Live', 'widget', Array)
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #29 /membri/impressionism/matomo/core/dispatch.php(34): Piwik\FrontController->dispatch()
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #30 /membri/impressionism/matomo/index.php(27): require_once('/membri/impress...')
ERROR Piwik\FrontController[2020-05-31 18:29:50 UTC] [c2ce5] #31 {main}
'''
Thank you for help me.

This issue The string to escape is not a valid UTF-8 string is fixed in Matomo 4 currently in development. If you are blocked, you can always try to upgrade to the Matomo 4 in development at: https://github.com/matomo-org/matomo (branch 4.x-dev). Learn more about the issue here: https://github.com/matomo-org/matomo/issues/14485
which was fixed in https://github.com/matomo-org/matomo/pull/15618
(will be released in Matomo 4 in a few months)

Related

Why does LoadLibrary fail with error code 193? [duplicate]

I'm stuck as to why I can't load my dll "interfac" using LoadLibrary. It seems to be failing when loading a dependency but I'm not sure why.
Here's the code:
AfxMessageBox(L"before load library");
HMODULE interfacDll = LoadLibrary(TEXT("C:\\QA\\Pcdlrn\\Win32\\Release\\INTERFAC.DLL"));
if (!interfacDll)
DWORD dw = GetLastError(); // returns 0xc1 (193)
AfxMessageBox(L"after load library");
And here's the output from gflags (x86)'s loader snaps:
18a0:2a40 # 06858973 - LdrGetDllHandleEx - ENTER: DLL name: ntdll.dll DLL path: NULL
18a0:2a40 # 06858973 - LdrGetDllHandleEx - INFO: Locating DLL ntdll.dll in path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows
18a0:2a40 # 06858989 - LdrpFindLoadedDll - ENTER: DLL name: ntdll.dll DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows
18a0:2a40 # 06858989 - LdrpFindLoadedDll - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrGetDllHandleEx - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrGetProcedureAddressEx - INFO: Locating procedure "KiUserExceptionDispatcher" by name
18a0:2a40 # 06858989 - LdrLoadDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\syste
18a0:2a40 # 06858989 - LdrpLoadDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\syst
18a0:2a40 # 06858989 - LdrpLoadDll - INFO: Loading DLL C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL from path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\sys
18a0:2a40 # 06858989 - LdrpFindOrMapDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows
18a0:2a40 # 06858989 - LdrpSearchPath - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\s
18a0:2a40 # 06858989 - LdrpResolveFileName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveFileName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpResolveDllName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveDllName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpSearchPath - RETURN: Status: 0x00000000
18a0:2a40 # 06859036 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll', Symbols loaded.
18a0:2a40 # 06859098 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
18a0:2a40 # 06859098 - LdrpRelocateImage - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06859098 - LdrpProtectAndRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpFindOrMapDll - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpHandleOneOldFormatImportDescriptor - INFO: DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" imports "PCDLRN.exe"
18a0:2a40 # 06859098 - LdrpLoadImportModule - ENTER: DLL name: PCDLRN.exe DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\W
18a0:2a40 # 06859098 - LdrpFindOrMapDll - ENTER: DLL name: PCDLRN.exe DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windo
18a0:2a40 # 06859098 - LdrpFindKnownDll - ENTER: DLL name: PCDLRN.exe
18a0:2a40 # 06859098 - LdrpFindKnownDll - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpSearchPath - ENTER: DLL name: PCDLRN.exe DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\QA\Pcdlrn\CNCSERVER\Win32\Release\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\Windows\system32\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\Windows\system\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: C:\Windows\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0xc0000135
18a0:2a40 # 06859098 - LdrpResolveFileName - ENTER: DLL name: .\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveFileName - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpResolveDllName - ENTER: DLL name: .\PCDLRN.exe
18a0:2a40 # 06859098 - LdrpResolveDllName - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpSearchPath - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe
'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe', Symbols loaded.
18a0:2a40 # 06859597 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe'
18a0:2a40 # 06859597 - LdrpFindOrMapDll - RETURN: Status: 0xc000007b
18a0:2a40 # 06859597 - LdrpLoadImportModule - ERROR: Loading DLL PCDLRN.exe from path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:
18a0:2a40 # 06859597 - LdrpLoadImportModule - RETURN: Status: 0xc000007b
18a0:2a40 # 06859597 - LdrpHandleOneOldFormatImportDescriptor - ERROR: Loading "?????" from the import table of DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" failed with status 0xc000007b
18a0:2a40 # 06859613 - LdrpUnloadDll - INFO: Unmapping DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL"
'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll'
18a0:2a40 # 06859613 - LdrpLoadDll - RETURN: Status: 0xc000007b
18a0:2a40 # 06859613 - LdrLoadDll - RETURN: Status: 0xc000007b
I should mention that I am using 64-bit windows but all my executable code is either targeted to x86 (c#) or win32 (c++).
How do I resolve this issue?
Any suggestions would be greatly appreciated.
Thank you very much.
p.s. Here's the dependency walker output:
p.p.s. here's a screenshot showing that my DLLs are x86:
p.p.p.s. here's the linker inputs for interfac.dll:
Edit. Here's the output of dumpbin:
Microsoft (R) COFF/PE Dumper Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file pcdlrn.exe
File Type: EXECUTABLE IMAGE
Section contains the following exports for PCDLRN.exe
00000000 characteristics
5796AD2A time date stamp Mon Jul 25 20:22:02 2016
0.00 version
1 ordinal base
5784 number of functions
5784 number of names
ordinal hint RVA name
1 0 0029CDF0 ??0?$CArray#V?$CStringT#_WV?$StrTraitMFC_DLL#_WV?$ChTraitsCRT#_W#ATL#####ATL##V12###QAE#XZ = ??0?$CArray#V?$CStringT#_WV?$StrTraitMFC_DLL#_WV?$ChTraitsCRT#_W#ATL#####ATL##V12###QAE#XZ (public: __thiscall CArray<class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > >::CArray<class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > >(void))
...
5783 1696 02593550 ?zoomOutFine#VisionTargetControls#UIEvents##YAXXZ = ?zoomOutFine#VisionTargetControls#UIEvents##YAXXZ (void __cdecl UIEvents::VisionTargetControls::zoomOutFine(void))
5784 1697 02593640 ?zoomOutMaximum#VisionTargetControls#UIEvents##YAXXZ = ?zoomOutMaximum#VisionTargetControls#UIEvents##YAXXZ (void __cdecl UIEvents::VisionTargetControls::zoomOutMaximum(void))
Summary
2C0000 .data
1000 .fnp_dir
1000 .fnp_mar
AFA000 .rdata
1B000 .rsrc
2E7A000 .text
E5000 .textidx
1000 .tls
One likely explanation for the ERROR_BAD_EXE_FORMAT error from LoadLibrary is that INTERFAC.DLL was linked with a PCDLRN.LIB import library that declares PCDLRN exports, but the PCDLRN.EXE found at runtime does not have an exports table.
The gflags (x86)'s loader snaps shows that the error is triggered while loading PCDLRN.EXE, specifically while resolving the import table of INTERFAC.DLL:
18a0:2a40 # 06859098 - LdrpHandleOneOldFormatImportDescriptor - INFO: DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" imports "PCDLRN.exe"
[...]
18a0:2a40 # 06859597 - LdrpHandleOneOldFormatImportDescriptor - ERROR: Loading "?????" from the import table of DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" failed with status 0xc000007b
Status 0xc000007b is STATUS_INVALID_IMAGE_FORMAT:
{Bad Image} %hs is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
NTSTATUS STATUS_INVALID_IMAGE_FORMAT is mapped to Win32 error code ERROR_BAD_EXE_FORMAT per INFO: Mapping NT Status Error Codes to Win32 Error Codes.
I was able to duplicate the same ERROR_BAD_EXE_FORMAT with a mockup of the given scenario: link INTERFAC.DLL to a PCDLRN.LIB that declares an exported foo, then substitute a PCDLRN.EXE without an exports table, and finally attempt to LoadLibrary INTERFAC.DLL.
As a side note, linking a DLL to the import library of another EXE is uncommon and fraught with pitfalls. In the case here, even if error 193 is fixed, the functions in the EXE would not be directly usable from the DLL. See for example Load EXE as DLL: Mission Possible for more details.
Edit: Though what follows makes sense it is actually incorrect. I'm keeping it here just for reference, but I may delete the answer later.
Note however that (at least on Windows 10, which I used to check) even if relocation information is available in the file, if the module is not a DLL it is not applied, so even if you didn't get that error, unless your INTERFAC.DLL applies relocations to PCLDRN.exe after loading it, trying to use it is likely to break somewhere along the way.
With the loader snaps output the situation seems pretty obvious to me.
The loader snaps output once the file is found are (I numbered the lines):
(1) 18a0:2a40 # 06859098 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe
(2) 'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe', Symbols loaded.
(3) 18a0:2a40 # 06859597 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
(4) 'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\PCDLRN.exe'
(5) 18a0:2a40 # 06859597 - LdrpFindOrMapDll - RETURN: Status: 0xc000007b
(6) 18a0:2a40 # 06859597 - LdrpLoadImportModule - ERROR: Loading DLL PCDLRN.exe from path C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:
(7) 18a0:2a40 # 06859597 - LdrpLoadImportModule - RETURN: Status: 0xc000007b
(8) 18a0:2a40 # 06859597 - LdrpHandleOneOldFormatImportDescriptor - ERROR: Loading "?????" from the import table of DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL" failed with status 0xc000007b
(9) 18a0:2a40 # 06859613 - LdrpUnloadDll - INFO: Unmapping DLL "C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL"
(10) 'CNCServer.exe': Unloaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll'
(11) 18a0:2a40 # 06859613 - LdrpLoadDll - RETURN: Status: 0xc000007b
(12) 18a0:2a40 # 06859613 - LdrLoadDll - RETURN: Status: 0xc000007b
LdrpMapViewOfSection returns an error code (0x40000003) on line 3 which causes the module to unload (line 4) and then LdrpMapViewOfSection's caller - LdrpFindOrMapDll - translates the error code to 0xc000007b (STATUS_INVALID_IMAGE_FORMAT).
But the error that caused the load to fail was 0x40000003 - STATUS_IMAGE_NOT_AT_BASE. The description of this NTSTATUS is:
{Image Relocated} An image file could not be mapped at the address that is specified in the image file. Local fixes must be performed on this image.
(Source: NTSTATUS Values)
By default, EXEs don't contain relocation information (as was mentioned in the comments). Usually that's not a problem as the address space is rather free when the EXE is loaded into it. But your address space isn't free. To make matters worse, all EXEs compiled by Visual C++ share the same base address by default:
The /BASE option sets a base address for the program, overriding the default location for an .exe or DLL file. The default base address for an .exe file is 0x400000 for 32-bit images or 0x140000000 for 64-bit images. For a DLL, the default base address is 0x10000000 for 32-bit images or 0x180000000 for 64-bit images.
(Source: Linker Options: /BASE (Base Address))
That's probably the situation you have. CNCServer.exe already occupies 0x400000 and that's the only place PCDLRN.exe can go. LdrpMapViewOfSection can't map PCDLRN.exe to 0x400000 because it isn't free and fails to map in anywhere else because there's no relocation information.
And from there it goes up the call stack and changes the error, but not the underlying problem. Which is lack of relocation information.
You can see what happened when this error is encountered for a DLL with relocation information in your output too. When INTERFAC.dll is initially loaded:
18a0:2a40 # 06858989 - LdrpFindOrMapDll - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows
18a0:2a40 # 06858989 - LdrpSearchPath - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL DLL path: C:\QA\Pcdlrn\CNCSERVER\Win32\Release;C:\Windows\system32;C:\Windows\system;C:\Windows;.;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\NativeBinaries\x86;C:\windows\system32;C:\windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\s
18a0:2a40 # 06858989 - LdrpResolveFileName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveFileName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpResolveDllName - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06858989 - LdrpResolveDllName - RETURN: Status: 0x00000000
18a0:2a40 # 06858989 - LdrpSearchPath - RETURN: Status: 0x00000000
18a0:2a40 # 06859036 - LdrpMapViewOfSection - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
'CNCServer.exe': Loaded 'C:\QA\Pcdlrn\Win32\Release\INTERFAC.dll', Symbols loaded.
18a0:2a40 # 06859098 - LdrpMapViewOfSection - RETURN: Status: 0x40000003
18a0:2a40 # 06859098 - LdrpRelocateImage - ENTER: DLL name: C:\QA\Pcdlrn\Win32\Release\INTERFAC.DLL
18a0:2a40 # 06859098 - LdrpProtectAndRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpRelocateImage - RETURN: Status: 0x00000000
18a0:2a40 # 06859098 - LdrpFindOrMapDll - RETURN: Status: 0x00000000
When LdrpMapViewOfSection returns STATUS_IMAGE_NOT_AT_BASE, it's caller (LdrpFindOrMapDll) goes ahead and calls LdrpRelocateImage, something it apparently can't to for PCDLRN.exe.

symbol-file command working with older gdb but not with newer gdb

I have an issue where gdb on one system I can't get gdb to use a symbol-file in order to show me source files and line numbers in a backtrace, but on an older system with the exact same commands it works fine. The older system where this is woking is a 32-bit Debian 6, and the modern one where it isn't working is a 64-bit Debian 10.
In both cases I've built, run, and ran gdb on the same system (so no crossing binaries or cores between systems)
I can reproduce this with a simple toy program (test.c) designed just to crash immediately:
int main()
{
int *i=0;
*i=0;
return 0;
}
I compile it and split it into a stripped executable and a symbols file, and run the executable:
gcc -g test.c -o test
objcopy --only-keep-debug test test.dbg
objcopy --strip-debug test
ulimit -c unlimited
./test
I then open the core dump in gdb. When I do this on an older system (32-bit, gdb 7.0.1-debian), I see the backtrace without any symbols, but once I run symbol-file test.dbg I then see the source file and line information in the backtrace (test.c:4) (I've not included some early gdb output that clutters the screen and I don't think is relevant, I can put it in if its needed)
gdb -c core test
Core was generated by `./test'.
Program terminated with signal 11, Segmentation fault.
#0 0x080483a4 in main ()
(gdb) symbol-file test.dbg
Reading symbols from /home/user/test.dbg...done.
(gdb) bt
#0 0x080483a4 in main () at test.c:4
(gdb) quit
Running the exact same sequence on a newer machine (64-bit, gdb 8.2.1), I get the following
Core was generated by `./test'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055e5dda71135 in main ()
(gdb) symbol-file test.dbg
Load new symbol table from "test.dbg"? (y or n) y
Reading symbols from test.dbg...done.
(gdb) bt
#0 0x000055e5dda71135 in ?? ()
#1 0x000055e5dda71150 in ?? ()
#2 0x00007eff7035f09b in __libc_start_main (main=0x55e5dda71125, argc=1, argv=0x7fff46187ec8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff46187eb8)
at ../csu/libc-start.c:308
#3 0x000055e5dda7106a in ?? ()
#4 0x00007fff46187eb8 in ?? ()
#5 0x000000000000001c in ?? ()
#6 0x0000000000000001 in ?? ()
#7 0x00007fff46188e8f in ?? ()
#8 0x0000000000000000 in ?? ()
Loading the symbol file not only doesn't add the sources and lines, but seems to lose the main() in the first frame. I've also tried using add-symbol-file instead of symbol-file and including the symbol file on the command line with the -s option but with no better results. I've also tried putting -s before -c as I found recommended online but that didn't help either.
Edit: Transcript that was requested below:
$ gcc -g test.c -o test
$ objcopy --only-keep-debug test test.dbg
$ ./test
Segmentation fault (core dumped)
$ gdb test.dbg core
GNU gdb (Debian 8.2.1-2+b1) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test.dbg...done.
warning: core file may not match specified executable file.
[New LWP 26602]
Core was generated by `./test'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000056477c36d135 in ?? ()
(gdb) bt
#0 0x000056477c36d135 in ?? ()
#1 0x000056477c36d150 in ?? ()
#2 0x00007fa3a18a509b in __libc_start_main (main=0x56477c36d125, argc=1, argv=0x7ffd0b6aed38, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd0b6aed28)
at ../csu/libc-start.c:308
#3 0x000056477c36d06a in ?? ()
#4 0x00007ffd0b6aed28 in ?? ()
#5 0x000000000000001c in ?? ()
#6 0x0000000000000001 in ?? ()
#7 0x00007ffd0b6afe8d in ?? ()
#8 0x0000000000000000 in ?? ()
(gdb)
Running the exact same sequence on a newer machine (64-bit, gdb 8.2.1), I get the following
Try building your test binary with -fno-pie -no-pie.
Your working example has a non-PIE address (0x0804xxxx). Your non-working example has a PIE address (0x000055....). Debian decided to make PIE binaries the default, which adds a modicum of security to the system.
What is likely happening is that GDB throws away the relocation info when it reloads the symbol-file.
P.S. You can avoid this whole problem by using:
gdb test.dbg core
which would start GDB on the right foot from the get-go.
P.P.S. It's generally a really bad idea to name any binary test, because that may interfere with shell evaluation of conditionals (if the shell finds ./test instead of /bin/test, and doesn't have test as built-in).

"AR/config.h" Not Found

I am trying to compile the simpleLite.c example from the ARToolKit5 examples page. If I run the .app file, it works fine. I wanted to see if I could modify anything in the file, so I tried to make the file again but I get the errors:
./Makefile.in: line 49: ../../include: is a directory
./Makefile.in: line 50: ../../lib: is a directory
./Makefile.in: line 51: ../../bin: is a directory
./Makefile.in: line 54: LIB_DIR: command not found
./Makefile.in: line 54: LIB_DIR: command not found
./Makefile.in: line 54: -L/#SYSTEM#: No such file or directory
./Makefile.in: line 55: -lARgsub_lite: command not found
./Makefile.in: line 56: INC_DIR: command not found
./Makefile.in: line 56: #CFLAG#: command not found
./Makefile.in: line 58: OBJS: command not found
./Makefile.in: line 59: HEADERS: command not found
./Makefile.in: line 61: BIN_DIR: command not found
./Makefile.in: line 61: all:: command not found
./Makefile.in: line 63: BIN_DIR: command not found
./Makefile.in: line 63: OBJS: command not found
./Makefile.in: line 63: /simpleLite:: No such file or directory
./Makefile.in: line 64: BIN_DIR: command not found
./Makefile.in: line 64: OBJS: command not found
./Makefile.in: line 64: LDFLAG: command not found
./Makefile.in: line 64: LIBS: command not found
clang: error: no such file or directory: 'simpleLite.o'
clang: error: no input files
./Makefile.in: line 66: HEADERS: command not found
./Makefile.in: line 66: simpleLite.o:: command not found
./Makefile.in: line 67: CFLAG: command not found
simpleLite.c:68:10: fatal error: 'AR/config.h' file not found
#include <AR/config.h>
^~~~~~~~~~~~~
1 error generated.
./Makefile.in: line 69: clean:: command not found
./Makefile.in: line 71: BIN_DIR: command not found
./Makefile.in: line 73: allclean:: command not found
./Makefile.in: line 75: BIN_DIR: command not found
./Makefile.in: line 78: distclean:: command not found
The folder contains three files, a makefile.in, a .plist file and the .c source code. The AR/config.h folder exists elsewhere in the ARToolKit5 archive (ARToolKit5/include/AR).
Normally, I'd assume I need to specify the path from the source folder, but there are also include statements like # include <GLUT/glut.h>, which aren't throwing errors.
I'm fairly new/rusty to C development, so I'm not sure what even to look up to fix this issue. Can anyone point me in the right direction? Do I need to specify the header paths, or is it something less obvious?

where is aeabi_fmul being linked from?

I've been running code on the ARM M0+ core and i see that the vast majority of my time is spent in floating point calculations. So I am experimenting with a custom floating point calculation function for use in very low power applications.
I've been using ARM GCC for bare metal compile on an M0+ (without a hard FPU). I see that floating point multiplication gets linked to __aeabi_fmul and then linked to generate the final ELF file.
My questions are as follows:
Where is __aeabi_fmul defined? Is it in a pre-compiled library that comes with GCC?
Is it possible to change this definition in some way? Maybe have a pre-compiled version of my_fp_mul instead and link to that instead of __aeabi_fmul?
I understand that the second part needs me to mess with the compiler. I've been looking into CLANG/LLVM to do this since general consensus seems to be that its easier to modify than GCC! I'm just trying to see if this is even something thats possible or im barking up the entirely wrong tree here.
thank you
It is part of gcc, the gcc library, download the gcc sources and search for those functions and you will find them. They are soft float routines and are hand tuned and you are unlikely to do a significantly better job, but knock yourself out. Not sure why you would do any floating point on an MCU like that but thankfully the language and the tools allow you although it can consume a lot of flash and execution time. (not doing any float variables but doing the floating point math yourself with fixed point is a possible compromise or just do fixed point).
If you use gcc to link then gcc knows where the libraries are and will pull them in automatically, if you use ld to link (using gcc just as a compiler not the caller of everything in the toolchain) then ld does not know where to find the libraries and you can simply add your own object on the command line, this is the simplest way.
You can take the as-is gnu source for a particular function and add it to your project then modify it or just completely replace it with your own function.
Naturally you can go into the compiler sources and rename things then re-build the compiler, not sure just how much work you want to do here, replacing the floating point routines without mistakes is already a large task, as mentioned in comments I would leave the compiler alone and just work with it (leave the names the same link with ld).
start.s
.thumb
.thumb_func
.global _start
_start:
stacktop: .word 0x20001000
.word reset
.word hang
.word hang
.word hang
.thumb_func
reset:
bl notmain
.thumb_func
hang: b .
so.c
float notmain ( float a, float b )
{
return(a+b);
}
memmap
MEMORY
{
rom : ORIGIN = 0x00000000, LENGTH = 0x1000
ram : ORIGIN = 0x20000000, LENGTH = 0x1000
}
SECTIONS
{
.text : { *(.text*) } > ram
.bss : { *(.bss*) } > rom
}
build
arm-none-eabi-as start.s -o start.o
arm-none-eabi-gcc -Xlinker -T -Xlinker memmap -nostdlib -nostartfiles -ffreestanding -mthumb start.o so.c -o so.elf -lgcc
arm-none-eabi-objdump -D so.elf
it doesnt complain but makes a perfectly broken binary
20000048 <__addsf3>:
20000048: e1b02080 lsls r2, r0, #1
2000004c: 11b03081 lslsne r3, r1, #1
20000050: 11320003 teqne r2, r3
20000054: 11f0cc42 mvnsne r12, r2, asr #24
20000058: 11f0cc43 mvnsne r12, r3, asr #24
2000005c: 0a000047 beq 20000180 <__addsf3+0x138>
20000060: e1a02c22 lsr r2, r2, #24
20000064: e0723c23 rsbs r3, r2, r3, lsr #24
20000068: c0822003 addgt r2, r2, r3
2000006c: c0201001 eorgt r1, r0, r1
20000070: c0210000 eorgt r0, r1, r0
those are arm instructions not thumb. examining what the linker was passed.
0:[/opt/gnuarm/lib/gcc/arm-none-eabi/7.1.0/../../../../arm-none-eabi/bin/ld]
1:[-plugin]
2:[/opt/gnuarm/libexec/gcc/arm-none-eabi/7.1.0/liblto_plugin.so]
3:[-plugin-opt=/opt/gnuarm/libexec/gcc/arm-none-eabi/7.1.0/lto-wrapper]
4:[-plugin-opt=-fresolution=/tmp/ccSyISCJ.res]
5:[-X]
6:[-o]
7:[so.elf]
8:[-L/opt/gnuarm/lib/gcc/arm-none-eabi/7.1.0/thumb]
9:[-L/opt/gnuarm/lib/gcc/arm-none-eabi/7.1.0]
10:[-L/opt/gnuarm/lib/gcc/arm-none-eabi/7.1.0/../../../../arm-none-eabi/lib]
11:[-T]
12:[memmap]
13:[start.o]
14:[/tmp/ccrdRU2s.o]
15:[-lgcc]
the other approach
arm-none-eabi-gcc -O2 -c -mthumb so.c -o so.o
arm-none-eabi-ld -T memmap start.o so.o /opt/gnuarm/lib/gcc/arm-none-eabi/7.1.0/thumb/libgcc.a -o so.elf
but this is still broken
20000038 <__addsf3>:
20000038: e1b02080 lsls r2, r0, #1
2000003c: 11b03081 lslsne r3, r1, #1
20000040: 11320003 teqne r2, r3
20000044: 11f0cc42 mvnsne r12, r2, asr #24
20000048: 11f0cc43 mvnsne r12, r3, asr #24
2000004c: 0a000047 beq 20000170 <__addsf3+0x138>
20000050: e1a02c22 lsr r2, r2, #24
20000054: e0723c23 rsbs r3, r2, r3, lsr #24
I have not done the things I need to do to get the right library, have to run will re-edit this later...
But my proposed solution is:
.thumb_func
.globl __aeabi_fadd
__aeabi_fadd:
bx lr
I added to start.s for demonstration purposes
arm-none-eabi-as start.s -o start.o
arm-none-eabi-ld -T memmap start.o so.o -o so.elf
arm-none-eabi-objdump -D so.elf
Disassembly of section .text:
20000000 <_start>:
20000000: 20001000 andcs r1, r0, r0
20000004: 20000015 andcs r0, r0, r5, lsl r0
20000008: 20000019 andcs r0, r0, r9, lsl r0
2000000c: 20000019 andcs r0, r0, r9, lsl r0
20000010: 20000019 andcs r0, r0, r9, lsl r0
20000014 <reset>:
20000014: f000 f802 bl 2000001c <notmain>
20000018 <hang>:
20000018: e7fe b.n 20000018 <hang>
2000001a <__aeabi_fadd>:
2000001a: 4770 bx lr
2000001c <notmain>:
2000001c: b510 push {r4, lr}
2000001e: f7ff fffc bl 2000001a <__aeabi_fadd>
20000022: bc10 pop {r4}
20000024: bc02 pop {r1}
20000026: 4708 bx r1
then fill in whatever you want, clearly this is not a real program, broke many rules, there are no numbers being passed in, etc...
But the compiler generated __aeabi_fadd and I supplied an __aeabi_fadd and it was happy.
What I have done in the past, is, since I build my own gnu toolchain anyway, go in and put a syntax error in the file of interest, do the build, then the long command line used to build that item is now on the screen when it fails, isolate the function of interest, use the long command line for gcc as a guide, tweak and tune as desired...Get there faster than trying to figure out all the defines on your own in the code.

error when compiling telegram cli with cygwin

I followed the instruction in this page, but "cd tg && ./configure" command throws the following errors:
./configure: line 14: $'\r': command not found
./configure: line 29: syntax error near unexpected token `newline'
'/configure: line 29: ` ;;
no idea where should I look for the problem.

Resources