Meson Build System -- Cross Compiling - build-system

This is my first time using the Meson build system and I'm doing a cross compilation of a simple project; it should be straight forward but I'm getting the following error and I hope you can provide some help with it.
meson.build:1:0: ERROR: Unable to detect linker for compiler ".\tools\gcc_compiler\bin\ppc-freevle-eabi-gcc -Wl,--version -c -mcpu=e200z4 -mvle -meabi -msdata=none -mregnames -O2 -gdwarf-2 -fomit-frame-pointer -falign-functions=16 -fno-gcse -std=gnu99"
This is what my cross_file.build looks like:
[constants]
compiler_path = '.\tools\gcc_compiler\bin\'
arch = 'ppc-freevle-eabi'
[binaries]
c = compiler_path + arch + '-gcc'
cpp = compiler_path + arch + '-cpp'
ld = compiler_path + arch + '-ld'
ar = compiler_path + arch + '-ar'
as = compiler_path + arch + '-as'
size = compiler_path + arch + '-size'
objdump = compiler_path + arch + '-objdump'
objcopy = compiler_path + arch + '-objcopy'
strip = compiler_path + arch + '-strip'
gdb = compiler_path + arch + '-gdb'
[built-in options]
c_args = [
'-c',
'-mcpu=e200z4',
'-mvle',
'-meabi',
'-msdata=none',
'-mregnames',
'-O2',
'-gdwarf-2',
'-fomit-frame-pointer',
'-falign-functions=16',
'-fno-gcse',
'-std=gnu99'
]
c_link_args = [
'-mcpu=e200z4',
'-mvle',
'-meabi',
'-msdata=none',
'-mregnames',
'-O2',
'-gdwarf-2',
'-fomit-frame-pointer',
'-falign-functions=16',
'-fno-gcse',
'-std=gnu99',
'-ffunction-sections',
'-fdata-sections',
'-fno-common',
'-nostartfiles',
'-Wl,-Map=build/out.map',
'--cref,--no-warn-mismatch,--library-path=,--gc-sections,-lm,-lc,-z,max-page-size=16384,--script=application.ld -o build/out.elf'
]
[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
If I execute the same command in the command line, I don't get any error, but for some reason meson does not like, any idea?
Thanks!

Related

Cannot launch VS Code from WSL terminal after disabled the path sharing feature

I have export path in .bashrc. But when typecode in terminal, there is no response.
Debug output:
+ COMMIT=e5a624b788d92b8d34d1392e4c4d9789406efe8f
+ APP_NAME=code
+ QUALITY=stable
+ NAME=Code
+ DATAFOLDER=.vscode
+ realpath /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/bin/code
+ dirname /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/bin/code
+ dirname /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/bin
+ VSCODE_PATH=/mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code
+ ELECTRON=/mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/Code.exe
+ IN_WSL=false
+ [ -n Ubuntu-20.04 ]
+ IN_WSL=true
+ [ true = true ]
+ export WSLENV=ELECTRON_RUN_AS_NODE/w:WT_SESSION::WT_PROFILE_ID
+ wslpath -m /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
+ CLI=C:/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
+ WSL_EXT_ID=ms-vscode-remote.remote-wsl
+ ELECTRON_RUN_AS_NODE=1 /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/Code.exe C:/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js --locate-extension ms-vscode-remote.remote-wsl
+ cat /tmp/remote-wsl-loc.txt
+ WSL_EXT_WLOC=
+ [ -n ]
+ ELECTRON_RUN_AS_NODE=1 /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/Code.exe C:/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js .
+ exit 1

File format not recognized error while installing CBLAS on a Ubuntu machine

I need to install CBLAS on an Ubuntu 16.04.4 machine. The following values have been set in the Makefile.in file of CBLAS:
SHELL = /bin/sh
PLAT = LINUX
BLLIB = /home/ubuntu/BLAS-3.8.0/blas_LINUX.a
CBLIB = /home/ubuntu/CBLAS/lib/cblas_LINUX.a
CC = gcc
FC = gfortran
LOADER = $(FC)
CFLAGS = -O3 -DADD_ -fPIC
FFLAGS = -O3 -fPIC
ARCH = gcc
ARCHFLAGS = -shared -o
RANLIB = ranlib
However, while running the make command I run into following error:
ranlib: /home/ubuntu/CBLAS/lib/cblas_LINUX.a: File format not recognized
The following is the stack trace:
Can someone suggest how this can be resolved?
CBLAS shared libraries : sudo apt install libatlas3-base libatlas-base-dev
libatlas3-base provides
/usr/lib/atlas-base/atlas/libblas.so.3
/usr/lib/atlas-base/atlas/libblas.so.3.0
/usr/lib/atlas-base/atlas/liblapack.so.3
/usr/lib/atlas-base/atlas/liblapack.so.3.0
/usr/lib/atlas-base/libatlas.so.3
/usr/lib/atlas-base/libatlas.so.3.0
/usr/lib/atlas-base/libcblas.so.3
/usr/lib/atlas-base/libcblas.so.3.0
/usr/lib/atlas-base/libf77blas.so.3
/usr/lib/atlas-base/libf77blas.so.3.0
/usr/lib/atlas-base/liblapack_atlas.so.3
/usr/lib/atlas-base/liblapack_atlas.so.3.0
/usr/lib/libatlas.so.3
/usr/lib/libcblas.so.3 ← ←
/usr/lib/libf77blas.so.3
/usr/lib/liblapack_atlas.so.3
libatlas-base-dev provides
/usr/lib/atlas-base/atlas/libblas.a
/usr/lib/atlas-base/atlas/libblas.so
/usr/lib/atlas-base/atlas/liblapack.a
/usr/lib/atlas-base/atlas/liblapack.so
/usr/lib/atlas-base/libatlas.a
/usr/lib/atlas-base/libatlas.so
/usr/lib/atlas-base/libcblas.a
/usr/lib/atlas-base/libcblas.so
/usr/lib/atlas-base/libf77blas.a
/usr/lib/atlas-base/libf77blas.so
/usr/lib/atlas-base/liblapack_atlas.a
/usr/lib/atlas-base/liblapack_atlas.so
/usr/lib/libatlas.a
/usr/lib/libatlas.so
/usr/lib/libcblas.a
/usr/lib/libcblas.so ← ←
/usr/lib/libf77blas.a
/usr/lib/libf77blas.so
/usr/lib/liblapack_atlas.a
/usr/lib/liblapack_atlas.so

Compile a static version of pngquant

I'm trying to create a statically linked version of pngquant in Oracle Linux Server release 7.1. I've compiled the static version of zlib and the static version of libpng.
Then, when I configure pngquant, I always get the information that it will be linked with a shared version of zlib.
$ ./configure --with-libpng=../libpng-1.6.21 --extra-cflags="-I../zlib-1.2.8" --extra-ldflags="../zlib-1.2.8/libz.a"
Compiler: gcc
Debug: no
SSE: yes
OpenMP: no
libpng: static (1.6.21)
zlib: shared (1.2.7)
lcms2: no
If I execute make, in the output it seems that the options are correctly passed to the compiler. However, the resulting binary requires libz.so to be executed. It seems that my directives are ignored or that the installed version always takes precedence.
Is there any way of forcing pngquant to be compiled with the static version of zlib?
I'm not sure, if I got it right, but here's a patch to pngquant's configure that worked for me. configure now accepts --with-zlib=<dir> as parameter. Store it to pngquant.patch and apply it with patch -uN -p1 -i pngquant.patch.
diff -ur pngquant-2.9.0/configure pngquant-2.9.0.fixed/configure
--- pngquant-2.9.0/configure 2017-03-06 09:37:30.000000000 +0100
+++ pngquant-2.9.0.fixed/configure 2017-03-07 09:57:20.246012152 +0100
## -48,6 +48,7 ##
help "--with-cocoa/--without-cocoa use Cocoa framework to read images"
fi
help "--with-libpng=<dir> search for libpng in directory"
+ help "--with-zlib=<dir> search for zlib in directory"
echo
help "CC=<compiler> use given compiler command"
help "CFLAGS=<flags> pass options to the compiler"
## -97,6 +98,9 ##
--with-libpng=*)
LIBPNG_DIR=${i#*=}
;;
+ --with-zlib=*)
+ ZLIB_DIR=${i#*=}
+ ;;
--prefix=*)
PREFIX=${i#*=}
;;
## -238,6 +242,19 ##
echo "${MAJ}${MIN}"
}
+# returns full zlib.h version string
+zlibh_string() {
+ echo "$(grep -m1 "define ZLIB_VERSION" "$1" | \
+ grep -Eo '"[^"]+"' | grep -Eo '[^"]+')"
+}
+
+# returns major minor version numbers from png.h
+zlibh_majmin() {
+ local MAJ=$(grep -m1 "define ZLIB_VER_MAJOR" "$1" | grep -Eo "[0-9]+")
+ local MIN=$(grep -m1 "define ZLIB_VER_MINOR" "$1" | grep -Eo "[0-9]+")
+ echo "${MAJ}${MIN}"
+}
+
error() {
status "$1" "error ... $2"
echo
## -420,11 +437,42 ##
error "libpng" "not found (try: $LIBPNG_CMD)"
fi
-# zlib
-if ! find_library "zlib" "z" "zlib.h" "libz.a" "libz.$SOLIBSUFFIX*"; then
- error "zlib" "not found (please install zlib-devel package)"
+# try if given flags are enough for zlib
+HAS_ZLIB=0
+if echo "#include \"zlib.h\"
+ int main(){
+ uLong test = zlibCompileFlags();
+ return 0;
+}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - &> /dev/null; then
+ status "zlib" "custom flags"
+ HAS_ZLIB=1
fi
+if [ "$HAS_ZLIB" -eq 0 ]; then
+ # try static in the given directory
+ ZLIBH=$(find_h "$ZLIB_DIR" "zlib.h")
+ if [ -n "$ZLIBH" ]; then
+ ZLIBH_STRING=$(zlibh_string "$ZLIBH")
+ ZLIBH_MAJMIN=$(zlibh_majmin "$ZLIBH")
+ if [[ -n "$ZLIBH_STRING" && -n "$ZLIBH_MAJMIN" ]]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz${ZLIBH_MAJMIN}.a")
+ if [ -z "$ZLIBA" ]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz.a")
+ fi
+ if [ -n "$ZLIBA" ]; then
+ cflags "-I${ZLIBH%/*}"
+ lflags "${ZLIBA}"
+ status "zlib" "static (${ZLIBH_STRING})"
+ HAS_ZLIB=1
+ fi
+ fi
+ fi
+fi
+# zlib
+if ! find_library "zlib" "z" "zlib.h" "libz.a" "zlib.$SOLIBSUFFIX*"; then
+ error "zlib" "not found (please install zlib-devel package)"
+fi
+
# lcms2
if [ "$LCMS2" != 0 ]; then
if find_library "lcms2" "lcms2" "lcms2.h" "liblcms2.a" "liblcms2.$SOLIBSUFFIX*"; then
Sorry, the configure script does not support it. It shouldn't be too hard to modify configure to pass appropriate flags to pkg-config or do the same workaround it does for libpng.

Logstash v2.2.0 fails to start as a service

+ PATH=/sbin:/usr/sbin:/bin:/usr/bin
+ export PATH
+ id -u
+ [ 0 -ne 0 ]
+ name=logstash
+ pidfile=/var/run/logstash.pid
+ LS_USER=logstash
+ LS_GROUP=logstash
+ LS_HOME=/var/lib/logstash
+ LS_HEAP_SIZE=1g
+ LS_LOG_DIR=/var/log/logstash
+ LS_LOG_FILE=/var/log/logstash/logstash.log
+ LS_CONF_DIR=/etc/logstash/conf.d
+ LS_OPEN_FILES=16384
+ LS_NICE=19
+ LS_OPTS=
+ [ -r /etc/default/logstash ]
+ . /etc/default/logstash
+ KILL_ON_STOP_TIMEOUT=0
+ [ -r /etc/sysconfig/logstash ]
+ program=/opt/logstash/bin/logstash
+ args=agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
+ status
+ [ -f /var/run/logstash.pid ]
+ cat /var/run/logstash.pid
+ pid=12716
+ kill -0 12716
+ return 2
+ code=2
+ [ 2 -eq 0 ]
+ start
+ LS_JAVA_OPTS= -Djava.io.tmpdir=/var/lib/logstash
+ HOME=/var/lib/logstash
+ export PATH HOME LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
+ id -Gn logstash
+ + sed s/,$//
tr ,
+ echo
+ SGROUPS=logstash
+ [ ! -z logstash ]
+ EXTRA_GROUPS=--groups logstash
+ ulimit -n 16384
+ echo 22073
+ echo logstash started.
logstash started.
+ return 0
+ code=0
+ exit 0
+ nice -n 19 chroot --userspec logstash:logstash --groups logstash / sh -c
cd /var/lib/logstash
ulimit -n 16384
exec "/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
The above is the command output when the logstash service is started.
(Got this by adding -x switch to the start of the init.d script - #!/bin/sh -x)
Logstash v2.2.0 is installed using the DEB package on Ubuntu 14.04
When I run the exec command that is used by the init script (as seen in the above output) logstash startups pretty fine and works flawlessly
"/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
There is something in the init.d service script that causes logstash to fail as a service. I suspect the nice command that the init script uses.
Do you guys see any issues with the 'nice' command that is being used in the init script ?
+ nice -n 19 chroot --userspec logstash:logstash --groups logstash / sh -c
cd /var/lib/logstash
ulimit -n 16384
exec "/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
When you have uninstalled older version, the logstash user and group was also removed. Now with new installation a new logstash user and group was created with different uid and gid. Yet the ownership of common logstash directories belongs to the old logstash uid and gid.
Now when you start new logstash it tries to read/write to this dir and fails hence logstash not running.
Try changing ownership of these dir and start logstash
chown -R logstash:logstash /var/log/logstash
chown -R logstash:logstash /var/lib/logstash
chown -R logstash:logstash /etc/logstash
rm -rf /var/run/logstash.pid
/etc/init.d/logstash start

How to resolve make: *** [sdram] Error 1 at Eclipse

I'm trying to make a new project at Eclipse to my AT91sam9260 board.
This project is based on two atmel examples: basic-ssc-i2s and basic-emac-uip-telnet.
But when I'm working with these examples together, appear the error below:
make: * [sdram] Error 1
I don't know why, I've been thinking about and I think that is because has some error at Makefile file!
Anyone could help me?
Thank
The makefile:
CHIP = at91sam9260
BOARD = at91sam9260-ek
# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
TRACE_LEVEL = 4
# Optimization level, put in comment for debugging
#OPTIMIZATION = -Os
# AT91 library directory
AT91LIB = ../at91lib
# Output file basename
OUTPUT = basic-ssc-i2s-at73c213-project-$(BOARD)-$(CHIP)
# Compile for all memories available on the board (this sets $(MEMORIES))
include $(AT91LIB)/boards/$(BOARD)/board.mak
# Output directories
BIN = bin
OBJ = obj
#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
# Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi-
# Compilation tools
CC = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
# Flags
INCLUDES = -I$(AT91LIB)/boards/$(BOARD) -I$(AT91LIB)/peripherals
INCLUDES += -I$(AT91LIB)/components -I$(AT91LIB) -I.
CFLAGS = -Wall -mlong-calls -mstructure-size-boundary=8 -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -g $(OPTIMIZATION) -nostartfiles -Wl,--gc-sections
#-------------------------------------------------------------------------------
# Files
#-------------------------------------------------------------------------------
# Directories where source files can be found
PERIPH = $(AT91LIB)/peripherals
BOARDS = $(AT91LIB)/boards
UTILITY = $(AT91LIB)/utility
COMP = $(AT91LIB)/components
# uIP library directory
UIPLIB = ../external_libs/ethernet/uip
VPATH += $(COMP)/dac-at73c213
VPATH += $(COMP)/ethernet/dm9161
VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu $(PERIPH)/pio $(PERIPH)/aic $(PERIPH)/ssc $(PERIPH)/spi $(PERIPH)/pmc
VPATH += $(PERIPH)/cp15 $(PERIPH)/emac $(PERIPH)/rstc $(PERIPH)/usart $(PERIPH)/tc
VPATH += $(BOARDS)/$(BOARD) $(BOARDS)/$(BOARD)/$(CHIP)
VPATH += $(UIPLIB)/uip
VPATH += $(UIPLIB)/lib
VPATH += $(UIPLIB)/apps/dhcpc
#VPATH += $(UIPLIB)/apps/telnetd
INCLUDES += -I$(UTILITY)
INCLUDES += -I$(UIPLIB)/uip
INCLUDES += -I$(UIPLIB)/lib
INCLUDES += -I$(UIPLIB)/apps/dhcpc
#INCLUDES += -I$(UIPLIB)/apps/telnetd
# Objects built from C source files
C_OBJECTS = main.o
C_OBJECTS += at73c213.o dm9161.o protocol.o
C_OBJECTS += wav.o stdio.o math.o emac.o rstc.o tc.o usart.o
C_OBJECTS += dbgu.o pio.o ssc.o aic.o spi.o pmc.o cp15.o
C_OBJECTS += board_memories.o board_lowlevel.o
#UIP:
#lib
C_OBJECTS += memb.o
#uip
C_OBJECTS += psock.o timer.o uip.o uip_arp.o
#main
C_OBJECTS += clock-arch.o tapdev.o
#dhcp
C_OBJECTS += dhcpc.o
#telnetd
#C_OBJECTS += shell.o telnetd.o
# Objects built from Assembly source files
ASM_OBJECTS = board_cstartup.o
ASM_OBJECTS += cp15_asm.o
# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT)
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
all: $(BIN) $(OBJ) $(MEMORIES)
$(BIN) $(OBJ):
mkdir $#
define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$#.lds" -o $(OUTPUT)-$$#.elf $$^
$(OBJCOPY) -O binary $(OUTPUT)-$$#.elf $(OUTPUT)-$$#.bin
$(SIZE) $$^ $(OUTPUT)-$$#.elf
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$# $$<
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC) $(ASFLAGS) -D$(1) -c -o $$# $$<
debug_$(1): $(1)
perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf
endef
$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))
clean:
-rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf