• 编译libkml-1.3.0报错:minizip/crypt.h:没有那个文件或目录


    完整的报错信息如下:/root/libkml-1.3.0/src/kml/base/contrib/minizip/unzip.c:183:10: 致命错误:minizip/crypt.h:没有那个文件或目录
     #include
              ^~~~~~~~~~~~~~~~~
    编译中断。

    原因分析:yum install minizip-devel,如果安装的是minizip-devel-1.2.7-21.el7_9.aarch64,则不存在这个问题。如果安装的是minizip-devel-1.2.11-18.ky10.aarch64,则/usr/include/minizip路径下缺失crypt.h。

    解决办法,新建一个crypt.h,输入以下内容,然后复制到usr/include/minizip路径下

    1. /* crypt.h -- base code for crypt/uncrypt ZIPfile
    2. Version 1.01e, February 12th, 2005
    3. Copyright (C) 1998-2005 Gilles Vollant
    4. This code is a modified version of crypting code in Infozip distribution
    5. The encryption/decryption parts of this source code (as opposed to the
    6. non-echoing password parts) were originally written in Europe. The
    7. whole source package can be freely distributed, including from the USA.
    8. (Prior to January 2000, re-export from the US was a violation of US law.)
    9. This encryption code is a direct transcription of the algorithm from
    10. Roger Schlafly, described by Phil Katz in the file appnote.txt. This
    11. file (appnote.txt) is distributed with the PKZIP program (even in the
    12. version without encryption capabilities).
    13. If you don't need crypting in your application, just define symbols
    14. NOCRYPT and NOUNCRYPT.
    15. This code support the "Traditional PKWARE Encryption".
    16. The new AES encryption added on Zip format by Winzip (see the page
    17. http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
    18. Encryption is not supported.
    19. */
    20. #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
    21. /***********************************************************************
    22. * Return the next byte in the pseudo-random sequence
    23. */
    24. static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
    25. {
    26. unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
    27. * unpredictable manner on 16-bit systems; not a problem
    28. * with any known compiler so far, though */
    29. temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
    30. return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
    31. }
    32. /***********************************************************************
    33. * Update the encryption keys with the next byte of plain text
    34. */
    35. static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
    36. {
    37. (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
    38. (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
    39. (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
    40. {
    41. register int keyshift = (int)((*(pkeys+1)) >> 24);
    42. (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
    43. }
    44. return c;
    45. }
    46. /***********************************************************************
    47. * Initialize the encryption keys and the random header according to
    48. * the given password.
    49. */
    50. static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
    51. {
    52. *(pkeys+0) = 305419896L;
    53. *(pkeys+1) = 591751049L;
    54. *(pkeys+2) = 878082192L;
    55. while (*passwd != '\0') {
    56. update_keys(pkeys,pcrc_32_tab,(int)*passwd);
    57. passwd++;
    58. }
    59. }
    60. #define zdecode(pkeys,pcrc_32_tab,c) \
    61. (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
    62. #define zencode(pkeys,pcrc_32_tab,c,t) \
    63. (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
    64. #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
    65. #define RAND_HEAD_LEN 12
    66. /* "last resort" source for second part of crypt seed pattern */
    67. # ifndef ZCR_SEED2
    68. # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
    69. # endif
    70. static int crypthead(const char* passwd, /* password string */
    71. unsigned char* buf, /* where to write header */
    72. int bufSize,
    73. unsigned long* pkeys,
    74. const z_crc_t* pcrc_32_tab,
    75. unsigned long crcForCrypting)
    76. {
    77. int n; /* index in random header */
    78. int t; /* temporary */
    79. int c; /* random byte */
    80. unsigned char header[RAND_HEAD_LEN-2]; /* random header */
    81. static unsigned calls = 0; /* ensure different random header each time */
    82. if (bufSize
    83. return 0;
    84. /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
    85. * output of rand() to get less predictability, since rand() is
    86. * often poorly implemented.
    87. */
    88. if (++calls == 1)
    89. {
    90. srand((unsigned)(time(NULL) ^ ZCR_SEED2));
    91. }
    92. init_keys(passwd, pkeys, pcrc_32_tab);
    93. for (n = 0; n < RAND_HEAD_LEN-2; n++)
    94. {
    95. c = (rand() >> 7) & 0xff;
    96. header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
    97. }
    98. /* Encrypt random header (last two bytes is high word of crc) */
    99. init_keys(passwd, pkeys, pcrc_32_tab);
    100. for (n = 0; n < RAND_HEAD_LEN-2; n++)
    101. {
    102. buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
    103. }
    104. buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
    105. buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
    106. return n;
    107. }
    108. #endif

  • 相关阅读:
    Qt编写物联网管理平台37-逻辑设计
    2022年11月7日--11月13日(ue4 tf视频教程+cesium for ue源码抄写)
    Qt作业九
    微信小程序连接云数据库基本使用
    【Unity】【VRTK】【VR开发】同时保持高效打包和调试的VRTK项目设置方式
    Ansible之playbook详解和应用实例
    Python的requests库:解决文档缺失问题的策略与实践
    文档在线预览(五)在服务器部署组件来实现在线预览
    ETL基本介绍【博学谷学习记录】
    前端食堂技术周刊第 100 期:TS 5.3 Beta、ViteConf2023、Rspress 1.0、Fresh 1.5、Chrome 118
  • 原文地址:https://blog.csdn.net/mj412828668/article/details/136747216