Building riscv-gnu-toolchain - gcc

I'm building the riscv-gnu-toolchain here: https://github.com/riscv-collab/riscv-gnu-toolchain like this:
git clone https://github.com/riscv/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
git submodule update --init --recursive
export RISCV=/opt/riscv
./configure --prefix="${RISCV}" --enable-multilib
make linux
When compiling during the build of gcc I get this error:
/mnt/data/opt/riscv/sysroot/usr/include/gnu/stubs.h:8:11: fatal error:
gnu/stubs-ilp32.h: No such file or directory
8 | # include <gnu/stubs-ilp32.h>
| ^~~~~~~~~~~~~~~~~~~
I have glibc-devel.i686 and glibc-devel.x86_64 installed on CentOS Stream 8. It's a new install and all up to date. I did follow the instructions and installed the prerequisites.
I think there is something I'm missing in the prerequisites (not listed). Can someone point out what that might be?
I do need to enable multilib since this is for seL4. Here: https://docs.sel4.systems/Hardware/spike.html

I was able to get this to build with the exact steps above:
git clone https://github.com/riscv/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
git submodule update --init --recursive
export RISCV=/opt/riscv
./configure --prefix="${RISCV}" --enable-multilib
make linux
What I did differently is not building newlib first. I use both versions of toolchain--one with newlib and one with glibc. I guess some left over configs from newlib cause this error.
I wiped out my /opt/riscv directory and the local git repo. I recloned and followed the above steps. It builds after that.

Related

Install pg_trgm on postgres 9.4.24

I'm trying to use the similarity function on a Greemplum system using postgres 9.4.24 version.
The Greenplum System is running on a CentOS 7 cluster (CentOS Linux release 7.9.2009 (Core))
I've managed to install the postgresql-contrib package by running this:
sudo yum install postgresql-contrib.x86_64
However, when I run this command on a DB:
create extension pg_trgm();
I get the following:;
SQL Error [58P01]: ERROR: could not open extension control file "/usr/local/greenplum-db-6.13.0/share/postgresql/extension/pg_trgm.control": No such file or directory
I looked in the directory and the pg_trgm.control wasn't there but I was expecting it since I installed the contrib package.
Is there anything I missed?
I found the contrib repository for Greenplum and downloaded the code here:
https://github.com/greenplum-db/gpdb/tree/master
which includes the contrib directory with all the extensions..
however, when I try to make && make install, I get an error:
[gpadmin#mdw pg_trgm]$ sudo make
Makefile:22: ../../src/Makefile.global: No such file or directory
Makefile:23: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.
Looking at the directory structure and files, Makefile.global doesn't exists and contrib-global.mk does but not sure if the path is correct, I can try changing the path in the Makefile but not sure.
These are the contents of the Makefile file:
# contrib/pg_trgm/Makefile
MODULE_big = pg_trgm
OBJS = trgm_op.o trgm_gist.o trgm_gin.o trgm_regexp.o $(WIN32RES)
EXTENSION = pg_trgm
DATA = pg_trgm--1.3--1.4.sql \
pg_trgm--1.3.sql pg_trgm--1.2--1.3.sql pg_trgm--1.1--1.2.sql \
pg_trgm--1.0--1.1.sql pg_trgm--unpackaged--1.0.sql
PGFILEDESC = "pg_trgm - trigram matching"
REGRESS = pg_trgm pg_word_trgm pg_strict_word_trgm
REGRESS_OPTS += --init-file=$(top_srcdir)/src/test/regress/init_file
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_trgm
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
I have checked out the code in my /tmp folder and it created the structure under /tmp/gpdb
UPDATE:
I did follow Bradford suggestions and was able to compile and install, however, I'm getting this when I run:
create extension pg_trgm;
ERROR: could not open extension control file "/usr/local/greenplum-db-6.13.0/share/postgresql/extension/pg_trgm.control": No such file or directory (seg57 172.28.8.8:6001 pid=146663)
I did run manually once I ran the make and make install:
/usr/bin/install -c -m 755 pg_trgm.so '/usr/local/greenplum-db-6.13.0/lib/postgresql/pg_trgm.so'
/usr/bin/install -c -m 644 pg_trgm.control '/usr/local/greenplum-db-6.13.0/share/postgresql/extension/'
/usr/bin/install -c -m 644 pg_trgm--1.1.sql pg_trgm--1.0--1.1.sql pg_trgm--unpackaged--1.0.sql '/usr/local/greenplum-db-6.13.0/share/postgresql/extension/'
I can see the .control file in there so not sure what's going on, it seems it was copied only to the master but not the segment hosts, would that be an issue? Do I need to compile this on every segment host?
UPDATE:
I did install on each segment and now I'm getting this:
SQL Error [0A000]: ERROR: query plan with multiple segworker groups is not supported
Hint: likely caused by a function that reads or modifies data in a distributed table
would this extension not be supported by greenplum?
At a high level, you will want to download the source for the release of GPDB that you are running. You can do this either by downloading the tarball from the GitHub release page or cloning the repository and checking-out the release tag.
Once you have done that, source greenplum_path.sh from your installation of GPDB, change into the the contrib/pg_trgm directory and run
USE_PGXS=true make
USE_PGXS=true make install
Setting USE_PGXS will pull in the missing Makefiles from the installation of GPDB.
If the install location of GPDB is not owned by gpadmin user, then the make install will fail for permission issues; using sudo make install will most likely fail because pg_config won't be found on the path. In that case, I just run make -n install and then manually run the commands prefixed with sudo.
Here are all the steps in a psuedo-shell session:
git clone https://github.com/greenplum-db/gpdb.git
cd gpdb
# use git checkout 6.13.0 for older versions of git
git switch --detach 6.13.0
git submodule update --init --recursive
source /usr/local/greenplum-db-6.13.0/greenplum_path.sh
cd contrib/pg_trgm
USE_PGXS=true make
USE_PGXS=true make -n install
Edit: I should clarify that I haven't tested if pg_trgm works with GPDB, only that it builds and compiles.

Replace go-swagger with another version in Windows

I am using go1.14.1 and go-swagger version dev in my Windows 10. I installed go-swagger with Installing from source.
I'd like to use go-swagger version 0.25 instead. What is the clean way of replacing dev with 0.25?
The installation process is same as for master (dev) version except you need to do one more additional step which is checking out tag v0.25.0 after cloning the repo to temporary directory:
dir=$(mktemp -d)
git clone https://github.com/go-swagger/go-swagger "$dir"
cd "$dir"
# Checkout version v0.25.0
git checkout v0.25.0
# Continue with installation, instead of
# go install ./cmd/swagger
# use this which just adds version information (current tag) and commit id to binary
go install -ldflags "-X github.com/go-swagger/go-swagger/cmd/swagger/commands.Version=$(git describe --tags) -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Commit=$(git rev-parse HEAD)" ./cmd/swagger
NOTE: If you do just go install ./cmd/swagger it will technically still install v0.25.0 but swagger version subcommand will report it as dev. The version information is just a cosmetic thing passed from git repository down as content of variables in commands package and you can see how authors do it in their CircleCI config file here. Eventually you can add also other flags to get static build (but they don't do that in official Installing from source instructions).
Once done you should have go-swagger v0.25.0 installed in your $GOPATH/bin, verify with:
$ swagger version
version: v0.25.0
commit: f032690aab0634d97e2861a708d8fd9365ba77d2

esp-idf path doesn't override when esp-iot-solution repository is used

I have cloned the esp-idf-solution repository and followed the instructions in readme.md file.
I already have esp-idf repository cloned before and can compile and flash successfully. But when I try to compile the new examples in esp-iot-solution it doesn't work.
$ make flash
Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5
Compiler version: 5.2.0
Makefile:11: /home/abish/esp/esp-iot-solution/Makefile: No such file or directory
make: *** No rule to make target '/home/abish/esp/esp-iot-solution/Makefile'. Stop.
I have followed this step in readme.md export IOT_SOLUTION_PATH=~/esp/esp-iot-solution. This doesn't override the IDF_PATH. How to solve this?
It looks like esp-idf is already included as a git submodule in the esp-idf-solution project, so you shouldn't have to separately clone the esp-idf repository (see https://github.com/espressif/esp-iot-solution/tree/master/submodule).
But make sure you tell git to clone the submodules from within the esp-idf-solution project.
cd /home/abish/esp/esp-iot-solution/
git submodule update --init --recursive
late answer but maybe helpful. I am beginner, so take this with caution. When you type in command prompt:
export IOT_SOLUTION_PATH=~/esp/esp-iot-solution
you are calling export.bat file in esp directory, but I think export is Linux command. Maybe you should type in command prompt:
set IOT_SOLUTION_PATH=%IDF_PATH%\esp-iot-solution
or
set IOT_SOLUTION_PATH=%IDF_PATH%/esp-iot-solution
or to add this line somewhere in export.bat file. Without this environment variable set, IOT solution cannot be used nor configuration cannot be done (idf.py menuconfig)
Regards

Getting cmake to work under Cygwin on Windows 7

I installed the latest Cygwin on my Windows 7 machine: version 2.893 (64-bits). I made sure I included cmake, i.e. I was able to add several packages by running the Cygwin net release setup program again, after doing the first installation. I then tried to use cmake and made sure I invoked it from the bin directory:
user008#L0147816 /bin
$ ./cmake
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
//share/cmake-3.6.2
Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
Run 'cmake --help' for more information.
I don't know where the build directory could be. I'm relatively new to Cygwin. I hope somebody has found a solution for getting cmake installed and working properly under Cygwin.
This looks cmake 101.
Assuming you want to just build a software download from somewhere
eg gl2ps:
# choosing a test area
$ cd /tmp
# downloading source
$ wget http://geuz.org/gl2ps/src/gl2ps-1.4.0.tgz
# expanding source code
$ tar -xf gl2ps-1.4.0.tgz
$ ls gl2ps-1.4.0-source/
CMakeLists.txt COPYING.LGPL gl2ps.h gl2ps.tex gl2psTestSimple.c
COPYING.GL2PS gl2ps.c gl2ps.pdf gl2psTest.c README.txt
# preparing a build area
$ mkdir build
$ cd build
# invoking cmake and pointing to the source directory
$ cmake ../gl2ps-1.4.0-source/
-- The C compiler identification is GNU 7.3.0
[cut ...]
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/build
# running the build
$ make
Scanning dependencies of target shared
[ 11%] Building C object CMakeFiles/shared.dir/gl2ps.o
...
[ 88%] Building C object CMakeFiles/gl2psTestSimple.dir/gl2psTestSimple.o
[100%] Linking C executable gl2psTestSimple.exe
[100%] Built target gl2psTestSimple
Instead for learning how to build with cmake, go to
https://cmake.org/cmake-tutorial/
Here a solution I just found.
Let's name 3 directories:
{cygwin64-path}/bin/: cmake.exe is here.
{cygwin64-path}/usr/share/: cmake module directory (such as cmake-3.20.0) is here.
{cygwin64-path}/share/: cmake.exe trying to find cmake-module-directory here, but it doesn't exist.
It's wired because cygwin install cmake-module-directory in {cygwin64-path}/usr/share/, but cmake.exe looks for the directory in {cygwin64-path}/share/.
So solution is simple. Each one below works.
METHOD 1: Create the directory {cygwin64-path}/share/ and copy all relevant directories and files from {cygwin64-path}/usr/share/ to the new directory.
METHOD 2: Create a Symbolic links {cygwin64-path}/share/ to {cygwin64-path}/usr/share/.
In windows 10 Administrator cmd.exe: mklink /J share usr\share and all works.
Or use WSL or Cygwin64 Terminal: ln -s usr/share share

Compiling a specific version of a freeBSD utility

I want to compile and run a specific version of a FreeBSD utility from the source code.
For example, I downloaded the repo for the following utility: https://svnweb.freebsd.org/base/stable/9/sbin/routed/
However, when I run the make command, I get the following error:
"../Makefile.inc", line 3: Cannot open ../Makefile.inc
make: fatal errors encountered -- cannot continue
*** [all] Error code 1
Can someone point me in the right direction?
You will need to download the whole source tree. The build system depends on pieces from different locations in the tree. Then;
Unpack the source in /usr/src
cd /usr/src/sbin/routed
make && make install
It looks like you want the 9-stable branch? If you have subversion available, you can do:
rm -rf /usr/src/
svn co svn://svn.freebsd.org/base/stable/9 /usr/src
(Depending on your FreeBSD version, svn may also be called svnlite) Also see the handbook.
On my machine, the complete /usr/src tree is 2445 MiB, including the .svn directory.
Edit: Note that it a program relies on system calls, library functions or other features that were introduced in a certain branch/version of FreeBSD, it will not work on older branches/versions.

Resources