How do I install crystal-lang on rapsberry pi? - arm

When I try to add it to sources as per debian install instructions I get this error. I'm guessing this means that there are no arm packages for it.
Failed to fetch https://dist.crystal-lang.org/apt/dists/crystal/InRelease Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file)
I'm guessing I probably need to install it from source. How would I go about doing that with an arm cpu? When I check it out and run make I get the error:
You need to have a crystal executable in your path! Makefile:113:
recipe for target '.build/crystal' failed make: *** [.build/crystal]
Error 1
Any suggestions would be greatly appreciated.

EDIT: There's now a semi-official repository for crystal on raspbian, check it out here: http://public.portalier.com/raspbian
Crystal doesn't build Debian packages for ARM, and you're correct in that you'll need to build from source.
However, the Crystal compiler is written in Crystal. This presents the obvious problem of how to get a compiler to build the compiler. The answer is cross-compilation: building an arm binary on a x86 desktop computer and copying it across.
Here's a quick step-by-step based on my memory of last time I cross-compiled:
Install Crystal on a x86 desktop PC, and check it works.
Install all required libraries on the desktop and Raspberry Pi. You'll need the same LLVM version on the Raspberry Pi and desktop. This is probably the hardest and longest step. You can install llvm 3.9 from debian testing for ARM, see this stackoverflow post for how to install only LLVM from debian testing.
Check out the sources from git on both computers, and run make deps.
Cross-compile the compiler by running this command in the root of the git repository:
./bin/crystal build src/compiler/crystal.cr --cross-compile --target arm-unknown-linux-gnueabihf --release -s -D without_openssl -D without_zlib
This command will create a crystal.o file in your current directory, and also output a linker command (cc crystal.o -o crystal ...).
Copy crystal.o to the raspberry pi, and run the linker command. Be sure to edit the absolute path to llvm_ext.o so that it points to the Crystal checkout on your Raspberry Pi, not the checkout on your desktop. Also make sure that all references to llvm-config in the command are for the correct LLVM version. For example, changing /usr/local/bin/llvm-config to llvm-config-3.9 on Raspbian.
Run the crystal executable in your current directory (./crystal -v) and make sure it works.
Ensure to set CRYSTAL_PATH environment variable is set to lib:/path/to/crystal/source/checkout/src so that the compiler can find the standard library when compiling applications.

Related

Soln for U-Boot Compilation error with myir board?

I'm using the MYD-Y6ULX-HMI series boards supports the Linux kernel version 4.1.15, and provided with rich hardware and software resource. They recommend to use Ubuntu 16.04 64bit distribution. For more details about the devkit
-> http://www.myirtech.com/list.asp?id=602
-> http://d.myirtech.com/MYD-Y6ULX-HMI/
By referring their usermanual,
(1) Installed virtualBox with Ubuntu 16.04 64bit distribution
(2) Installed software package and made the working directory in root.
(3) Installed Yocto toolchain:gcc version 5.3.0(GCC) - for driver(metatoolchain)
After installation sourced the env file:
source /opt/myir-imx6ulx-fb/4.1.15-2.0.1/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
and checked the compiler version:
arm-poky-linux-gnueabi-gcc --version
(4) Now trying to make u-boot config and compiling it with that able to generate config file but facing issue while compiling it,
(a) Sourced the metaToolChain
(b) Entered the U-bootsource file directory
(c) given sudo make distclean
(d) Exported the env variables CROSS_COMPILER and ARCH
(e) sudo make
the core board of one i'm using is MYC-Y6ULY2-356N256D-50-C
(f) sudo make
But cant able to compile. Can any one please help on this to solve the issue?
enter image description here
enter image description here
Do not use sudo here. It's a bad practice all around, but specifically in this case the environment from the user isn't passed to sudo, so CROSS_COMPILE is unset, so that's why you see that error.

How to cross-build luajit-5.1 for an ARM Linux device? (Trying to build LÖVE framework)

I'm trying to cross-build LÖVE (https://love2d.org) for an ARM Linux device (Rockchip RK3066) from Ubuntu 16.04.
As the documentation says, I installed all dependencies on Ubuntu and was able to build it (for Ubuntu, as a test). Now I'm going for the cross-build.
Before building, I have to run ./configure. So far I've been able to get the toolchain's gcc compiler to be accepted, but when it looks for the dependencies, I get this error:
checking for luajit5.1... no
checking for luajit51... no
checking for luajit... no
configure: error: Package requirements (luajit) were not met:
No package 'luajit' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables lua_CFLAGS
and lua_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Could this be fixed by cross-building luajit for the device and add it to the toolchain binaries, or could I just try to make the ./configure script look for the luajit I installed in Ubuntu?
If it's the latter, would someone kindly point me on the right direction? I've opened like 20 pages already with a similar error message and none of them had a valid answer.
Thanks a lot in advance.

Yocto Build - loadlocale.c #130

So I've upgraded to a newer version of Linux kernel using Yocto. The new kernel version is for 4.1.15 and runs on an iMX6 chip. I've also included openssh-server, tools-sdk, and tools-debug for development recipes. The problem is that when I connect to build I get the following error:
loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof
(_nl_value_type_LC_COLLATE) / sizeof (_nl_value_type_LC_COLLATE[0]))'
failed
Now if I type into the command prompt sh -c "LANG=en_US" I get the same error as above. If I type in sh -c "LANG=/usr/lib/locale/en_US" then I do not get an error. When I type locale everything is listed as POSIX and when I type locale -a I get:
C
POSIX
en_GB
en_US
The last two are stored under /usr/lib/locale. My version of gcc is 5.2 and my glibc is v2.22. I've looked all over the internet for other solutions but they are either for Ubuntu where the package manager comes in handy or it's some really specific fix like editing a file that I don't have in my Yocto build.
Edit:
The machine is for a SMARC-FiMX6 SoM and the instructions are here. I'm not sure what branch of Yocto is being pulled down.
After troubleshooting the problem is from the glibc library. A patch, #114739, is on the openembedded website which details what to do to fix this issue. Just patch the file, rebuild, and the issue is fixed. See here for details, the patch is at the bottom of the page.

Not able to upload code on CC2538dk board from Ubuntu 12.04 command line

I have a CC2538dk board. I am using Ubuntu 12.04 and cloned Contiki repository from github. I was able to compile all the code in Contiki using make TARGET=cc2538dk hello-world, but I'm not able to upload the code to the CC2538dk board from command line.
The error I'm getting when I ran make TARGET=cc2538dk hello-world.upload is as below.
make: No rule to make target `hello-world.upload'. Stop.
I used to use TI's Uniflash tool (CCS_Uniflash v2.2) to upload the the .elf binary, but it is not available in Contiki.
There is no make target for uploading to CC2538dk boards. According to the documentation one should use TI's UniFlash.
I had success compiling the contiki examples on a separate computer, then using Code Compose Studio v 5.4 to import my binaries (ELF files) to an empty CC2538 project, then debug it from there in order to get it loaded onto the board. Definitely not ideal, but it works.
Setup:
Compile contiki source and examples from instantContiki
move the example directory, included blink.elf to windows machine with CCS 5.4 installed
make a new project in CCS, select Other Examples->Empty CC2538 Project
Import a C/C++ executable, then using the GNU Elf reader, select the blink.elf file you moved over
copy+paste the CC2538SF53.ccxml and the cx2538xf53_ccs.cmd to the new project, and try to debug using those configurations.
The reason this seems to work is that the xds100v3 drivers that come with the board's install disc and the uniflash tool don't seem to work right and just give me any number of errors. There's a black-magic-configuration-combination of the CCS 5.4 for Window's drivers/Other Example's CC2538SF53.ccxml that was the only way I was able to connect to the target.

Sourcery G++ (cross-compiler for ARM) installation failure

I was trying to install Sourcery G++ cross-compiler for ARM on Ubuntu 10.04 LTS from the following link ->http://www.codesourcery.com/sgpp/lite/arm/portal/release644
I did not use the graphical interface since I got java.awt error. While using the console mode of installation, I provided all the details asked by the program.(changed the default location of installation)
Some time into the installation, I got this error:
Unable to create file links
An error occurred while running an internal program.
Please remove the toolchain from "/home//cross_compiler".
EXITCODE=-1
I'm not sure what the reason is. I redid this process as a root user and I still got the same error.I am trying to install this on a 64 bit machine.
I suppose it is important to check your system requirements.
There is the possibility you are running a 64bit build of Ubuntu.
Sourcery G++ requires 32bit host libraries. Ensure those are installed.
In my mind, it may be easier to run a 32bit installation in a VM.
If that is not possible, there are installation logs in the 'uninstall' directory of your installation attempt directory. That may help you troubleshoot the issue.
You must have the 32-bit compatibility libraries installed to install Sourcery CodeBench.
From the FAQ: "What do I need to do to install and run Sourcery CodeBench on an x86 64-bit Linux host system?"
https://sourcery.mentor.com/sgpp/lite/arm/portal/kbentry62
Full FAQ here:
https://sourcery.mentor.com/sgpp/lite/arm/portal/target_arch?#action=faq&target_arch=arm
The ARM Lite edition tools have their own mailing list where you can ask such questions.
Go to sourcerytools.com and use the "arm-gnu" mailing list for ARM Lite edition questions.
Cheers!

Resources