ICU Version for Ubuntu arm64.
This commit is contained in:
@@ -11,3 +11,5 @@ react/package-lock.json
|
|||||||
|
|
||||||
src/dbus/bluez_adaptor.h
|
src/dbus/bluez_adaptor.h
|
||||||
src/dbus/bluez_proxy.h
|
src/dbus/bluez_proxy.h
|
||||||
|
|
||||||
|
CMakeFiles
|
||||||
@@ -658,9 +658,6 @@ add_executable(pipedalconfig
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(pipedalconfig PRIVATE PiPedalCommon pthread atomic uuid stdc++fs asound
|
target_link_libraries(pipedalconfig PRIVATE PiPedalCommon pthread atomic uuid stdc++fs asound
|
||||||
icui18n
|
|
||||||
icuuc
|
|
||||||
icudata
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+63
-12
@@ -34,6 +34,7 @@
|
|||||||
#include "ss.hpp"
|
#include "ss.hpp"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "Utf8Utils.hpp"
|
#include "Utf8Utils.hpp"
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#define U_SHOW_CPLUSPLUS_API 0
|
#define U_SHOW_CPLUSPLUS_API 0
|
||||||
|
|
||||||
@@ -50,9 +51,46 @@
|
|||||||
|
|
||||||
using namespace pipedal;
|
using namespace pipedal;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
static inline bool isDigit(char c)
|
||||||
|
{
|
||||||
|
return c >= '0' && c <= '9';
|
||||||
|
}
|
||||||
|
static bool getSoVersionNumber(const std::string&fileName, int *version)
|
||||||
|
{
|
||||||
|
auto fnamePos = fileName.find_last_of('/');
|
||||||
|
if (fnamePos == std::string::npos)
|
||||||
|
{
|
||||||
|
fnamePos = 0;
|
||||||
|
}
|
||||||
|
auto extensionPos = fileName.find(".so.",fnamePos);
|
||||||
|
if (extensionPos == std::string::npos)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *p = fileName.c_str() + extensionPos + 4;
|
||||||
|
|
||||||
|
if (!isDigit(*p)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int n = 0;
|
||||||
|
while (isDigit(*p))
|
||||||
|
{
|
||||||
|
n = n*10 + *p-'0';
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
if (*p != '\0' && *p != '.')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*version = n;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// Function to get ICU version dynamically
|
// Function to get ICU version dynamically
|
||||||
int getICUVersion(void* libHandle) {
|
static int getICUVersion(void* libHandle) {
|
||||||
|
|
||||||
// pares the dlerror to get the version number. :-/
|
// pares the dlerror to get the version number. :-/
|
||||||
dlerror(); // clear the error.
|
dlerror(); // clear the error.
|
||||||
@@ -61,22 +99,35 @@ int getICUVersion(void* libHandle) {
|
|||||||
std::string error = dlerror();
|
std::string error = dlerror();
|
||||||
// "/lib/aarch64-linux-gnu/libicui18n.so.74: undefined symbol: nonExistentFunction"
|
// "/lib/aarch64-linux-gnu/libicui18n.so.74: undefined symbol: nonExistentFunction"
|
||||||
|
|
||||||
auto nPos = error.find(".so.");
|
auto nPos = error.find(":");
|
||||||
if (nPos == std::string::npos)
|
if (nPos == std::string::npos)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unable to determine version of libicui18n.so");
|
return false;
|
||||||
}
|
}
|
||||||
const char *p = error.c_str() + nPos + 4;
|
std::string fileName = error.substr(nPos);
|
||||||
|
|
||||||
int version = 0;
|
int version = -1;
|
||||||
while (*p >= '0' && *p <= '9')
|
|
||||||
|
if (!getSoVersionNumber(fileName,&version))
|
||||||
{
|
{
|
||||||
version = version*10 + *p-'0';
|
fs::path basePath = fileName;
|
||||||
++p;
|
fs::path parentDirectory = basePath.parent_path();
|
||||||
}
|
auto fileName = basePath.filename().string();
|
||||||
if (*p != ':' && *p != '.')
|
for (auto&entry: fs::directory_iterator(parentDirectory))
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unable to determine version of libicui18n.so");
|
if (entry. path().filename().string().starts_with(fileName))
|
||||||
|
{
|
||||||
|
if (getSoVersionNumber(entry.path().string(),&version))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version == -1)
|
||||||
|
{
|
||||||
|
throw std::runtime_error(SS("Unable to determine libicui18n.so version: " << error));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ Restart=on-failure
|
|||||||
Type=notify
|
Type=notify
|
||||||
LimitMEMLOCK=infinity
|
LimitMEMLOCK=infinity
|
||||||
LimitRTPRIO=95
|
LimitRTPRIO=95
|
||||||
|
Nice=-9
|
||||||
ExecStart=${COMMAND}
|
ExecStart=${COMMAND}
|
||||||
User=pipedal_d
|
User=pipedal_d
|
||||||
Group=pipedal_d
|
Group=pipedal_d
|
||||||
|
|||||||
Reference in New Issue
Block a user