无法编译 Brian Gladman aes 库

发布于 2024-10-12 16:55:50 字数 232 浏览 2 评论 0原文

我一直在从这里编译布莱恩·格莱德曼的图书馆 www.gladman.me.uk 我能够在本地计算机(ubuntu 10.10)上编译该库,但是当我尝试在远程计算机(CentOs 5.4)上编译时,它会使用 gcc 生成大量错误。

生成的错误是 此处

感谢您的建议 ..

I have been compiling brian gladman's library from here www.gladman.me.uk
I am able to compile the lib on my local machine(ubuntu 10.10) but when I try to compile on my remote machine(CentOs 5.4) it generates numerous errors with gcc ..

The error generated are here

thankx in adv ..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮云落日 2024-10-19 16:55:50

编译中的第一个错误是

brg_types.h:138:6: error: #error Please define uint_64t as an unsigned 64 bit type in brg_types.h

(之前只是可能指出问题的警告,但它们不会导致编译中断。)

问题是未定义 BRG_UI64,更具体地说是 uint_64t 类型。定义之前发生。下面的问题大部分是因为uint_64t没有定义而存在的,所以同样的原因。

本质上,它在不同的无符号类型中查找最大值为 18446744073709551615u 的第一个类型,即完整的无符号 64 位整数,并将其定义为 uint_64t。如果未找到类型,则使用 #error 引发上述错误。

因此,远程系统上的 UINT_MAX、ULONG_MAX、ULLONG_MAX 或 ULONG_LONG_MAX 似乎都不是 18446744073709551615 。

您可以使用一个简单的程序检查常量的值。

#include <limits.h>
#include <stdio.h>

int main()
{
  double d;

#if defined( UINT_MAX )
  d = UINT_MAX;
  printf("UINT_MAX is %f\n", d );
#if UINT_MAX == 18446744073709551615u
  printf("UINT_MAX satisfies condition\n");
#endif
#endif
#if defined( ULONG_MAX )
  d = ULONG_MAX;
  printf("ULONG_MAX is %f\n", d );
#if ULONG_MAX == 18446744073709551615ul
  printf("ULONG_MAX satisfies condition\n");
#endif
#endif
#if defined( ULLONG_MAX )
  d = ULLONG_MAX;
  printf("ULLONG_MAX is %f\n", d );
#if ULLONG_MAX == 18446744073709551615ull
  printf("ULLONG_MAX satisfies condition\n");
#endif
#endif
#if defined( ULONG_LONG_MAX )
  d = ULONG_LONG_MAX;
  printf("ULONG_LONG_MAX is %f\n", d );
#if ULONG_LONG_MAX == 18446744073709551615ull
  printf("ULONG_LONG_MAX satisfies condition\n");
#endif
#endif

  return 0;
}

在我的系统上(也许在您的系统上)有多个版本的limits.h和climits(包含在一些c++-includes中)。 找到它们

find /usr/include -name '*limits*'

您可以通过“我无法帮助您移植库” 。如果您不知道自己在做什么,我认为自己定义类型不是一个好主意(尽管具有更大最大值的无符号整数类型可能会起作用)。

如果其他编译器不能为您解决问题,最好联系作者寻求修复。

这些常量取决于系统和编译器。因此,它在本地计算机上工作但在远程计算机上不起作用的原因可能是:

  • 一台是 32 位计算机,另一台是 64 位
  • 不同版本的 gcc
  • Ubuntu 和 CentOS 安装了不同的 limit.h

以下是这些计算机的代码谁可能比我更了解那些依赖于平台的东西。

#include <limits.h>
...
#ifndef BRG_UI64
#  if defined( __BORLANDC__ ) && !defined( __MSDOS__ )
#    define BRG_UI64
#    define li_64(h) 0x##h##ui64
     typedef unsigned __int64 uint_64t;
#  elif defined( _MSC_VER ) && ( _MSC_VER < 1300 )    /* 1300 == VC++ 7.0 */
#    define BRG_UI64
#    define li_64(h) 0x##h##ui64
     typedef unsigned __int64 uint_64t;
#  elif defined( __sun ) && defined( ULONG_MAX ) && ULONG_MAX == 0xfffffffful
#    define BRG_UI64
#    define li_64(h) 0x##h##ull
     typedef unsigned long long uint_64t;
#  elif defined( __MVS__ )
#    define BRG_UI64
#    define li_64(h) 0x##h##ull
     typedef unsigned int long long uint_64t;
#  elif defined( UINT_MAX ) && UINT_MAX > 4294967295u
#    if UINT_MAX == 18446744073709551615u
#      define BRG_UI64
#      define li_64(h) 0x##h##u
       typedef unsigned int uint_64t;
#    endif
#  elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u
#    if ULONG_MAX == 18446744073709551615ul
#      define BRG_UI64
#      define li_64(h) 0x##h##ul
       typedef unsigned long uint_64t;
#    endif
#  elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u
#    if ULLONG_MAX == 18446744073709551615ull
#      define BRG_UI64
#      define li_64(h) 0x##h##ull
       typedef unsigned long long uint_64t;
#    endif
#  elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u
#    if ULONG_LONG_MAX == 18446744073709551615ull
#      define BRG_UI64
#      define li_64(h) 0x##h##ull
       typedef unsigned long long uint_64t;
#    endif
#  endif
#endif

The first error in your compilation is

brg_types.h:138:6: error: #error Please define uint_64t as an unsigned 64 bit type in brg_types.h

(before are only warnings which might point to problems, but they don't cause your compile to break.)

The problem there is that BRG_UI64 was not defined, more specifically the type uint_64t. The definition takes place previously. Most of the following problems exist because uint_64t is not defined, so the same reason.

Essentially it looks among different unsigned types for the first that has a max value of 18446744073709551615u, i.e. a complete unsigned 64bit integer and defines that as uint_64t. If no type is found the above error is raised by using #error.

So it seems neither of UINT_MAX, ULONG_MAX, ULLONG_MAX or ULONG_LONG_MAX is 18446744073709551615 on your remote system.

You can check the values of your constants with a simple program

#include <limits.h>
#include <stdio.h>

int main()
{
  double d;

#if defined( UINT_MAX )
  d = UINT_MAX;
  printf("UINT_MAX is %f\n", d );
#if UINT_MAX == 18446744073709551615u
  printf("UINT_MAX satisfies condition\n");
#endif
#endif
#if defined( ULONG_MAX )
  d = ULONG_MAX;
  printf("ULONG_MAX is %f\n", d );
#if ULONG_MAX == 18446744073709551615ul
  printf("ULONG_MAX satisfies condition\n");
#endif
#endif
#if defined( ULLONG_MAX )
  d = ULLONG_MAX;
  printf("ULLONG_MAX is %f\n", d );
#if ULLONG_MAX == 18446744073709551615ull
  printf("ULLONG_MAX satisfies condition\n");
#endif
#endif
#if defined( ULONG_LONG_MAX )
  d = ULONG_LONG_MAX;
  printf("ULONG_LONG_MAX is %f\n", d );
#if ULONG_LONG_MAX == 18446744073709551615ull
  printf("ULONG_LONG_MAX satisfies condition\n");
#endif
#endif

  return 0;
}

There are several versions of limits.h and climits (which is included by some of the c++-includes) on my system (and perhaps on yours as well). You can find them with

find /usr/include -name '*limits*'

I can't help you porting the library anyway. I don't think defining a type on your own is a good idea if you don't know what you are doing (though an unsigned integer type with a bigger max value might work).

If a different compiler doesn't solve the problem for you it is probably best if you contact the author for a fix.

Those constants are system and compiler-dependent. So reasons why it works on your local, but not on the remote machine might be:

  • One is a 32-bit machine, the other 64-bit
  • Different version of gcc
  • Ubuntu and CentOS install a different limit.h

Here is the code for those who might have more insight into those platform dependent stuff than me.

#include <limits.h>
...
#ifndef BRG_UI64
#  if defined( __BORLANDC__ ) && !defined( __MSDOS__ )
#    define BRG_UI64
#    define li_64(h) 0x##h##ui64
     typedef unsigned __int64 uint_64t;
#  elif defined( _MSC_VER ) && ( _MSC_VER < 1300 )    /* 1300 == VC++ 7.0 */
#    define BRG_UI64
#    define li_64(h) 0x##h##ui64
     typedef unsigned __int64 uint_64t;
#  elif defined( __sun ) && defined( ULONG_MAX ) && ULONG_MAX == 0xfffffffful
#    define BRG_UI64
#    define li_64(h) 0x##h##ull
     typedef unsigned long long uint_64t;
#  elif defined( __MVS__ )
#    define BRG_UI64
#    define li_64(h) 0x##h##ull
     typedef unsigned int long long uint_64t;
#  elif defined( UINT_MAX ) && UINT_MAX > 4294967295u
#    if UINT_MAX == 18446744073709551615u
#      define BRG_UI64
#      define li_64(h) 0x##h##u
       typedef unsigned int uint_64t;
#    endif
#  elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u
#    if ULONG_MAX == 18446744073709551615ul
#      define BRG_UI64
#      define li_64(h) 0x##h##ul
       typedef unsigned long uint_64t;
#    endif
#  elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u
#    if ULLONG_MAX == 18446744073709551615ull
#      define BRG_UI64
#      define li_64(h) 0x##h##ull
       typedef unsigned long long uint_64t;
#    endif
#  elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u
#    if ULONG_LONG_MAX == 18446744073709551615ull
#      define BRG_UI64
#      define li_64(h) 0x##h##ull
       typedef unsigned long long uint_64t;
#    endif
#  endif
#endif
请别遗忘我 2024-10-19 16:55:50

第一个错误位于 brg_types.hat 第 138 行;

brg_types.h:138:6: error: #error Please define uint_64t as an unsigned 64 bit type in brg_types.h

我在此处找到了该文件的在线副本(可能是不同的版本)。因此,您需要了解如何创建 64 位无符号整数,并在该行上方添加一些定义,例如

#define BRG_UI64
#define li_64(h) 0x##h##ull
typedef unsigned long long uint_64t;

,如果 unsigned long long 是 64 位,并且您输入诸如 0x123456789ull 之类的文字数字代码>.

看起来需要更多的移植才能在编译器上编译它。

The first error is on brg_types.hat line 138;

brg_types.h:138:6: error: #error Please define uint_64t as an unsigned 64 bit type in brg_types.h

I found here a online copy of that file (maybe a different version). So you need to find how to create a 64 bit unsigned integer, and add some defines above that line, for example

#define BRG_UI64
#define li_64(h) 0x##h##ull
typedef unsigned long long uint_64t;

if unsigned long long is 64 bit and you enter literal numbers like 0x123456789ull.

And it looks like there will be more porting required to compile this on your compiler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文