pulp-platform / hero-sdk

⛔ DEPRECATED ⛔ HERO Software Development Kit
https://www.pulp-platform.org/hero
Apache License 2.0
20 stars 6 forks source link

Hero openmp examples linker error #46

Open lukamac opened 5 years ago

lukamac commented 5 years ago

Bug description When building the helloworld example, linker reports that it cannot find -lhero-target although libhero-target.so exists and path given to the linker with -L flag is valid.

To Reproduce

  1. source scripts/hero-z-7045-env.sh
  2. cd hero-openmp-examples/helloworld
  3. make clean all
  4. Build fails

Console output

root@38574fee9dc5:/hero-sdk/hero-openmp-examples/helloworld# make all
arm-linux-gnueabihf-gcc  -O3 -g3 -fopenmp -Wall -I. -I../common -I/hero-sdk/libhero-target/inc    -c -o helloworld.o helloworld.c
arm-linux-gnueabihf-gcc  -O3 -g3 -fopenmp -Wall -I. -I../common -I/hero-sdk/libhero-target/inc  helloworld.o  -L/hero-sdk/libhero-target/lib -lhero-target -o helloworld
/hero-sdk/hero-gcc-toolchain/install/lib/gcc/arm-linux-gnueabihf/7.1.1/accel/riscv32-unknown-elf/../../../../../../riscv32-unknown-elf/bin/ld: cannot find -lhero-target
collect2: error: ld returned 1 exit status
lto-wrapper: fatal error: /hero-sdk/hero-gcc-toolchain/install/libexec/gcc/arm-linux-gnueabihf/7.1.1//accel/riscv32-unknown-elf/mkoffload terminated with signal 11 [Segmentation fault], core dumped
compilation terminated.
/hero-sdk/hero-gcc-toolchain/install/lib/gcc/arm-linux-gnueabihf/7.1.1/../../../../arm-linux-gnueabihf/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
/hero-sdk/hero-openmp-examples/helloworld/../common/default.mk:36: recipe for target 'helloworld' failed
make: *** [helloworld] Error 1

OS and environment information Output of lsb_release -a:

LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial

Output of env:

BOARD=zc706
HOSTNAME=38574fee9dc5
PULP_CURRENT_CONFIG=hero-z-7045@config_file=/hero-sdk/pulp-sdk/configs/json/hero-z-7045.json
HERO_SUPPORT_DIR=/hero-sdk/hero-support
PULP_RISCV_GCC_TOOLCHAIN=/hero-sdk/hero-gcc-toolchain/install
TERM=xterm
PULP_CURRENT_CONFIG_ARGS=platform=hsa
HERO_SDK_DIR=/hero-sdk
HERO_TARGET_PATH=/mnt/storage
LIBGOMP_PLUGIN_PULP_HERO_LDFLAGS=-L/hero-sdk/hero-support/libpulp/lib -lpulp -lstdc++
HERO_PULP_SDK_DIR=/hero-sdk/pulp-sdk
OLDPWD=/hero-sdk/hero-openmp-examples
KERNEL_CROSS_COMPILE=arm-linux-gnueabihf-
PULP_HERO_EXTLDFLAGS=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/hero/hero-z-7045/rt_conf.o /hero-sdk/pulp-sdk/pkg/sdk/dev/install/lib/hero-z-7045/rt/crt0.o -nostartfiles -nostdlib -Wl,--gc-sections -T/hero-sdk/pulp-sdk/pkg/sdk/dev/install/hero/hero-z-7045/test.ld -T/hero-sdk/pulp-sdk/pkg/sdk/dev/install/hero/hero-z-7045/test_config.ld -L/hero-sdk/pulp-sdk/pkg/sdk/dev/install/lib/hero-z-7045 -lgomp -lrt -lrtio -lrt -lhero-target -lvmm -larchi_host -lrt -larchi_host -lgcc -lbench -lm
LD_LIBRARY_PATH=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/ws/lib:/hero-sdk/hero-gcc-toolchain/install/lib
KERNEL_ARCH=arm
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
PULP_SDK_WS_INSTALL=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/ws
HERO_TARGET_PATH_DRIVER=/mnt/storage/drivers
HERO_LINUX_WORKSPACE_DIR=/hero-sdk/linux-workspace
HERO_TARGET_HOST=root@161.53.67.199
PATH=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/ws/bin:/hero-sdk/hero-gcc-toolchain/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PULP_HERO_EXTCFLAGS=-march=rv32imcxpulpv2 -D__riscv__ -DPLATFORM=2 -Wextra -Wall -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wundef -fdata-sections -ffunction-sections -I/hero-sdk/pulp-sdk/pkg/sdk/dev/install/include/io -I/hero-sdk/pulp-sdk/pkg/sdk/dev/install/include
HERO_TOOLCHAIN_DIR=/hero-sdk/hero-gcc-toolchain
HERO_OMP_EXAMPLES_DIR=/hero-sdk/hero-openmp-examples
PWD=/hero-sdk/hero-openmp-examples/helloworld
PULP_SDK_HOME=/hero-sdk/pulp-sdk/pkg/sdk/dev
KERNEL_DIR=/hero-sdk/linux-workspace/linux-xlnx
HERO_PULP_INC_DIR=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/include
HERO_GCC_INSTALL_DIR=/hero-sdk/hero-gcc-toolchain/install
PULP_SDK_INSTALL=/hero-sdk/pulp-sdk/pkg/sdk/dev/install
PLATFORM=2
SHLVL=1
HOME=/root
HERO_TARGET_PATH_LIB=/mnt/storage/libs
LIBGOMP_PLUGIN_PULP_HERO_CPPFLAGS=-O3 -Wall -g2 -shared -fPIC -I/hero-sdk/hero-support/libpulp/inc -I/hero-sdk/pulp-sdk/pkg/sdk/dev/install/include/archi/chips/bigpulp -I/hero-sdk/pulp-sdk/pkg/sdk/dev/install/include -DPLATFORM=2
PYTHONPATH=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/ws/python:/hero-sdk/pulp-sdk/pkg/sdk/dev/install/ws/python
HERO_LINUX_KERNEL_DIR=/hero-sdk/linux-workspace/linux-xlnx
HERO_TARGET_PATH_APPS=/mnt/storage/apps
LESSOPEN=| /usr/bin/lesspipe %s
ARCH=arm
PULP_CONFIGS_PATH=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/ws/configs
CROSS_COMPILE=arm-linux-gnueabihf-
HERO_LIBPULP_DIR=/hero-sdk/hero-support/libpulp
LESSCLOSE=/usr/bin/lesspipe %s %s
SDK_TILER_PATH=/hero-sdk/pulp-sdk/pkg/sdk/dev/install/auto-tiler
_=/usr/bin/env

Additional context I am working in a docker image.

alessandrocapotondi commented 5 years ago

Dear @lukamac,

Interesting issue, thanks for your report. I will give you a feedback as soon as possible.

Alessandro

lukamac commented 5 years ago

Dear @alessandrocapotondi,

I have found the solution to the problem be running the last step from the builder script, in other words running ./hero-z-7045-builder -i, even though another computer has already done this step and the driver is already running on the board. The problem arose from my misunderstanding that the install step of the builder script only cross-compiles the necessary drivers and programs for the board and copies them over ssh to the board.

In my opinion this is not that intuitive and could maybe be better that the builder script enables building the examples without having the board already plugged in and ready with the built linux on.

Hope this helps. Ask me for any further information that you need.