OpenACC support in GCC - gcc

Using this tutorial I tried to install GCC with OpenACC support but unfortunately when I tried execute 'make' after this command:
$GCC5ROOT/source/gcc/configure \
--prefix= \
--target=nvptx-none \
--enable-as-accelerator-for="$target" \
--enable-languages=c,c++,fortran,lto \
--enable-checking=yes,df,fold,rtl \
--disable-multilib \
--with-sysroot=/nvptx-none \
--with-build-sysroot=$GCC5ROOT/install/nvptx-none \
--with-build-time-tools=$GCC5ROOT/install/nvptx-none/bin \
--disable-sjlj-exceptions \
--enable-newlib-io-long-long \
CC='gcc -m64'\
CXX='g++ -m64'
the following error occurs:
checking for suffix of object files... configure: error: in
`/home/nikos/Desktop/openacc/build/gcc5-accel/nvptx-none/libgcc':
configure: error: cannot compute suffix of object files: cannot
compile

Related

How to build a windows static library for lesson15 under windows platform?

I have successful built the LLVM and Halide with Visual studio 2019 on windows platform.
I then tried to make some no_runtime objs and a halide_runtime obj and link them together.
./lesson_15_generate \
-g my_first_generator \
-f my_first_generator_basic \
-e object,c_header\
-o . \
target=x86-64-windows-no_runtime
./lesson_15_generate \
-g my_first_generator \
-f my_first_generator_sse41 \
-e object,c_header\
-o . \
target=host-x86-64-windows-sse41-no_runtime
./lesson_15_generate \
-g my_first_generator \
-f my_first_generator_avx \
-e object,c_header\
-o . \
target=host-x86-64-windows-avx-no_runtime
./lesson_15_generate \
-r halide_runtime_x86 \
-e object,c_header\
-o . \
target=x86-64-windows
The windows static library was linked as follows
prompt>link.exe /out:test.lib halide_runtime_x86.obj
my_first_generator_basic.obj my_first_generator_sse41.obj
my_first_generator_avx.obj
However, the system returned with the following error
Microsoft (R) Incremental Linker Version 14.26.28806.0
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : fatal error LNK1561: entry point must be defined
Please, shed some light on how to build a static halide library on windows platform.
Problem solved by adding /lib to link.exe
prompt>link.exe /lib /out:test.lib halide_runtime_x86.obj
my_first_generator_basic.obj my_first_generator_sse41.obj
my_first_generator_avx.obj
add /lib to link.exe
prompt>link.exe /lib /out:test.lib halide_runtime_x86.obj
my_first_generator_basic.obj my_first_generator_sse41.obj
my_first_generator_avx.obj

Locally built GCC cross-compiler reports MB_LEN_MAX wrong with -D_FORTIFY_SOURCE=2

I am currently building a cross-compiler targeting the PowerPC architecture. It is capable of building Linux binaries that work and can execute on the target, however I hit a problem when I enable the compiler flag "-D_FORTIFY_SOURCE=2". I build a simple hello world application as so:
#include <limits.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
return 0;
}
I compile this using my cross-compiler and get the following error:
$ powerpc-linux-gnu-gcc -D_FORTIFY_SOURCE=2 -O2 hello.c
In file included from /opt/crossgcc/powerpc-linux-gnu/include/stdlib.h:958:0,
from hello.c:2:
/opt/crossgcc/powerpc-linux-gnu/include/bits/stdlib.h: In function 'wctomb':
/opt/crossgcc/powerpc-linux-gnu/include/bits/stdlib.h:90:3: error: #error "Assumed value of MB_LEN_MAX wrong"
# error "Assumed value of MB_LEN_MAX wrong"
^
I believe this is because I am not bootstrapping my GCC build correctly, but as far as I can see I am building it correctly. The script I am taking to build my compiler are as follows:
#! /bin/bash
set -e
INSTALL_PATH=$PWD/output
TARGET=powerpc-linux-gnu
LINUX_ARCH=powerpc
PARALLEL_MAKE=-j4
BINUTILS_VERSION=binutils-2.32
GCC_VERSION=gcc-8.3.0
LINUX_KERNEL_VERSION=linux-5.1.9
GLIBC_VERSION=glibc-2.29
export PATH=$INSTALL_PATH/bin:$PATH
cd $GCC_VERSION
./contrib/download_prerequisites
cd ..
mkdir -p build-binutils
cd build-binutils
../$BINUTILS_VERSION/configure --prefix=$INSTALL_PATH --target=$TARGET
make $PARALLEL_MAKE
make install
cd ..
cd $LINUX_KERNEL_VERSION
make ARCH=$LINUX_ARCH INSTALL_HDR_PATH=$INSTALL_PATH/$TARGET headers_install
cd ..
# Build GCC compiler
mkdir -p build-gcc
cd build-gcc
../$GCC_VERSION/configure \
--prefix=$INSTALL_PATH \
--target=$TARGET \
--disable-silent-rules \
--with-gnu-as --with-gnu-ld \
--enable-languages="c,c++" \
--enable-theads=posix \
--enable-c99 \
--enable-long-long \
--enable-lto \
--enable-libssp \
--enable-secureplt \
--disable-libmudflag \
--enable-secureplt \
--disable-nls \
--with-long-double-128
make $PARALLEL_MAKE all-gcc
make install-gcc
cd ..
mkdir -p build-glibc
cd build-glibc
../$GLIBC_VERSION/configure \
--prefix=$INSTALL_PATH/$TARGET \
--build=$(gcc -dumpmachine) \
--host=$TARGET \
--target=$TARGET \
--with-headers=$INSTALL_PATH/$TARGET/include \
libc_cv_forced_unwind=yes
make install-bootstrap-headers=yes install-headers
make $PARALLEL_MAKE csu/subdir_lib
install csu/crt1.o csu/crti.o csu/crtn.o $INSTALL_PATH/$TARGET/lib
$TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o $INSTALL_PATH/$TARGET/lib/libc.so
touch $INSTALL_PATH/$TARGET/include/gnu/stubs.h
cd ..
cd build-gcc
make $PARALLEL_MAKE all-target-libgcc
make install-target-libgcc
cd ..
cd build-glibc
make $PARALLEL_MAKE
make install
cd ..
cd build-gcc
make $PARALLEL_MAKE all
make install
cd ..
Am I incorrectly bootstrapping my GCC? Should I be doing something differently to make GCC "aware" of my glibc headers?
By default the limits.h file is not properly configured, so you need to patch it.
To fix the problem you have to go inside GCC's source directory and type the command:
cd $GCC_VERSION
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $(${TARGET}-gcc -print-libgcc-file-name)`/include-fixed/limits.h
This adds a #include_next <limits.h> to the bottom which eventually picks up the right header.
Quickly adding to Anthony, to complete the debugging do not forget at the end of this step to use:
$LFS/tools/libexec/gcc/$LFS_TGT/10.2.0/install-tools/mkheaders

make/gcc/clang looking for file with a blank filename, gives error

I have OSX 10.11.4, Xcode 7.3.1.
Using make -- calls gcc -- calls clang, I get this error where clang is looking for a file whose name is a space!
Make error 1: clang: error: no such file or directory: ' '.
That is a space!
I have no idea how to fix this. The makefile formatting is correct.
Here is the end of the output from make:
gcc -g -v -Wall -I/usr/local/include -I/opt/local/include -I/Users/m/BioPrep \
-o mod \
../mshell/runit0.o \
../mshell/tline.o \
../mshell/getshm.o \
../mshell/callLSODA.o \
../mshell/extras.o \
../mshell/nrutil.o \
../mshell/exten.o \
../choosedisp/choosedisp_main.o \
../choosedisp/choosedisp_cb.o \
../choosedisp/choosedisp_fm.o \
../connectdisps/connectdisps.o \
../connectdisps/opwsock.o \
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: error: no such file or directory: ' '
make: *** [mod] Error 1
======================= Here is the contents of the Makefile:
# This is Makefile with all graphics code removed so that a compilation of mod can proceed
# "MakefileA" has the graphics files present but commented (#) out
CC = gcc
CFLAGS = -g -v -Wall
INCL = -I/usr/local/include -I/opt/local/include -I/Users/prowat/BioPrep
LIBS = -L/usr/local/lib -L/opt/local/lib -lX11 -lforms
mod: model.o \
../mshell/runit0.o \
../mshell/tline.o \
../mshell/getshm.o \
../mshell/callLSODA.o \
../mshell/extras.o \
../mshell/nrutil.o \
../mshell/exten.o \
../choosedisp/choosedisp_main.o \
../choosedisp/choosedisp_cb.o \
../choosedisp/choosedisp_fm.o \
../connectdisps/connectdisps.o \
../connectdisps/opwsock.o \
../lsoda/liblsoda.a`
cd ../mshell; make objs`
cd ../choosedisp; make objs`
cd ../connectdisps; make objs`
$(CC) $(CFLAGS) $(INCL) \
-o mod \
../mshell/runit0.o \
../mshell/tline.o \
../mshell/getshm.o \
../mshell/callLSODA.o \
../mshell/extras.o \
../mshell/nrutil.o \
../mshell/exten.o \
../choosedisp/choosedisp_main.o \
../choosedisp/choosedisp_cb.o \
../choosedisp/choosedisp_fm.o \
../connectdisps/connectdisps.o \
../connectdisps/opwsock.o \
model.o \
-L../lsoda -llsoda \
$(LIBS) \
-lm
=====================
Please use proper formatting: for code blocks, indent by 4 spaces. The backticks are only used for fixed-width fonts inside normal text.
You may have looked for spaces, but you need to look again. Based on the output make has shown you versus your makefile, it's pretty clear that there is at least one space after the backslash at the end of this line:
../connectdisps/opwsock.o \
You can tell this because if there were no spaces after this backslash then it would be continuing to the next line and make whould show the rest of the compile line:
model.o \
-L../lsoda -llsoda \
$(LIBS) \
-lm
Since those lines are missing from the output make provided, you can be sure that there's something about the opwsock.o line which is preventing make from recognizing the backslash/newline at the end.

Build gcc with Fortran only

I am trying to compile on OS-X gfortran only with the following configuration:
./configure --prefix=${INSTALL_HERE} \
--enable-checking=release \
--disable-stage1-checking \
--enable-languages=fortran \
--disable-cloog-version-check \
--disable-isl-version-check \
--disable-libstdcxx \
--enable-lto \
--disable-nls \
--with-gmp="${GMP_DIR}" \
--with-mpc="${MPC_DIR}" \
--with-mpfr="${MPFR_DIR}" \
--with-cloog="${CLOOG_DIR}" \
--with-isl="${ISL_DIR}"
However the end result is that I have not only gfortran but the whole suite, i.e. C/C++ compilers. Why does it happen considering the fact that I have --enable-languages=fortran?!
I only need gfortran to complement clang on OS-X.
From the gcc-help list:
C & C++ are mandatory for the build procedure.
https://gcc.gnu.org/ml/gcc-help/2015-11/msg00052.html

How to add particular ffmpeg sources into config?

I have my ffmpeg confix. For example:
./configure \
--target-os=darwin \
--arch=armv7s \
--cc='xcrun -sdk iphoneos clang' \
--extra-cflags='-arch armv7s -mios-version-min=7.0' \
--extra-cxxflags='-arch armv7s -mios-version-min=7.0' \
--extra-ldflags='-arch armv7s -mios-version-min=7.0' \
--prefix=armv7s \
--enable-cross-compile \
--disable-doc \
--disable-shared \
--disable-everything \
--enable-static \
--enable-pic \
--disable-muxers \
--enable-muxer=flv \
--disable-demuxers \
--enable-demuxer=h264 \
--disable-parsers \
--enable-parser=h264 \
But in addition I need to use also other code from ffmpeg library like #include "libavcodec/golomb.h". How to add these particular sources to the config or where can I find which sources can I include with which config setting?

Resources