[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Does PGP build on big-endian systems?



[ Please don't Cc: public replies to me. ]

Thanks for the report.

Eric Delaunay:
> 1/ your method to detect between little/big-endian architectures fails because
>   debian/debian script isn't executable after I extracted sources using
>   dpkg-source.  You have to run chmod +x ... before running it.

Oops. I fixed that by running the script via sh, not directly by name.
No need for the chmod anymore.

> 2/ I guess this method will break in cross-compiling environment because the
>   test program will be of wrong architecture (built for target and not for
>   compilation platform).

It shouldn't. The program get-endian.c is:

	#include <endian.h>
	#include <stdio.h>
	
	int main(void) {
	#if __BYTE_ORDER == __LITTLE_ENDIAN
		printf("little-endian\n");
	#else
		printf("big-endian\n");
	#endif
		return 0;
	}

As far as I can tell, <endian.h> should define __BYTE_ORDER
based on the target architecture (it is defined conditionally
depending on which architecture-specific preprocessor symbol is
defined, and that symbol depends on the target architecture),
so the output should be correct for the target architecture,
even if it is run on the source one.

That's why I did it with a separate test program, of course;
otherwise it would have been simpler to add static tests to
the Makefile. I'd really rather not do that, since it is
inelegant, and requires modification every time a new big-endian
architecture needs to be supported.

Can someone confirm (by testing?) whether my assumption about
__BYTE_ORDER is correct?

> 3/ I cannot build pgp-us but it's merely because I don't have rsaref library 

I forgot to mention that you need that, too. Sorry. It's in the same
place, I hope.

-- 
Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me.
Please don't Cc: me when replying to my message on a mailing list.


Attachment: pgpFofGj2RQka.pgp
Description: PGP signature


Reply to: