So I'm doing a simple thing in my rust project which is updating a dependency on git2 from 0.13.25 to 0.14.2. I want to then make a complete build with Nix. When I do a nix-build nix-build nix/ci -A actions.packages.alerting -K (alerting is my project).
I get among other things output:
Building build.rs (libgit2_sys)
Running rustc --crate-name build_script_build build.rs --crate-type bin -C debuginfo=2 -C embed-bitcode=no --edition 2018 --cfg feature="default" --cfg feature="https" --cfg feature="libssh2-sys" --cfg feature="openssl-sys" --cfg feature="ssh" --cfg feature="ssh_key_from_memory" --out-dir target/build/libgit2-sys --emit=dep-info,link -L dependency=target/buildDeps --extern cc=/nix/store/v311xp5vhjymxn9zk855cwihcwi0nj7z-rust_cc-1.0.72-lib/lib/libcc-8cc528ba2b.rlib --extern pkg_config=/nix/store/23mr9d754vngcrkphj9623pv3zchk3sk-rust_pkg-config-0.3.20-lib/lib/libpkg_config-39ea50320b.rlib --cap-lints allow --color always
error occurred: Command "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/build/libgit2-sys-0.13.2+1.4.2/target/build/libgit2-sys.out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-I" "/nix/store/pny40lfk2s01n2p7w5q8srg4nd5v3w6g-openssl-1.1.1m-dev/include" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/build/libgit2-sys-0.13.2+1.4.2/target/build/libgit2-sys.out/build/libgit2/src/transports/ssh.o" "-c" "libgit2/src/transports/ssh.c" with args "gcc" did not execute successfully (status code exit status: 1).
note: keeping build directory '/tmp/nix-build-rust_libgit2-sys-0.13.2+1.4.2.drv-2'
builder for '/nix/store/ibipalg67ism9cwj4hdcj7ifdqzb2k8f-rust_libgit2-sys-0.13.2+1.4.2.drv' failed with exit code 1
cannot build derivation '/nix/store/0zk6spayh52pappfw0xk6vny9ylmp7kj-rust_alerting-1.10.10-test.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/6364p4kmgangzqqzwgxrmlk260mv45kl-rust_alerting-1.10.10.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/555c1nrvqlzjz71qzyi3s8gjyf7xrxg8-rust_alerting-1.10.10-linked.drv': 1 dependencies couldn't be built
error: build of '/nix/store/555c1nrvqlzjz71qzyi3s8gjyf7xrxg8-rust_alerting-1.10.10-linked.drv' failed
I want to know why this gcc invocation is failing.
What I tried doing is going to this kept folder '/tmp/nix-build-rust_libgit2-sys-0.13.2+1.4.2.drv-2', running . env-vars and running "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/build/libgit2-sys-0.13.2+1.4.2/target/build/libgit2-sys.out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-I" "/nix/store/pny40lfk2s01n2p7w5q8srg4nd5v3w6g-openssl-1.1.1m-dev/include" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/build/libgit2-sys-0.13.2+1.4.2/target/build/libgit2-sys.out/build/libgit2/src/transports/ssh.o" "-c" "libgit2/src/transports/ssh.c" there.
The output I get is In file included from libgit2/src/transports/ssh.h:10, from libgit2/src/transports/ssh.c:8: libgit2/src/common.h:11:11: fatal error: git2/sys/features.h: No such file or directory 11 | # include "git2/sys/features.h" | ^~~~~~~~~~~~~~~~~~~~~ compilation terminated.
I believe this is not the same output I was getting when running nix-build.
Am I missing some step? I want to know the exact output of the gcc compilation so that I can report it to git2-rs repo or if there's a problem in our Nix infra to fix it somehow. I apologize if my question is poor quality; I'm really struggling with debugging nix builds and I've read stuff like https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages#Using_nix-shell_for_package_development but it's not helping
I hope the following snippet from my cheat sheet is a good starting point for you:
nix-build --builders '' -K -A package
# path to the kept build directory under /tmp is shown
export out=/tmp/nix-build-package-1.0.0.drv-0
# the following might be required if you run into permission issues
sudo chown $USER:$USER -R $out
nix-shell -E --pure 'with import ./. { }; package'
bash --rcfile $out/env-vars
cd $out/
export TMP=$PWD TMPDIR=$PWD
# start debugging
buildPhase
...
Related
Hi am trying to a build shell script in centos 7.5 but am stopped due to the following error
ERROR:
[root#localhost unimrcp-1.5.0]# ./bootstrap
+ libtoolize --force --automake --copy
+ aclocal -I build/acmacros
+ automake --foreign --add-missing --copy
Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir]
[-l dir] [--localdir=dir] [--version] [template-file]
automake: error: autoconf failed with exit status: 1
+ autoconf
autoconf: configure.in: No such file or directory
+ rm -rf autom4te.cache
and the following is the shell script i tried to execute.
bootstrap.sh
#! /bin/sh
case `uname` in
Darwin) libtoolize=glibtoolize ;;
*) libtoolize=libtoolize ;;
esac
set -x
$libtoolize --force --automake --copy
aclocal -I build/acmacros
automake --foreign --add-missing --copy
autoconf
rm -rf autom4te.cache
Can any one help me to solve this problem?
Thank you :)
Your script is failing at the autoconf step.
From man autoconf:
Synopsis
autoconf [OPTION]... [TEMPLATE-FILE]
Description
Generate a configuration script from a TEMPLATE-FILE if given, or
'configure.ac' if present, or else 'configure.in'. Output is sent to
the standard output if TEMPLATE-FILE is given, else into 'configure'.
As you can see autoconf is either expecting a TEMPLATE-FILE or it is looking for configure.ac or configure.in.
Since neither is given, your script is failing.
I have 4 files in different directories.
1. /home/Linux/NXP/XYZ/Embedded/Read/read.c
2. /home/Linux/NXP/XYZ/Embedded/main/mainfun.c
3. /home/Linux/NXP/XYZ/Embedded/write/write.c
4. /home/Linux/NXP/XYZ/Embedded/config/config.c
and the .bb file is located at
"/home/Linux/NXP/yocto/jethro/yocto/source/meta-mylayer/recipes-app/mainfun/mainfun.bb"
From mainfun.c I am calling different functions, the definitions of which are present inside write.c, config.c, read.c.
I have only come across a single file compilation using yocto so can you please help how do I write the .bb file? How can I compile and generate "XYZ_app" executable?
Here I attached my .bb file which I have written but it's not working:
DESCRIPTION = "multiple file compilation"
PR = "r0"
LICENSE = "CLOSED"
SRC_URI += "file://home/Linux/NXP/XYZ/Embedded/ \
"
S = "${WORKDIR}"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} --static -c ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/read/read.c
${CC} ${CFLAGS} ${LDFLAGS} --static -c ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/write/write.c
${CC} ${CFLAGS} ${LDFLAGS} --static -c ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/conf/conf.c
${CC} ${CFLAGS} ${LDFLAGS} --static -c ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/mainfun/mainfun.c
${CC} ${CFLAGS} ${LDFLAGS} --static ${WORKDIR} /home/Linux/NXP/XYZ/Embedded/Read/read.o /home/Linux/NXP/XYZ/Embedded/write/write.o /home/Linux/NXP/XYZ/Embedded/conf/conf.o /home/Linux/NXP/XYZ/Embedded/mainfun/mainfun.o -c XYZ_App
}
do_install() {
install -m 0755 -d ${D}${bindir}
install -m 0755 ${S}/XYZ_App ${D}${bindir}
}
The direct compilation of source files in a recipe is a testing/emergency solution at best. Whenever it comes to something even only slightly advanced, the correct way is to use a build system of any kind.
Those directly supported in OpenEmbedded include (amongst others)
Makefiles
Autotools
CMake
Here are examples for a couple of recipes for those systems: http://www.yoctoproject.org/docs/2.4/dev-manual/dev-manual.html#new-recipe-testing-examples
Properly packing the sources up also gives you a way to easily test the compilation and application without having to invoke the whole bitbake process. All of them have pros and cons, so you might want to dig a deep further. For a start into autotools, this seems to be a good thing:
https://developer.gnome.org/anjuta-build-tutorial/stable/create-autotools.html.en
An alternative is to look at GNU hello, and also the corresponding recipe.
I've got a c++-project which uses Clang API, and I'd like to have ability to debug into clang/llvm function when I debugging my project.
I built llvm+clang v3.7.0 using CMake with the following opts:
-DCMAKE_INSTALL_PREFIX=$HOME/opt/llvm -DCMAKE_BUILD_TYPE=Debug
but GDB doesn't step into clang API's functions.
What am I doing wrong?
It's likely what you're doing is not setting a breakpoint on the command line with -cc1 on it. clang forks immediately for error handling purposes, so if you set a breakpoint on main you'll see it happen. If you want to debug starting at clang then you should:
Build with debug symbols (looks like you're doing that)
Run clang with -v to get the various command lines, e.g.
dzur:~/tmp> ~/builds/build-llvm/bin/clang -v t.c -S
"/usr/local/google/home/echristo/builds/build-llvm/bin/clang-3.9" -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -main-file-name t.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-file /usr/local/google/home/echristo/tmp/t.c -resource-dir /usr/local/google/home/echristo/builds/build-llvm/bin/../lib/clang/3.9.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/google/home/echristo/builds/build-llvm/bin/../lib/clang/3.9.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /usr/local/google/home/echristo/tmp -ferror-limit 19 -fmessage-length 120 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-o t.s -x c t.c
Set a breakpoint on the this command line where you'd like in the sources.
/bin/bash: arm-eabi-gcc: command not found
/bin/bash: arm-eabi-gcc: command not found
dirname: missing operand
Try `dirname --help' for more information.
/bin/bash: arm-eabi-gcc: command not found
/bin/bash: arm-eabi-ld: command not found
/bin/bash: arm-eabi-gcc: command not found
dirname: missing operand
Try `dirname --help' for more information.
/bin/bash: arm-eabi-gcc: command not found
dirname: missing operand
Try `dirname --help' for more information.
arm-eabi-gcc -DDO_DEPS_ONLY \
-g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -I/home/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem -pipe -DCONFIG_ARM -D__ARM__ -march=armv5 -Wall -Wstrict-prototypes \
-o lib/asm-offsets.s lib/asm-offsets.c -c -S
/bin/bash: arm-eabi-gcc: command not found
make: *** [lib/asm-offsets.s] Error 127
If tool chain path is properly exported then your problem is related to 32 and 64 bit mismatch.Perhaps you are trying to run 32 bit executable on 64 bit PC.
you should install the package "ia32-libs"
I had the same issue. I followed this link and I changed this:
make CROSS_COMPILE=arm-linux-gnueabihf- TARGET
to:
export CROSS_COMPILE=/full path/arm-linux-eabi- TARGET
make
And it worked for me.
Maybe tool-chain is not right set. After edit /etc/profile, you should execute the commond:source /etc/profile.
Or, after install the tool-chain, before doing make, execute:
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
After that, doing make
If you happen to meet this error when you did install the toolchain such as arm-eabi-gcc, arm-eabi-g++, you can set the full path of toochain like this.
export CROSS_COMPILE=/full path/arm-linux-eabi-
The full path depends on your enviornment on above.
I'm tryin to follow the direction to install id3v2. I installed id3lib and did not receive any errors. I now try to do "make" and then "make install" as they suggest that I do.
I get the following responses when I go through the process.
I was under the assumption that I would be able to use the program by typing "id3v2 ....."
However, it seems that the system doesn't find the command. Does that mean the program was not installed? If so, how would I try to find a solution?
[root#ip-xxx-xxx-xxx-xxx id3v2-0.1.12]# make
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o convert.o convert.cpp
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o list.o list.cpp
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o id3v2.o id3v2.cpp
g++ -Wall -I/opt/local/include/ -DVERSION="\"0.1.12\"" -c -o genre.o genre.cpp
g++ -L/opt/local/lib/ -pedantic -Wall -g -o id3v2 convert.o list.o id3v2.o genre.o -lz -lid3
[root#ip-xxx-xxx-xxx-xxx id3v2-0.1.12]# make install
install -c -s id3v2 /opt/local/bin/id3v2
nroff -man id3v2.1 > /opt/local/share/man/man1/id3v2.1
[root#ip-xxx-xxx-xxx-xxx id3v2-0.1.12]# id3v2
-bash: id3v2: command not found
I've looked at the make file itself and it says:
install: all
install -c -s id3v2 ${PREFIX}/bin/id3v2
nroff -man id3v2.1 > ${PREFIX}/share/man/man1/id3v2.1
The Prefix hard coded into the make file is:
/opt/local
Now I think it must be true that it is installing it in the wrong directory. Is it normal to adjust the Makefile? am I barking up the wrong tree?
Most likely path where you installed is not in $PATH. You can either call it with the full path:
/opt/local/bin/id3v2
or add this path to your $PATH:
export $PATH=$PATH:/opt/local/bin
To make it permanent append this line to $HOME/.profile