Cross Compiling on OSX to Raspberry Pi - node.js

I am trying to configure an environment on my osx machine that will allow me to cross compile arm6 applications for the Raspberry Pi. I seem to be runnning into a wall when it comes to setting up the toolchain. I am using crosstool-ng and am following multiple guides on setup but my issue comes down to when running the ct-ng build command.
Once I run this command everything seems to be running fine until I get to trying to build the binutils. Once it reaches this depenency it will eventually fail no mater what I do.
This is the ouput that I am seeing:
[INFO ] Installing binutils for host
[EXTRA] Configuring binutils
[EXTRA] Building binutils
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:51:72: error: use of undeclared identifier 'do_not_use_isalnum_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:59:72: error: use of undeclared identifier 'do_not_use_isalpha_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:75:72: error: use of undeclared identifier 'do_not_use_iscntrl_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:83:72: error: use of undeclared identifier 'do_not_use_isdigit_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:91:72: error: use of undeclared identifier 'do_not_use_isgraph_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:99:72: error: use of undeclared identifier 'do_not_use_islower_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:107:72: error: use of undeclared identifier 'do_not_use_isprint_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:115:72: error: use of undeclared identifier 'do_not_use_ispunct_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:123:72: error: use of undeclared identifier 'do_not_use_isspace_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:131:72: error: use of undeclared identifier 'do_not_use_isupper_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:139:73: error: use of undeclared identifier 'do_not_use_isxdigit_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:147:72: error: use of undeclared identifier 'do_not_use_tolower_with_safe_ctype'
[ERROR] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cctype:155:72: error: use of undeclared identifier 'do_not_use_toupper_with_safe_ctype'
[ERROR] make[5]: *** [binary.o] Error 1
[ERROR] make[4]: *** [all-recursive] Error 1
[ERROR] make[3]: *** [all] Error 2
[ERROR] make[2]: *** [all-gold] Error 2
[ERROR] make[1]: *** [all] Error 2
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing binutils for host'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions#216]
[ERROR] >> called from: do_binutils_backend[scripts/build/binutils/binutils.sh#236]
[ERROR] >> called from: do_binutils_for_host[scripts/build/binutils/binutils.sh#101]
[ERROR] >> called from: main[scripts/crosstool-NG.sh#638]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> '/usr/local/Cellar/crosstool-ng/1.21.0/share/doc/crosstool-ng/ct-ng.1.21.0/B - Known issues.txt'
[ERROR]
[ERROR] (elapsed: 5:11.00)
[05:12] / make: *** [build] Error 1
If anyone has ran into this issue and knows how to fix it. It would be much appreciated. Trying to build from source on the Pi (Model A+ has proven pretty tough as it will eventually crash)
Thank you.

Gold linker cannot be compiled on Clang 6-7 for now. You should be able to proceed if the linker is disabled via ct-ng menuconfig in Binary Utilities - Linkers to enable.

Related

ctosstool-ng build fails on cygwin for armv8-rpi3-linux-gnueabihf

I am trying to build a arm RPI4 crosscompiler and toolchain on cygwin on windows 10 with ctosstool-ng-1.24.0
The process works fine generating a arm RPI4 toolchain from ubuntu 20.4 host but fails on windows 10
The Prebuilt Windows Toolchain for Raspberry Pi have gold linker issue that fails to resolve gtk-3 and gdk-3 dependencies libs on windows. so I am trying to see if a newly generated one will resolve the problem.
ctosstool-ng build fails on cygwin for armv8-rpi3-linux-gnueabihf consistently with a flurry of
[ERROR] /usr/include/sys/features.h:322:5: error: "_FORTIFY_SOURCE" is not defined, evaluates to 0 [-Werror=undef]
followed by
[EXTRA] Installing C library start files
[ERROR] ../include/link.h:43:57: error: unknown type name 'Lmid_t'; did you mean 'pid_t'?
[ERROR] ../sysdeps/posix/dl-fileid.h:27:5: error: unknown type name 'ino64_t'
[ERROR] ../sysdeps/posix/dl-fileid.h:35:17: error: storage size of 'st' isn't known
[ERROR] ../sysdeps/posix/dl-fileid.h:37:37: error: '_STAT_VER' undeclared (first use in this function)
[ERROR] /usr/include/cygwin/core_dump.h:19:10: fatal error: windows.h: No such file or directory
[ERROR] /usr/include/cygwin/core_dump.h:19:10: fatal error: windows.h: No such file or directory
[ERROR] make[3]: *** [../Makerules:287: /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h] Error 1
[ERROR] make[3]: *** Waiting for unfinished jobs....
[ERROR] make[3]: *** [../Makerules:287: /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tcb-offsets.h] Error 1
[ERROR] /usr/include/cygwin/core_dump.h:19:10: fatal error: windows.h: No such file or directory
[ERROR] make[3]: *** [../Makerules:287: /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/rtld-global-offsets.h] Error 1
[ERROR] make[2]: *** [Makefile:258: csu/subdir_lib] Error 2
[ERROR] make[1]: *** [Makefile:9: csu/subdir_lib] Error 2
[ERROR] /
[ERROR] >>
[ERROR] >> Build failed in step 'Building for multilib 1/1: '''
[ERROR] >> called in step 'Installing C library headers & start files'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions#376]
[ERROR] >> called from: glibc_backend_once[scripts/build/libc/glibc.sh#374]
[ERROR] >> called from: CT_IterateMultilibs[scripts/functions#1586]
[ERROR] >> called from: glibc_backend[scripts/build/libc/glibc.sh#74]
[ERROR] >> called from: glibc_start_files[scripts/build/libc/glibc.sh#38]
[ERROR] >> called from: do_libc_start_files[scripts/build/libc.sh#28]
[ERROR] >> called from: main[scripts/crosstool-NG.sh#696]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> https://crosstool-ng.github.io/docs/known-issues/
[ERROR] >>
[ERROR] >> If you feel this is a bug in crosstool-NG, report it at:
[ERROR] >> https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR] >>
[ERROR] >> Make sure your report includes all the information pertinent to this issue.
[ERROR] >> Read the bug reporting guidelines here:
[ERROR] >> http://crosstool-ng.github.io/support/
[ERROR] /
[ERROR] (elapsed: 130:50.55)
[131:02] / make: *** [ct-ng:261: build] Error 2
I have tried cygwin gcc version 9.3 and 11.3 and also, under menuconfig, glib2.28 and glib2.24. All of them fail at the "libc_start_files" step after installing kernel_headers.
Steps followed from :
$ ../configure --prefix=<install-dir>
$ make
$ make install
$ ./ct-ng armv8-rpi3-linux-gnueabihf
$ ./ct-ng menuconfig (choose glib 2.28)
$ ./ct-ng build
Link to : build logs .config make and make-install logs
If anyone has else succeeded on building this on windows host please share your steps/configuration.
===[UPDATE 1] ===
It looks like c:/cygwin64//usr/include cygwin env is being included in the compiler options. I located ac_cv_env_CPPFLAGS_value=-Ic:/cygwin64//usr/include in build/build-libc-startfiles/multilib/config.cache. But not sure if thats the one causing linux files into cygwin64 includes.
gawk -f ../scripts/gen-as-const.awk ../sysdeps/arm/tlsdesc.sym |
arm-unknown-linux-gnueabihf-gcc -O2 -D_FORTIFY_SOURCE=0
-mlittle-endian -mcpu=cortex-a53 -mfpu=neon-vfpv4 -mhard-float
-S -o /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.hT3
-std=gnu11 -fgnu89-inline -O2 -Wall -Wundef -Wwrite-strings
-fmerge-all-constants -fno-stack-protector -frounding-math -g
-Wstrict-prototypes -Wold-style-definition -fno-math-errno
-ftls-model=initial-exec
-U_FORTIFY_SOURCE -Ic:/cygwin64//usr/include
< rest pf of the includes are from under the .build dir >
... -I.. -I../libio -I. -nostdinc -isystem ....
-DTOP_NAMESPACE=glibc -DGEN_AS_CONST_HEADERS -x c -
-MD -MP -MF /cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h.dT
-MT '/cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h.d
/cygdrive/c/repo/ctng124/bld/.build/arm-unknown-linux-gnueabihf/build/build-libc-startfiles/multilib/tlsdesc.h'
Also its not clear how these propagate from the root build directory into the component build/compiler options.
Any suggestion to track/debug the compiler options will be most helpful.
===
Has anyone encountered these errors?
What could be causing them?
Please share any experience you have on the above.

Error while compiling opentsDB for Cassandra using AsyncCassandra

I am following below link to build AsyncCassandra -
https://github.com/OpenTSDB/asynccassandra
But I am getting following error :
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /root/asynccassandra/src/org/hbase/async/HBaseClient.java:[304,34] error: cannot find symbol
[ERROR] symbol: variable ConsistencyLevel
location: class HBaseClient
/root/asynccassandra/src/org/hbase/async/HBaseClient.java:[303,25] [deprecation] BoundedExponentialBackoff(long,int,int) in BoundedExponentialBackoff has been deprecated
[ERROR] /root/asynccassandra/src/org/hbase/async/HBaseClient.java:[311,35] error: cannot find symbol
It looks like source code is missing
import com.netflix.astyanax.model.ConsistencyLevel;
But in reality, the astynax project that is used for it is already retired, and shouldn't be used.

invalid END header (bad central directory offset) -> [Help 1] [ERROR]

When I try to build cucumber-report from GitHub https://github.com/mkolisnyk/cucumber-reports using eclipse maven install, I am getting:
[ERROR] Failed to parse plugin descriptor for
org.apache.maven.plugins:maven-checkstyle-plugin:2.10
(C:\maven2\repository\org\apache\maven\plugins\maven-checkstyle-plugin\2.10\maven-checkstyle-plugin-2.10.jar):
invalid END header (bad central directory offset) -> [Help 1] [ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with
the -e switch. [ERROR] Re-run Maven using the -X switch to enable full
debug logging. [ERROR] [ERROR] For more information about the errors
and possible solutions, please read the following articles: [ERROR]
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginDescriptorParsingException

sbt on linux not accepting -jvm-debug 5005

I'm using sbt launcher version 0.13.7 on Arch Linux from the official arch repositories. I'm trying to debug a scala app using IntelliJ.
Everywhere else I looked, including other stack overflow questions, seemed to say that Linux versions of sbt can be debugged by simply invoking "sbt -jvm-debug 5005"
However, when I do this, I get a long string of errors:
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[error] Expected letter
[error] Expected symbol
[error] Expected '!'
[error] Expected '+'
[error] Expected '++'
[error] Expected 'debug'
[error] Expected 'info'
[error] Expected 'warn'
[error] Expected 'error'
[error] Expected ';'
[error] Expected end of input.
[error] Expected '--'
[error] Expected 'show'
[error] Expected 'all'
[error] Expected '*'
[error] Expected '{'
[error] Expected project ID
[error] Expected configuration
[error] Expected key
[error] Expected '-'
[error] 5005
[error] ^
[error] Not a valid command: jvm-debug
[error] Not a valid project ID: jvm-debug
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: jvm-debug
[error] jvm-debug
[error] ^
Why is this, and how can I set an sbt project to debug on a port?
It appears that this works:
export SBT_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" && sbt
However, I would still like to know why "sbt -jvm-debug 5005" isn't working on Arch if anyone knows.
The question is about SBT on Linux, but I ran into the same issue in OS X.
SBT 0.13.9 in OS X neither accepts -jvm-debug nor follows SBT_OPTS environment as presented in the accepted answer.
However, this works:
export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

Crosstool-ng python error

I recently trying to compile crosstool-ng for my arm board.
The host is Arch linux 3.9.4-1.
I ran into these following issues:
[ALL ] checking for python... /usr/bin/python
[ALL ] File "/home/godard_b/workspace/raspberry_pi/staging/.build/src/gdb-7.4.1/gdb/python/python-config.py", line 47
[ALL ] print to_unix_path(sysconfig.PREFIX)
[ALL ] ^
[ALL ] SyntaxError: invalid syntax
[ERROR] configure: error: failure running python-config --includes
[ERROR] make[2]: *** [configure-gdb] Error 1
[ALL ] make[2]: Leaving directory `/home/godard_b/workspace/raspberry_pi/staging/.build/arm-unknown-linux-gnueabi/build/build-gdb-cross'
[ERROR] make[1]: *** [all] Error 2
[ALL ] make[1]: Leaving directory `/home/godard_b/workspace/raspberry_pi/staging/.build/arm-unknown-linux-gnueabi/build/build-gdb-cross'
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing cross-gdb'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions#258]
[ERROR] >> called from: do_debug_gdb_build[scripts/build/debug/300-gdb.sh#177]
[ERROR] >> called from: do_debug[scripts/build/debug.sh#35]
[ERROR] >> called from: main[scripts/crosstool-NG.sh#609]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> '/usr/share/doc/crosstool-ng/ct-ng.1.17.0/B - Known issues.txt'
[ERROR]
[ERROR] (elapsed: 132:05.60)
When I run :
python-config --include
it just work fine, so I'm wondering where the problem could be.
Thanks for your help.
I had the same issue, the problem is here:
[ALL ] print to_unix_path(sysconfig.PREFIX)
[ALL ] ^
[ALL ] SyntaxError: invalid syntax
Which means that it's using Python 3 instead of Python 2, probably because python points to python3 (Which is the default in Arch)k
To fix this issue, just make a new directory (I made one called bin on home) and make two symbolic links named python and python-config pointing at python2 and python2-config:
mkdir ~/bin
ln -s /bin/python2 ~/bin/python
ln -s /bin/python2-config ~/bin/python-config
Now try once again to build crosstool-ng adding the dir with python linking at python2 at the beginning of your PATH:
PATH=$HOME/bin:$PATH crosstool-ng build
Sources:
https://wiki.archlinux.org/index.php/Python

Resources