everyone.
I am currently using a phycore am65x embedded board. I'm a student, and I don't know much because it's my first time dealing with Embedded. So I need your help. As mentioned earlier, the phycore am65x board does not cover packages. It turned out that it was an arago project (yocto) and apt-get didn't work. The problem I am trying to solve is that the goal is to install gcc on the board and compile c on the board (error erasing gcc). How can I fix this? I need your help.
Reference
uname -a: Linux am65xx-phycore-kit 4.14.79-g9d8d0716d0 #1 SMP PREEMPT Wed Jul 10 17:37:42 UTC 2019 aarch64 GNU/Linux
cat /etc/issue:
Arago Project http://arago-project.org \n \l
Arago 2018.10 \n \l
PHYTEC: BSP-Yocto-TISDK-AM65xx-ALPHA1
It should be fairly simple to install gcc in any linux distribution. Go to this site, https://gcc.gnu.org/wiki/InstallingGCC download the tar and install it according the instructions on the same site. Alternatively, if you have access to the Yocto project and can bitbake it again you can add to the local.conf
IMAGE_INSTALL_append= " libgcc"
or something similar.
https://gcc.gnu.org/wiki/InstallingGCC
Related
I am self-studying the 2019 version of MIT 6.828/6.S081: Operating System Engineering.
I was trying to attach GDB to xv6 running on RISC-V using QEMU, to learn about what is going on when context switching happens between user mode and kernel mode.
After doing make qemu-gdb and gdb in the same directory, my GDB connected to QEMU successfully. However:
(gdb) x/2i $pc
=> 0xd8c: ecall
0xd90: ret
The problem is: Now if I stepi, it "jumps over" to 0xd90 instead of stepping into the kernel space.
Additionally, accessing any kernel addresses is not allowed, as if I was debugging a normal userland program:
(gdb) i r stvec
stvec 0x3ffffff000 274877902848
(gdb) x/i $stvec
0x3ffffff000: Cannot access memory at address 0x3ffffff000
Environment:
Host VM: Manjaro 19.0.2
sudo pacman -Syy
sudo pacman -S riscv64-linux-gnu-binutils riscv64-linux-gnu-gcc riscv64-linux-gnu-gdb qemu-arch-extra
GDB: 9.1
QEMU: 4.2.0
GCC: 9.2.0
Much appreciate anyone could share some insight about what is going on here. Thanks a lot!
I guess you run your code on ubuntu, that is the problem I experienced, then I change to mac, and flow mit tools tutorials, finally, it works.
run make CPUS=1 qemu-gdb in one window.
run riscv64-unknown-elf-gdb in another window.
ignore the Python Exception
I managed to get around this problem by building the riscv toolchain as explained here.
Building the toolchain as explained in the site, generates a generic ELF/Newlib toolchain identified with the prefix riscv64-unknown-elf- in contrast to the more sophisticated Linux-ELF/glibc toolchain identified by the prefix riscv64-unknown-linux-gnu-. The Newlib build allows the debugger to stepi into kernel space.
For crossdev users it is possible to build the toolchain with Newlib support by running:
crossdev --ex-gcc --ex-gdb --target riscv64-unknown-elf
I will work for a month in a computer that is not mine, thus returning it back as soon as I am done. However, I can be root.
The problem is that I can not run C++11. I am not interested in the latest compiler, just a compiler who can support some C++11 (for example, I do not care about regex).
I tried all these:
sudo yum install gcc-c++
which gives:
Loaded plugins: dellsysidplugin, kernel-module, refresh-packagekit
Setting up Install Process
Package gcc-c++-4.3.2-7.i386 already installed and latest version
Nothing to do
sudo update-alternatives --config gcc
gives nothing
bash-3.2$ g++ --version
which gives:
g++ (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
yum groupinstall "Development Tools"
says all up to the latest version
Some compilation:
bash-3.2$ g++ px.cpp -std=c++0x -o px
px.cpp:2:18: error: chrono: No such file or directory
What can I do? The problem lies on fedora 10? I do not know if I am allowed to update the OS of the computer (which is ancient, battery messages at start up, just to get a glance of it). Moreover, since it is ancient, I am afraid not to destroy it (by upgrading).
Simply download binutils and gcc and the other prerequisites sources as tarball. Unpack and compile to every directory you want. Compile takes maybe 10 minutes and you are finished. I have also a very! old suse linux with a wide variant of compilers in parallel.
Edit: add link to gcc wiki
http://gcc.gnu.org/wiki/InstallingGCC
BTW and not a real answer to the OP question but a fast solution:
What do you think about downloading fedora 20, burn a CD or use a big enough usb stick, boot from CD or usb stick and mount the volume on your laptop and have fun. In fedora 20 the gcc 4.8.2 is in. Should be an alternative from some quit tasks.
If you only want very small examples to run, you also can use a only compiler:
http://www.compileonline.com/compile_cpp11_online.php
for example. A lot more can be find by G* and others.
Problem solved.
For the Others: It was needed to download and build last release.
After this, it's necessary to know where compiler is in order to use it instead of the old one:
It's possible to add the compiler path in $PATH (defined before the standard declaration).
Use full path when use the program.
other stuff that you have in mind (simlink etc).
I decided to write this answer, so that it has the complete answer.
You can't install the compiler by usual methods (e.g. sudo yum install gcc-c++), because, fedora 10 is too old. You have to manually download it and install it.
From gnu, download the compiler you want. I downloaded gcc-4.6.2.tar.gz (under gcc-4.6.2 folder).
Then, it's time to configure and build the compiler. Go in your desired directory and do the following (I just stayed in the Download folder):
note: this can take some time (the computer I am using is really old and took more than 45 minutes)
tar xzf gcc-4.6.2.tar.gz
cd gcc-4.6.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.6.2/configure --prefix=$HOME/gcc-4.6.2
make
make install
Source: gcc wiki (thanks to Klaus)
Then, in order to compile C++11, I had to provide the full path to the new compiler and add -static flag (Why?).
In my case, I would compile px.cpp file to px executable, like this:
/user/gsamaras/home/gcc-4.6.2/bin/g++ px.cpp -static -std=gnu++0x -o px
More methods can be found at Jepessen's answer and at this corner of stackoverflow.
Credits are to be given to Klaus and Jepensen, but I thought grouping all together might help the next guy (if any for fedora 10.. :P )
I have built the openwrt firmware and installed it to a device.
Now I want to compile my source code in C in the device (I can ssh into it).
However, openwrt firmware is quite basic and does not include make.
How can I install make/ equivalent to compile my C source code inside the device running openwrt firmware?
OpenWrt is not intended to work as a build server, so you won't find compiler, linker etc. in its root file system. As you mentioned before, you've successfully compiled the firmware. That means you have cross compiler at hand, so you can cross compile your software and then copy it to your system via scp.
Another approach would be to create your own feed, add your software to this feed, so that at the end you'll get an ordinary ipkg package, that you can download and install via web interface. See OpenWrt documentation for more details.
Lots of Cross Compiler are available for host system i.e PC running any Linux OS.
Just install compiler corresponding to Architecture in which Openwrt is running,
e.g If OpenWRT running on ARM architecture,
sudo apt-get install gcc-arm-linux-gnueabi
then compile source code as:
arm-linux-gcc -o yourprogram yourprogram.c
I am running Angstrom ( v2012.12) on my BeagleBone Black (Linux beaglebone 3.8.13 #1 SMP Thu Sep 12 10:27:06 CEST 2013 armv7l GNU/Linux). I am using the following gcc:
COLLECT_GCC=arm-angstrom-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-angstrom-linux-gnueabi/4.7.3/lto-wrapper
...
gcc version 4.7.3 20130205
I needed to install some library on BBB and while running the script I got this error: "gcc: error: unrecognized command line option -m32". After googling around I figured out that I need a cross compilation to be able to do that (I hope that is the right way, perhaps I am doing something wrong). I started looking for the appropriate toolchain: angstrom-eglibc-i686-armv7a-vfp-neon-v2012.12-toolchain.gz, but I did not find too much. Since http://www.angstrom-distribution.org/toolchains is still out of order I only found a few place where I could get the archive, but it was corrupted.
So my questions are the following.
Am I correct with all this cross compilation stuff, would it help we to solve my problem?
If I am on the right track can somebody share a toolchain packet or give a valid link.
I would really appreciate any help. Many thanks in advance
I found a workaround to that problem. Eventually I adjusted the installation script to omit undesired options ("-m32" in this case) and it worked.
I'm working on a FORTRAN project and I would like to build all of the binaries that I want to maintain on a linux machine that is dedicated for automated builds. I have successfully used mingw to build 32-bit and 64-bit binaries from C source for windows machines on the linux machine with the following packages on Ubuntu.
apt-get install mingw32
apt-get install mingw-w64
Then I run the following commands to actually compile:
gcc -b amd64-mingw32msvc -V 4.4.4 -o <...other options>
However, the mingw packages that I've obtained via apt-get do not include FORTRAN compilers.
Anybody got any ideas on what I can do?
if you got mingw32 and the Gnu C cross compiler is working for you ... when why not just get the Gnu Fortran cross compiler, too?
http://www.nber.org/sys-admin/mingw32-fortran-fedora.html
EXAMPLE apt-get install mingw32-gcc-fortran
I know this is an old thread but a few things seem to have changed and people might still be interested in the topic.
Problem: I want to use my linux machine to compile some code and create a .exe that I can send to people using Windows.
Solution: Essentially here: http ://mxe.cc/
What I did:
Check to see if your system has all the software you need here
run
git clone -b stable https://github.com/mxe/mxe.git
It will download a few small things and create the directory "mxe" (probably in your home folder)
cd into that mxe directory and run "make". HOWEVER: this would take hours and take up a few GB on your hard drive so instead run something like
make mpfr eigen opencsg cgal qt
For more ideas on how to shorten that all see this or the mxe tutorial or somewhere else ;)
The easiest way to compile stuff then seems to be something like:
~/mxe/usr/bin/i686-pc-mingw32-gfortran -c main.f95
~/mxe/usr/bin/i686-pc-mingw32-gfortran main.o -o outfile.exe
Of course you can chose something other than fortran, just consult the mxe/usr/bin to see what its called.
You can always download and install a prebuilt compiler from the MinGW(-w64) project itself:
Windows 64-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/4.6.2-1/
Windows 32-bit: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/4.6.2-1/
Just unpack somewhere and add the cross*/bin directory to PATH.
I include (obj)c(++) and fortran.
On Ubuntu 18.04 I use
apt install gfortran-mingw-w64
Then use the compiler x86_64-w64-mingw32-gfortran in place of gfortran. If you're using cmake, you can configure the compiler from the build directory like so:
FC=x86_64-w64-mingw32-gfortran cmake ..