Mac GridLabD installation error at % make -j8 - ios

I am trying to build GridLabD on my mac, but get a range or warnings and errors at the step "% make -j8". It is a long log, but below is how it starts (couldn't find gridlabd tag). I followed steps in Is it possible to run GridLab-D on macOS Catalina?, but got the same error at the "make" command. I appreciate any help.
% make -j8
/bin/bash -c "source utilities/build_number . gldcore/build.h"
Updating gldcore/build.h: revision 19053 (d7f83006:develop:Mod)
/Users/hei06j/Documents/repositories/remote/gridlab-d
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
CXX gldcore/gridlabd-convert.o
CC gldcore/gridlabd-instance_slave.o
CC gldcore/gridlabd-interpolate.o
CXX gldcore/gridlabd-job.o
CC gldcore/gridlabd-kml.o
CC gldcore/gridlabd-legal.o
CC gldcore/gridlabd-linkage.o
CXX gldcore/gridlabd-link.o
CC gldcore/gridlabd-load.o
CC gldcore/gridlabd-loadshape.o
CXX gldcore/gridlabd-load_xml.o
CXX gldcore/gridlabd-load_xml_handle.o
CC gldcore/gridlabd-local.o
CXX gldcore/gridlabd-lock.o
CC gldcore/gridlabd-main.o
CC gldcore/gridlabd-match.o
CC gldcore/gridlabd-matlab.o
CC gldcore/gridlabd-module.o
CC gldcore/gridlabd-object.o
CC gldcore/gridlabd-output.o
CC gldcore/gridlabd-property.o
CC gldcore/gridlabd-random.o
CC gldcore/gridlabd-realtime.o
CXX gldcore/gridlabd-sanitize.o
CC gldcore/gridlabd-save.o
CC gldcore/gridlabd-schedule.o
CC gldcore/gridlabd-server.o
CXX gldcore/gridlabd-setup.o
In file included from gldcore/load_xml.cpp:15:
In file included from ./gldcore/platform.h:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:309:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:420:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
./version:1:3: error: invalid preprocessing directive
# $Id: VERSION 858 2008-08-28 21:06:13Z d3g637 $
^
./version:2:1: error: C++ requires a type specifier for all declarations
MAJOR=3
^
./version:2:8: error: expected ';' after top level declarator
MAJOR=3
^
In file included from gldcore/convert.cpp:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:309:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:420:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
./version:1:3: error: invalid preprocessing directive
# $Id: VERSION 858 2008-08-28 21:06:13Z d3g637 $
^
./version:2:1: error: C++ requires a type specifier for all declarations
MAJOR=3
^
In file included from gldcore/load_xml_handle.cpp:18:
In file included from ./gldcore/platform.h:57:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:309:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:420:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
./version:./version1::32:: 8: error: error: invalid preprocessing directive
expected ';' after top level declarator
MAJOR=3
^
# $Id: VERSION 858 2008-08-28 21:06:13Z d3g637 $
^
./version:2:1: error: C++ requires a type specifier for all declarations
MAJOR=3
^
./version:2:8: error: expected ';' after top level declarator
MAJOR=3
^
In file included from gldcore/setup.cpp:4:
In file included from ./gldcore/gridlabd.h:91:
In file included from ./gldcore/platform.h:57:
In file included from
...

Related

qemu-irix fails to build under Alpine 3.10 (GCC 8.3)

Just for fun, I'm attempting to build the irixxxx's qemu-irix as a Docker image.
It builds successfuly under Debian Buster (using GCC 8 container). However, it fails to build under Alpine 3.10 (it fails only when I selected the Irix targets), with the following errors (at the make stage):
CC util/oslib-posix.o
In file included from util/oslib-posix.c:39:
/usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to <signal.h> [-Wcpp]
#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
^~~~~~~
CC util/qemu-openpty.o
util/qemu-openpty.c: In function 'qemu_openpty_raw':
util/qemu-openpty.c:123:9: warning: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration]
if (openpty(&amaster, aslave, pty_buf, NULL, NULL) < 0) {
^~~~~~~
openat
util/qemu-openpty.c:123:9: warning: nested extern declaration of 'openpty' [-Wnested-externs]
(...)
CC irix-linux-user/linux-user/syscall.o
/qemu-irix/linux-user/syscall.c:6784:22: error: 'F_EXLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_EXLCK),
^~~~~~~
/qemu-irix/linux-user/syscall.c:6779:51: note: in definition of macro 'TRANSTBL_CONVERT'
#define TRANSTBL_CONVERT(a) { -1, TARGET_##a, -1, a }
^
/qemu-irix/linux-user/syscall.c:6785:22: error: 'F_SHLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_SHLCK),
^~~~~~~
/qemu-irix/linux-user/syscall.c:6779:51: note: in definition of macro 'TRANSTBL_CONVERT'
#define TRANSTBL_CONVERT(a) { -1, TARGET_##a, -1, a }
^
In file included from /qemu-irix/linux-user/syscall.c:121:
/qemu-irix/linux-user/syscall.c: In function 'target_to_host_sigevent':
/qemu-irix/linux-user/syscall.c:7422:27: error: 'struct sigevent' has no member named '_sigev_un'; did you mean 'sigev_value'?
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~
/qemu-irix/linux-user/qemu.h:501:5: note: in definition of macro '__get_user_e'
((x) = (typeof(*hptr))( \
^
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/syscall.c:7422:36: error: '(const bitmask_transtbl *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^
/qemu-irix/linux-user/qemu.h:501:5: note: in definition of macro '__get_user_e'
((x) = (typeof(*hptr))( \
^
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/qemu.h:506:13: warning: left-hand operand of comma expression has no effect [-Wunused-value]
(hptr)), (void)0)
^
/qemu-irix/linux-user/qemu.h:510:31: note: in expansion of macro '__get_user_e'
# define __get_user(x, hptr) __get_user_e(x, hptr, be)
^~~~~~~~~~~~
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/syscall.c: In function 'do_syscall':
/qemu-irix/linux-user/syscall.c:13545:25: warning: implicit declaration of function 'sethostid'; did you mean 'gethostid'? [-Wimplicit-function-declaration]
ret = get_errno(sethostid(arg1));
^~~~~~~~~
gethostid
/qemu-irix/linux-user/syscall.c:13545:25: warning: nested extern declaration of 'sethostid' [-Wnested-externs]
make[1]: *** [/qemu-irix/rules.mak:66: linux-user/syscall.o] Error 1
make: *** [Makefile:472: subdir-irix-linux-user] Error 2
The command '/bin/sh -c make && DESTDIR=/tmp/qemu make install' returned a non-zero code: 2
I researched about the differences between Debian's and Alpine's GCC (in fact, libc6 and musl) about similar failures, but I haven't found any information about how to solve this without modifying the code.
So, where can I find more information about this issue and which packages may solve it? Thanks.
Dockerfiles and full log here. Docker container image (Debian Buster) here.
The difference seems to be caused by the underlying libc implementations: glibc of Debian, vs musl-libc of Alpine.
While GNU libc is the defacto standard libc implementation in Linux, musl libc is used by a handful of distributions, such as Alpine Linux and Void Linux. musl is a minimalistic strict-POSIX libc implementation, and is generally not compatible with glibc. Usually, software projects have to be ported to musl libc to be supported on Alpine, especially non trivial applications.
The compilation of syscall.c breaks on several places, the first being:
/qemu-irix/linux-user/syscall.c:6784:22: error: 'F_EXLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_EXLCK)
The F_EXLCK is macro is not defined in musl libc's fcntl.h. However, it could be easily patched by defining it manually, for example with make CFLAGS='"-DF_EXLCK=4"'. This is how qemu is patched for musl for non-irix targets (patch link).
However, there are more undefined macros down the road, such as __SIGRTMIN and __SIGRTMAX, the macro TRANSTBL_CONVERT, and probably others. Patching them ad-hoc may not be enough - so it appears to be that the qemu-irix project has to be properly ported for Alpine and musl libc.
If you're willing, you could try following existing qemu musl patches, and attempt to patch it yourself for qemu-irix:
- https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg04773.html
- https://github.com/NixOS/nixpkgs/pull/46449/files
Off topic comment, use make -j to build parallely, which will end much faster.

Architecture not supported error when installing OpenSSL on OS X

rbenv-2.6.5 is attempting to install openssl-1.1.1d and that's where the architecture error comes, I have no direct access to the Makefile:
$ rbenv install 2.6.5
Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...
BUILD FAILED (OS X 10.15.1 using ruby-build 20191124)
Inspect or clean up the working tree at /var/folders/8s/8mw7vg315l7dr9vyfxmv9vk80000gn/T/ruby-build.20191126132843.6027.Z0Hvfg
Results logged to /var/folders/8s/8mw7vg315l7dr9vyfxmv9vk80000gn/T/ruby-build.20191126132843.6027.log
Last 10 log lines:
In file included from include/openssl/e_os2.h:243:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/inttypes.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/inttypes.h:227:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types/_wchar_t.h:34:9: error: unknown type name '__darwin_wchar_t'
typedef __darwin_wchar_t wchar_t;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [apps/app_rand.o] Error 1
make: *** [all] Error 2
Complete log:
$ cat /var/folders/8s/8mw7vg315l7dr9vyfxmv9vk80000gn/T/ruby-build.20191126132843.6027.log
/var/folders/8s/8mw7vg315l7dr9vyfxmv9vk80000gn/T/ruby-build.20191126132843.6027.Z0Hvfg ~/Developer/ReactNativeApp/ios
HTTP/1.1 200 OK
Content-Type: binary/octet-stream
Content-Length: 8845861
Connection: keep-alive
Date: Tue, 26 Nov 2019 09:50:32 GMT
Last-Modified: Tue, 01 Oct 2019 21:38:26 GMT
ETag: "3be209000dbc7e1b95bcdf47980a3baa"
Accept-Ranges: bytes
Server: AmazonS3
X-Cache: Hit from cloudfront
Via: 1.1 e56e6732f380db727425bac2d6158761.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: FRA2-C2
X-Amz-Cf-Id: Hw-jhD36n4Jk8CezqbAuFTzudNo4qopXkdH3CaxRXUHbadZgf9Z6xA==
Age: 9492
/var/folders/8s/8mw7vg315l7dr9vyfxmv9vk80000gn/T/ruby-build.20191126132843.6027.Z0Hvfg/openssl-1.1.1d /var/folders/8s/8mw7vg315l7dr9vyfxmv9vk80000gn/T/ruby-build.20191126132843.6027.Z0Hvfg ~/Developer/ReactNativeApp/ios
Operating system: x86_64-apple-darwinDarwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64
Configuring OpenSSL version 1.1.1d (0x1010104fL) for darwin64-x86_64-cc
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
WARNING! If you wish to build 32-bit libraries, then you have to
invoke 'KERNEL_BITS=32 ./config '--prefix=/Users/User/.rbenv/versions/2.6.5/openssl' '--openssldir=/Users/User/.rbenv/versions/2.6.5/openssl/ssl' 'zlib-dynamic' 'no-ssl3' 'shared''.
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
"-oMakefile" crypto/include/internal/bn_conf.h.in > crypto/include/internal/bn_conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
"-oMakefile" crypto/include/internal/dso_conf.h.in > crypto/include/internal/dso_conf.h
/usr/bin/perl "-I." -Mconfigdata "util/dofile.pl" \
"-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
make depend && make _all
clang -I. -Iinclude -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/User/.rbenv/versions/2.6.5/openssl/ssl\"" -DENGINESDIR="\"/Users/User/.rbenv/versions/2.6.5/openssl/lib/engines-1.1\"" -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/Users/User/.rbenv/versions/2.6.5/include -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/limits.h:37:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/limits.h:63:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/limits.h:37:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/limits.h:64:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/machine/limits.h:8:2: error: architecture not supported
#error architecture not supported
^
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/inttypes.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/inttypes.h:226:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/_types.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/inttypes.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/inttypes.h:226:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/_types.h:27:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
typedef __int64_t __darwin_blkcnt_t; /* total blocks */
^
note: '__int128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_blksize_t; /* preferred block size */
^
note: '__int128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_dev_t; /* dev_t */
^
note: '__int128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_gid_t; /* [???] process and group IDs */
^
note: '__uint128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t, or gid_t*/
^
note: '__uint128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean '__uint128_t'?
typedef __uint64_t __darwin_ino64_t; /* [???] Used for 64 bit inodes */
^
note: '__uint128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
typedef __uint16_t __darwin_mode_t; /* [???] Some file attributes */
^
note: '__uint128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
typedef __int64_t __darwin_off_t; /* [???] Used for file sizes */
^
note: '__int128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_pid_t; /* [???] process and group IDs */
^
note: '__int128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_sigset_t; /* [???] signal set */
^
note: '__uint128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */
^
note: '__int128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_uid_t; /* [???] user IDs */
^
note: '__uint128_t' declared here
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
^
note: '__uint128_t' declared here
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/inttypes.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/inttypes.h:226:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_wctype_t;
^
note: '__uint128_t' declared here
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/inttypes.h:30:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/inttypes.h:227:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include/sys/_types/_wchar_t.h:34:9: error: unknown type name '__darwin_wchar_t'
typedef __darwin_wchar_t wchar_t;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [apps/app_rand.o] Error 1
make: *** [all] Error 2
There were two errors in total, the final solution was:
Made sure I have the right version of gcc installed
Install xcode-select to fix the compiler error by selecting the right environment:
xcode-select --install
sudo xcode-select -switch /Applications/Xcode.app
Restarted Mac (important)
Installed the rbenv:
rbenv install 2.6.5

Error with arm-trusted-firmware compilation when built by cross toolchain

I am working on rcar gen 3 platform from Renesas and particularly on arm-trusted-firmware level.
1. bootparam_sa0.srec Loader(Boot parameter) <======= arm-trusted-firmware
2. bl2-m3ulcb.srec Loader <======= arm-trusted-firmware
3. cert_header_sa6.srec Loader(Certification) <======= arm-trusted-firmware
4. bl31-m3ulcb.srec ARM Trusted Firmware <======= arm-trusted-firmware
5. tee-m3ulcb.srec Open Portable Trusted OS <======= optee-os
6. u-boot-elf.srec U-Boot <======= u-boot
I built BL31 by command with Gcc v5.4
$ make ARCH=aarch64 CROSS_COMPILE=aarch64-linux-gnu- PLAT=rcar LSI=M3 RCAR_GEN3_ULCB=1 RCAR_LOSSY_ENABLE=1 RCAR_DRAM_SPLIT=2 PMIC_LEVEL_MODE=0 bl31
But I ran into the below err:
"
Including services/spd/opteed/opteed.mk
AS bl31/aarch64/runtime_exceptions.S
bl31/aarch64/runtime_exceptions.S: Assembler messages:
bl31/aarch64/runtime_exceptions.S:183: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:191: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:196: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:201: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:215: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:219: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:223: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:227: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:241: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:245: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:249: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:257: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:271: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:275: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:279: Error: non-constant expression in ".if" statement
bl31/aarch64/runtime_exceptions.S:287: Error: non-constant expression in ".if" statement
Makefile:556: recipe for target 'build/rcar/release/bl31/runtime_exceptions.o' failed
make: *** [build/rcar/release/bl31/runtime_exceptions.o] Error 1
"
Same error: https://github.com/ARM-software/tf-issues/issues/417
The assembly code is correct and is apparently not the problem.
It seemed that it depends on Compiler. I was trying to install gcc/g++ 7.4 cross:
http://ftp.br.debian.org/debian/pool/main/g/gcc-7-cross/gcc-7-aarch64-linux-gnu_7.4.0-1cross1_amd64.deb
http://ftp.br.debian.org/debian/pool/main/g/gcc-7-cross/g++-7-aarch64-linux-gnu_7.4.0-1cross1_amd64.deb
on Ubuntu 16.04, and modified the Makefile to used gcc-7 (cross), g++-7 (cross), but still had this error. How can I overcome this err ?
You could stop using the toolchains that are provided with your Linux distribution, and start using a Linaro toolchain instead:
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-elf/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-elf.tar.xz
tar Jxf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-elf.tar.xz -C /opt
git clone https://github.com/renesas-rcar/arm-trusted-firmware arm-trusted-firmware-renesas
cd arm-trusted-firmware-renesas
make ARCH=aarch64 CROSS_COMPILE=/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-elf/bin/aarch64-elf- PLAT=rcar LSI=M3 RCAR_GEN3_ULCB=1 RCAR_LOSSY_ENABLE=1 RCAR_DRAM_SPLIT=2 PMIC_LEVEL_MODE=0 bl31
Including services/spd/opteed/opteed.mk
CC drivers/arm/gic/common/gic_common.c
CC drivers/arm/gic/v2/gicv2_main.c
CC drivers/arm/gic/v2/gicv2_helpers.c
CC plat/common/plat_gicv2.c
CC drivers/arm/cci/cci.c
CC plat/renesas/rcar/bl31_rcar_setup.c
CC plat/renesas/rcar/rcar_pm.c
CC plat/renesas/rcar/rcar_sip_svc.c
CC plat/renesas/rcar/drivers/board/board.c
CC plat/renesas/rcar/drivers/dramconf/dramconf.c
CC plat/renesas/rcar/drivers/memdrv/rcar_printf.c
CC plat/renesas/rcar/rcar_topology.c
CC plat/renesas/rcar/aarch64/rcar_common.c
CC plat/renesas/rcar/aarch64/rcar_drivers_common.c
CC plat/renesas/rcar/drivers/pwrc/rcar_pwrc.c
CC plat/renesas/rcar/drivers/cpld/ulcb_cpld.c
CC plat/renesas/rcar/drivers/wait/micro_wait.c
CC plat/common/plat_psci_common.c
CC plat/compat/plat_pm_compat.c
CC plat/compat/plat_topology_compat.c
CC bl31/bl31_main.c
CC bl31/interrupt_mgmt.c
CC bl31/bl31_context_mgmt.c
CC common/runtime_svc.c
CC services/arm_arch_svc/arm_arch_svc_setup.c
CC services/std_svc/std_svc_setup.c
CC lib/el3_runtime/cpu_data_array.c
CC lib/el3_runtime/aarch64/context_mgmt.c
CC lib/cpus/errata_report.c
CC lib/psci/psci_off.c
CC lib/psci/psci_on.c
CC lib/psci/psci_suspend.c
CC lib/psci/psci_common.c
CC lib/psci/psci_main.c
CC lib/psci/psci_setup.c
CC lib/psci/psci_system_off.c
CC lib/psci/psci_mem_protect.c
CC lib/locks/bakery/bakery_lock_coherent.c
CC lib/extensions/spe/spe.c
CC services/spd/opteed/opteed_common.c
CC services/spd/opteed/opteed_main.c
CC services/spd/opteed/opteed_pm.c
CC common/bl_common.c
CC common/tf_log.c
CC common/tf_printf.c
CC common/tf_snprintf.c
CC plat/common/plat_bl_common.c
CC plat/common/plat_log_common.c
CC plat/common/aarch64/plat_common.c
CC lib/stdlib/abort.c
CC lib/stdlib/assert.c
CC lib/stdlib/exit.c
CC lib/stdlib/mem.c
CC lib/stdlib/printf.c
CC lib/stdlib/putchar.c
CC lib/stdlib/puts.c
CC lib/stdlib/sscanf.c
CC lib/stdlib/strchr.c
CC lib/stdlib/strcmp.c
CC lib/stdlib/strlen.c
CC lib/stdlib/strncmp.c
CC lib/stdlib/strnlen.c
CC lib/stdlib/subr_prf.c
CC lib/stdlib/timingsafe_bcmp.c
CC plat/renesas/rcar/drivers/iic_dvfs/iic_dvfs.c
CC lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
CC lib/xlat_tables_v2/xlat_tables_internal.c
AS lib/cpus/aarch64/aem_generic.S
AS lib/cpus/aarch64/cortex_a53.S
AS lib/cpus/aarch64/cortex_a57.S
AS plat/renesas/rcar/drivers/memdrv/rcar_console.S
AS plat/renesas/rcar/aarch64/rcar_helpers.S
AS plat/renesas/rcar/drivers/pwrc/rcar_call_sram.S
AS bl31/aarch64/bl31_entrypoint.S
AS bl31/aarch64/runtime_exceptions.S
AS bl31/aarch64/crash_reporting.S
AS plat/common/aarch64/platform_mp_stack.S
AS lib/el3_runtime/aarch64/cpu_data.S
AS lib/cpus/aarch64/cpu_helpers.S
AS lib/locks/exclusive/aarch64/spinlock.S
AS lib/psci/aarch64/psci_helpers.S
AS lib/el3_runtime/aarch64/context.S
AS lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S
AS lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
AS services/spd/opteed/opteed_helpers.S
AS common/aarch64/debug.S
AS lib/aarch64/cache_helpers.S
AS lib/aarch64/misc_helpers.S
AS plat/common/aarch64/platform_helpers.S
AS plat/compat/aarch64/plat_helpers_compat.S
PP bl31/bl31.ld.S
LD build/rcar/release/bl31/bl31.elf
SREC build/rcar/release/bl31.srec
BIN build/rcar/release/bl31.bin
Built build/rcar/release/bl31.bin successfully
OD build/rcar/release/bl31/bl31.dump

fbthrift: No generator named 'cpp2' could be found after (seemingly) successful build

I'm trying to install crnn which requires fblualib on Ubuntu 18.04 LTS. While building TH++, an error occured (Complete build print attached below):
[ 10%] Building CXX object CMakeFiles/thpp.dir/Storage.cpp.o
In file included from /home/huiji/Downloads/thpp-master/thpp/Storage.cpp:11:0:
/home/huiji/Downloads/thpp-master/thpp/../thpp/Storage.h:22:10: fatal error: thpp/if/gen-cpp2/Tensor_types.h: no such file or directory
#include **<thpp/if/gen-cpp2/Tensor_types.h>**
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If I build thpp without using fbthrift and folly by running THPP_NOFB=1 ./build.sh in the thpp directory, the build would be successful (I have thpp files in torch/install/include and torch/install/lib). However, if I move on and build fblualib, an almost identical error occurs:
[ 20%] Building CXX object CMakeFiles/fblualib.dir/LuaUtils.cpp.o
In file included from
/home/huiji/torch/install/include/thpp/Tensor.h:20:0,
from /home/huiji/Downloads/fblualib-master/fblualib/../fblualib/LuaUtils.h:19,
from /home/huiji/Downloads/fblualib- master/fblualib/LuaUtils.cpp:11:
/home/huiji/torch/install/include/thpp/Storage.h:22:10: fatal error:
thpp/if/gen-cpp2/Tensor_types.h: no such file or directory
#include <thpp/if/gen-cpp2/Tensor_types.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I figure that there may be something wrong with my fbthrift. Then I tried the following commands under directory "thpp/if/". It seems that my fbthrift can't generate a cpp2-format file, but can generate a cpp/py file, awhile my python thrift_compiler can only generate an errored cpp2-format file.
$ thrift --gen cpp2 Tensor.thrift
[WARNING:/home/huiji/Downloads/thpp-master/thpp/if/Tensor.thrift:1] No generator named 'cpp2' could be found!
[WARNING:generation:1] Unable to get a generator for "cpp2".
# Nothing was generated in /thpp/if
$ thrift --gen cpp Tensor.thrift && ls gen-cpp
[WARNING:/home/huiji/Downloads/thpp-master/thpp/if/Tensor.thrift:3] No generator named 'cpp2' could be found!
Tensor_constants.cpp Tensor_constants.h Tensor_types.cpp Tensor_types.h
$ thrift --gen py Tensor.thrift && ls -R gen-py
[WARNING:/home/huiji/Downloads/thpp-master/thpp/if/Tensor.thrift:3] No generator named 'cpp2' could be found!
gen-py:
__init__.py Tensor
gen-py/Tensor:
constants.py __init__.py ttypes.py
$ python -m thrift_compiler.main --gen cpp2 Tensor.thrift && ls gen-cpp2
Tensor_fatal_all.h Tensor_fatal.h Tensor_fatal_types.h
Tensor_fatal_constant.h Tensor_fatal_service.h Tensor_fatal_union.h
Tensor_fatal_enum.h Tensor_fatal_struct.h
# A "gen-cpp2" directory was created, but in it there was no "Tensor_types.h"!
$ python -m thrift_compiler.main --gen cpp Tensor.thrift
('Argument Error:', ArgumentError('Language cpp not defined.',))
$ python -m thrift_compiler.main --gen py Tensor.thrift
('Argument Error:', ArgumentError('Language py not defined.',))
By the way, my fbthrift install seemed successful except the python package thrift_compiler was not installed correctly. I've followed GitHubGS's suggestion. That seem to have worked (I can now import thrift_compiler in python, below is what I did) but as you can see, it is not really working.
1.modify /thrift/compiler/CMakefile.txt by inserting these lines
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_C_FLAGS "-fPIC")
2.rebuild/reinstall fbthrift(must step)
3.run your command under /fbthrift/thrift/compiler/py
g++ -I /usr/include/python2.7 -I ../../.. -std=c++14 -fpic -shared -o frontend.so compiler.cc -lboost_python -lpython2.7 -L/build/lib -lcompiler_base -lcompiler_ast -lboost_system -lboost_filesystem -lssl -lcrypto
sudo cp frontend.so /usr/local/lib/python2.7/dist-packages/thrift_py-0.9.0-py2.7.egg/thrift_compiler
Any ideas/suggestions would be greatly appreciated.
=================
Complete message of thpp build:
huiji#NoBoDy:~/Downloads/thpp-master/thpp$ ./build.sh
If you don&apos;t have folly or thrift installed, try doing
THPP_NOFB=1 ./build.sh
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/g++
-- Check for working CXX compiler: /usr/local/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /home/huiji/torch/install
-- Found Folly: /usr/local/include
-- Found Thrift: /usr/local/include
-- Performing Test HAS_NO_AS_NEEDED
-- Performing Test HAS_NO_AS_NEEDED - Success
-- Found Glog: /usr/include
-- Found PythonInterp: /usr/bin/python (found version "2.7.15")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/huiji/Downloads/thpp-master/thpp/build
[ 5%] Generating thpp/if/gen-cpp2/Tensor_data.h, thpp/if/gen-cpp2/Tensor_types.h, thpp/if/gen-cpp2/Tensor_types.tcc, thpp/if/gen-cpp2/Tensor_constants.h, thpp/if/gen-cpp2/Tensor_data.cpp, thpp/if/gen-cpp2/Tensor_types.cpp, thpp/if/gen-cpp2/Tensor_constants.cpp
Scanning dependencies of target thpp
[ 10%] Building CXX object CMakeFiles/thpp.dir/Storage.cpp.o
In file included from /home/huiji/Downloads/thpp-master/thpp/Storage.cpp:11:0:
/home/huiji/Downloads/thpp-master/thpp/../thpp/Storage.h:22:10: fatal error: thpp/if/gen-cpp2/Tensor_types.h: no such file or directory
#include <thpp/if/gen-cpp2/Tensor_types.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/thpp.dir/build.make:84: recipe for target &apos;CMakeFiles/thpp.dir/Storage.cpp.o&apos; failed
make[2]: *** [CMakeFiles/thpp.dir/Storage.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target &apos;CMakeFiles/thpp.dir/all&apos; failed
make[1]: *** [CMakeFiles/thpp.dir/all] Error 2
Makefile:140: recipe for target &apos;all&apos; failed
make: *** [all] Error 2
Complete message of fblualib build:
huiji#NoBoDy:~/Downloads/fblualib-master/fblualib$ ./build.sh
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/g++
-- Check for working CXX compiler: /usr/local/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Folly: /usr/local/include
-- Found Glog: /usr/include
-- Found Torch7 in /home/huiji/torch/install
-- Found Folly: /home/huiji/torch/install/include
-- Configuring done
WARNING: Target "fblualib" requests linking to directory "/home/huiji/torch/install/lib". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/huiji/Downloads/fblualib-master/fblualib/build
Scanning dependencies of target fblualib
[ 20%] Building CXX object CMakeFiles/fblualib.dir/LuaUtils.cpp.o
In file included from /home/huiji/torch/install/include/thpp/Tensor.h:20:0,
from /home/huiji/Downloads/fblualib-master/fblualib/../fblualib/LuaUtils.h:19,
from /home/huiji/Downloads/fblualib-master/fblualib/LuaUtils.cpp:11:
/home/huiji/torch/install/include/thpp/Storage.h:22:10: fatal error: thpp/if/gen-cpp2/Tensor_types.h: no such file or directory
#include <thpp/if/gen-cpp2/Tensor_types.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/fblualib.dir/build.make:62: recipe for target &apos;CMakeFiles/fblualib.dir/LuaUtils.cpp.o&apos; failed
make[2]: *** [CMakeFiles/fblualib.dir/LuaUtils.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target &apos;CMakeFiles/fblualib.dir/all&apos; failed
make[1]: *** [CMakeFiles/fblualib.dir/all] Error 2
Makefile:129: recipe for target &apos;all&apos; failed
make: *** [all] Error 2
Use thrift1 and mstch_cpp2 instead. It works for me!
See https://github.com/facebook/fbthrift/issues/271 and $THRIFT_INCLUDE is /usr/local/include/thrift/ in my system.
As one of the above answer mentioned, after building fbthrift successfully, you get bin/thrift1 binary in your build folder. You can then use the output thrift1 with generator mstch_cpp2.
./build/bin/thrift1 --gen mstch_cpp2 --templates ./thrift/compiler/generate/templates --out /tmp/ ./thrift/example/if/chatroom.thrift
Ref https://github.com/facebook/fbthrift/issues/303

Building a C library (GMP) for arm64 iOS

I'm trying to build a C library (GMP 6.0.0) for arm64 for use on iOS. I'm running the configure script with the invocation below (compiler is as found using xcrun --find).
./configure \
CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" \
CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" \
CPPFLAGS="-target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0" \
--host=aarch64-apple-darwin
However this fails at the following line ("long long reliability test 1"):
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -O2 -pedantic -target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0... no, long long reliability test 1
configure: error: could not find a working compiler, see config.log for details
Full config.log available here. It shows multiple warning and errors for the long long reliability test compile, including the following:
conftest.c:9:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
^
conftest.c:10:44: error: implicit declaration of function 'h' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:48: error: implicit declaration of function 'g' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:100: warning: control reaches end of non-void function [-Wreturn-type]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
Using --host=none it works fine, but I'd really like to figure out how to build it with assembly optimized for arm64.
My system is x86_64-apple-darwin13.1.0 (or coreisbr-apple-darwin13.1.0 according to config.guess), an early '11 Core i7 MBP running OS X v10.9.2. I'm using Xcode 5.1 (5B130a).
Any help appreciated.
EDIT 1
Compiling for ARMv7 passes configure, but fails on make (full configure/make output here), apparently while compiling some assembly:
tmp-dive_1.s:165:18: error: unexpected token in '.section' directive
.section .rodata
^
EDIT 2
#MarcGlisse: By forcing clang to ignore the errors as suggested (-Wno-...) arm64 passes configure, but then fails on make (full output here):
tmp-mul_1.s:59:2: error: unrecognized instruction mnemonic
bcc Lfi1
^
tmp-mul_1.s:60:2: error: unrecognized instruction mnemonic
beq Lfi2
^
As a side note: these commits, I assume intended to remove the need for suppressing the error, don't seem to work i.e. I get the same error when removing the supression.
For armv7, using these commits as suggested fixes the .section error, but make fails later on with the following (full output here):
tmp-mode1o.s:64:2: error: unknown directive
.protected ___gmp_binvert_limb_table
^
EDIT 3
Using the suggested edits, armv7, armv7s, i386 and x86_64 now all compile with assembly!
For arm64 the edits get it past the previous error, but now gives several errors about an invalid input constraint 'rZ', all in the same file (full output here):
divrem_1.c:237:5: error: invalid input constraint 'rZ' in asm
udiv_qrnnd_preinv (*qp, r, r, nshift, d, dinv);
^
../gmp-impl.h:3062:2: note: expanded from macro 'udiv_qrnnd_preinv'
add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
^
../longlong.h:551:7: note: expanded from macro 'add_ssaaaa'
: "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
EDIT 4
After commenting out add_ssaaaa and sub_ddmmss in longlong.h and editing some more assembly instructions in gcd_1.asm (blo to b.lo etc.), it now fails with several of the following errors (full output here):
tmp-invert_limb.s:75:22: error: immediate value expected for shifter operand
add x1, x1, x2, lsr 1
^
tmp-invert_limb.s:75:22: error: invalid operand for instruction
add x1, x1, x2, lsr 1
^
I'll post a total diff later.
EDIT 5
Ok, that gets us another step further, but it now hits into (full output here):
tmp-invert_limb.s:52:2: error: ADR/ADRP relocations must be GOT relative
adrp x1, approx_tab
^
If this keeps going it might be better to continue this via email.
"Support for ARM64 alias Aarch64 alias ARMv8"
https://gmplib.org/gmp6.0
Copyright issues aside...
GMP may not be compatible with Apple's proprietary CPU, and may not be compatible with Clang/LLVM. Being a GNU project it is probably more thoroughly tested with GCC on non-proprietary chipsets.
A quick search shows historically at least there have been issues compiling GMP with clang.
You really should email the GMP community and ask for help on this one.

Resources