解决uos上面编译的版本不能在kylin上运行的问题

This commit is contained in:
luoliangyi 2022-10-24 22:48:17 +08:00
parent 9057709fa0
commit 45478b92b8
4 changed files with 147 additions and 7 deletions

View File

@ -505,6 +505,10 @@
</Compiler>
<Linker>
<Add option="-Wl,--exclude-libs,ALL" />
<Add option="-Wl,--wrap=log2f" />
<Add option="-Wl,--wrap=logf" />
<Add option="-Wl,--wrap=expf" />
<Add option="-Wl,--wrap=powf" />
<Add option="-z defs" />
<Add option="-B direct" />
<Add option="-static-libgcc" />
@ -521,10 +525,10 @@
<Unit filename="../../../modules/imgproc/HGOCRBase.hpp" />
<Unit filename="../../../modules/imgproc/HGOCRHanvon.cpp" />
<Unit filename="../../../modules/imgproc/HGOCRHanvon.hpp" />
<Unit filename="../../../modules/imgproc/HGOCRTesseract.cpp" />
<Unit filename="../../../modules/imgproc/HGOCRTesseract.hpp" />
<Unit filename="../../../modules/imgproc/HGOCRRetImpl.cpp" />
<Unit filename="../../../modules/imgproc/HGOCRRetImpl.hpp" />
<Unit filename="../../../modules/imgproc/HGOCRTesseract.cpp" />
<Unit filename="../../../modules/imgproc/HGOCRTesseract.hpp" />
<Unit filename="../../../modules/imgproc/ImageProcess/ImageApply.cpp" />
<Unit filename="../../../modules/imgproc/ImageProcess/ImageApply.h" />
<Unit filename="../../../modules/imgproc/ImageProcess/ImageApplyAdjustColors.cpp" />

View File

@ -379,6 +379,7 @@
<Add directory="../../../../sdk/include" />
</Compiler>
<Linker>
<Add option="-Wl,--wrap=fcntl64" />
<Add option="-lpthread" />
<Add option="-ldl" />
<Add option="-static-libgcc" />

View File

@ -14,6 +14,34 @@
#include "../base/HGInc.h"
#include "../base/HGUtility.h"
#if !defined(HG_CMP_MSC)
extern "C" float __wrap_log2f(float f)
{
asm(".symver log2f, log2f@GLIBC_2.2.5");
return log2f(f);
}
extern "C" float __wrap_logf(float f)
{
asm(".symver logf, logf@GLIBC_2.2.5");
return logf(f);
}
extern "C" float __wrap_expf(float f)
{
asm(".symver expf, expf@GLIBC_2.2.5");
return expf(f);
}
extern "C" float __wrap_powf(float f, float g)
{
asm(".symver powf, powf@GLIBC_2.2.5");
return powf(f, g);
}
#endif
HGResult HGAPI HGImgProc_ResizeImage(HGImage image, HGImage destImage, HGUInt interp)
{
if (NULL == image || NULL == destImage || image == destImage)
@ -754,7 +782,7 @@ HGResult HGAPI HGImgProc_ImageColorRecognition(HGImage image, HGUInt* colorType)
if (HGBASE_IMGTYPE_GRAY == imgInfo.type)
{
*colorType = HGIMGPROC_COLORTYPE_BINARY;
for (HGUInt h = 0; h < roiHeight; ++h)
{
for (HGUInt w = 0; w < roiWidth; ++w)
@ -794,7 +822,7 @@ HGResult HGAPI HGImgProc_ImageColorRecognition(HGImage image, HGUInt* colorType)
else if (CImageApplyColorRecognition::Mono == colorType2)
*colorType = HGIMGPROC_COLORTYPE_BINARY;
}
return HGBASE_ERR_OK;
}
@ -1420,7 +1448,7 @@ HGResult HGAPI HGImgProc_ImageDecontamination(HGImage image, HGImage destImage,
p = data + (HGUSize)(imgInfo.height - roi.top - 1) * (HGUSize)imgInfo.widthStep + roi.left * channels;
step = -(HGInt)imgInfo.widthStep;
}
if (HGBASE_IMGTYPE_RGB == imgInfo.type || HGBASE_IMGTYPE_RGBA == imgInfo.type
|| HGBASE_IMGTYPE_BGR == imgInfo.type || HGBASE_IMGTYPE_BGRA == imgInfo.type)
{
@ -1462,7 +1490,7 @@ HGResult HGAPI HGImgProc_ImageDecontamination(HGImage image, HGImage destImage,
HGByte* pEx2 = pEx + j * channels;
if ((j >= (int32_t)x && j < (int32_t)(x + width)) && (i >= (int32_t)y && i < (int32_t)(y + height)))
{
}
else
{

View File

@ -13,6 +13,113 @@
#include "MsgPumpCallback.h"
#include "curl/curl.h"
#if !defined(HG_CMP_MSC)
asm (".symver fcntl64, fcntl@GLIBC_2.2.5");
extern "C" int __wrap_fcntl64(int fd, int cmd, ...)
{
int result;
va_list va;
va_start(va, cmd);
switch (cmd) {
//
// File descriptor flags
//
case F_GETFD: goto takes_void;
case F_SETFD: goto takes_int;
// File status flags
//
case F_GETFL: goto takes_void;
case F_SETFL: goto takes_int;
// File byte range locking, not held across fork() or clone()
//
case F_SETLK: goto takes_flock_ptr_INCOMPATIBLE;
case F_SETLKW: goto takes_flock_ptr_INCOMPATIBLE;
case F_GETLK: goto takes_flock_ptr_INCOMPATIBLE;
// File byte range locking, held across fork()/clone() -- Not POSIX
//
case F_OFD_SETLK: goto takes_flock_ptr_INCOMPATIBLE;
case F_OFD_SETLKW: goto takes_flock_ptr_INCOMPATIBLE;
case F_OFD_GETLK: goto takes_flock_ptr_INCOMPATIBLE;
// Managing I/O availability signals
//
case F_GETOWN: goto takes_void;
case F_SETOWN: goto takes_int;
case F_GETOWN_EX: goto takes_f_owner_ex_ptr;
case F_SETOWN_EX: goto takes_f_owner_ex_ptr;
case F_GETSIG: goto takes_void;
case F_SETSIG: goto takes_int;
// Notified when process tries to open or truncate file (Linux 2.4+)
//
case F_SETLEASE: goto takes_int;
case F_GETLEASE: goto takes_void;
// File and directory change notification
//
case F_NOTIFY: goto takes_int;
// Changing pipe capacity (Linux 2.6.35+)
//
case F_SETPIPE_SZ: goto takes_int;
case F_GETPIPE_SZ: goto takes_void;
// File sealing (Linux 3.17+)
//
case F_ADD_SEALS: goto takes_int;
case F_GET_SEALS: goto takes_void;
// File read/write hints (Linux 4.13+)
//
case F_GET_RW_HINT: goto takes_uint64_t_ptr;
case F_SET_RW_HINT: goto takes_uint64_t_ptr;
case F_GET_FILE_RW_HINT: goto takes_uint64_t_ptr;
case F_SET_FILE_RW_HINT: goto takes_uint64_t_ptr;
default:
fprintf(stderr, "fcntl64 workaround got unknown F_XXX constant");
}
takes_void:
va_end(va);
return fcntl64(fd, cmd);
takes_int:
result = fcntl64(fd, cmd, va_arg(va, int));
va_end(va);
return result;
takes_flock_ptr_INCOMPATIBLE:
//
// !!! This is the breaking case: the size of the flock
// structure changed to accommodate larger files. If you
// need this, you'll have to define a compatibility struct
// with the older glibc and make your own entry point using it,
// then call fcntl64() with it directly (bear in mind that has
// been remapped to the old fcntl())
//
fprintf(stderr, "fcntl64 hack can't use glibc flock directly");
exit(1);
takes_f_owner_ex_ptr:
result = fcntl64(fd, cmd, va_arg(va, struct f_owner_ex*));
va_end(va);
return result;
takes_uint64_t_ptr:
result = fcntl64(fd, cmd, va_arg(va, uint64_t*));
va_end(va);
return result;
}
#endif
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
{
HGChar logPath[256];
@ -99,4 +206,4 @@ int main()
WSACleanup();
#endif
return 0;
}
}