I am trying to cross compile espeak-ng for target=arm-linux-gnueabihf
The sudo make install step gives the following error :
~:~/Downloads/Dependencies/espeak-ng-master$ sudo make install
[sudo] password for abc:
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126
I have cross compiled using the following :
./configure CC=arm-linux-gnueabihf-gcc -prefix /opt/myproject-sysroot/usr --build=$MACHTYPE --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
make -B src/speak-ng src/espeak-ng
Configure output
Configuration for eSpeak NG complete.
Source code location: .
C99 Compiler: arm-linux-gnueabihf-gcc
C99 Compiler flags: -Wunused-parameter -Wunused -Wuninitialized -Wreturn-type -Wmissing-prototypes -Wimplicit -g -O2 -std=c99
Sonic: no
PCAudioLib: no
gradle (Android): gradle
ndk-build (Android):
Klatt: yes
MBROLA: yes
Async: yes
Extended Dictionaries:
Russian: no
Chinese (Mandarin): no
Chinese (Cantonese): no
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make -B src/speak-ng src/espeak-ng
Output for make command:
---------------
-----------
CC src/libespeak-ng/src_libespeak_ng_la-tr_languages.lo
CC src/libespeak-ng/src_libespeak_ng_la-voices.lo
CC src/libespeak-ng/src_libespeak_ng_la-wavegen.lo
src/libespeak-ng/wavegen.c: In function ‘WavegenFill’:
src/libespeak-ng/wavegen.c:1400:17: warning: variable ‘p_start’ set but not used [-Wunused-but-set-variable]
unsigned char *p_start;
^~~~~~~
CC src/libespeak-ng/src_libespeak_ng_la-klatt.lo
CC src/libespeak-ng/src_libespeak_ng_la-mbrowrap.lo
CC src/libespeak-ng/src_libespeak_ng_la-espeak_command.lo
CC src/libespeak-ng/src_libespeak_ng_la-event.lo
CC src/libespeak-ng/src_libespeak_ng_la-fifo.lo
CCLD src/libespeak-ng.la
arm-linux-gnueabihf-ar: `u' modifier ignored since `D' is the default (see `U')
CCLD src/speak-ng
CC src/espeak-ng.o
src/espeak-ng.c: In function ‘main’:
src/espeak-ng.c:744:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(p_text, 1, filesize, f_text);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CCLD src/espeak-ng
Make install output
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make LIBDIR=/opt/myproject-sysroot/usr install
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126
Related
I have a simple c application
Ctest.c file
#include <stdio.h>
#include "new.h"
#include "new.c"
int main()
{
switching();
return 0;
}
and i have those new.c and new.h files.
new.h file as
void switching();
and my new.c file as
void switching(){
char grade ='B';
switch(grade){
case 'A':
printf("Excellent\n");
break;
case 'B':
printf("Super\n");
break;
case 'C':
printf("Well done\n");
break;
case 'D':
printf("You passed\n");
break;
case 'F':
printf("Better try again");
break;
default:
printf("invalid grade");
break;
}
printf("your grade is %c \n",grade);
}
When i try to use build commands in my embedded linux tool for compiling and generating a binary , building is failed and here is my changed make file for the application on rootfs.
make file for the app Ctest:
APP = Ctest
# Add any other object files to this list below
APP_OBJS = Ctest.o
APP_OBJS += new.o
all: build
build: $(APP)
$(APP): $(APP_OBJS)
$(CC) $(LDFLAGS) -o $# $(APP_OBJS) $(LDLIBS)
Here is my error log during compile time
DEBUG: Executing shell function do_compile
NOTE: make -j 4
ERROR: oe_runmake failed
aarch64-xilinx-linux-gcc --sysroot=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/work/aarch64-xilinx-linux/Ctest/1.0-r0=/usr/src/debug/Ctest/1.0-r0 -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64= -c -o Ctest.o Ctest.c
aarch64-xilinx-linux-gcc --sysroot=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/work/aarch64-xilinx-linux/Ctest/1.0-r0=/usr/src/debug/Ctest/1.0-r0 -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64= -c -o new.o new.c
new.c: In function 'switching':
new.c:5:13: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
printf("Excellent\n");
^~~~~~
new.c:5:13: warning: incompatible implicit declaration of built-in function 'printf'
new.c:5:13: note: include '<stdio.h>' or provide a declaration of 'printf'
new.c:24:5: warning: incompatible implicit declaration of built-in function 'printf'
printf("your grade is %c \n",grade);
^~~~~~
new.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Ctest.c:33:17: fatal error: new.h: No such file or directory
#include "new.h"
^
compilation terminated.
make: *** [<builtin>: Ctest.o] Error 1
make: *** Waiting for unfinished jobs....
ERROR: Function failed: do_compile (log file is located at /home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/work/aarch64-xilinx-linux/Ctest/1.0-r0/temp/log.do_compile.19737)
i understood that i need to do changes in the make file or bitbake file that build the application ie., Ctest.bb file If so what are the changes? And I am using petalinux 2017.1
the bitbake file of the application is
#
# This file is the Ctest recipe.
#
SUMMARY = "Simple Ctest application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://Ctest.c \
file://new.c \
file://Makefile \
"
S = "${WORKDIR}"
do_compile() {
oe_runmake
}
do_install() {
install -d ${D}${bindir}
install -m 0755 Ctest ${D}${bindir}
install -m 0755 new ${D}${bindir}
}
How can i give new.h file into the make file or do i need to change the bitbake file?
Your Ctest.c file includes new.c so you should not be trying to build new.o at all. Remove the line
APP_OBJS += new.o
and
install -m 0755 new ${D}${bindir}
You are not providing the new.h file in your SRC_URI. Change it to
SRC_URI = "file://Ctest.c \
file://new.c \
file://new.h \
file://Makefile \
"
I am trying to build openSSL for android using ndk. I am using dockerFile concept. I have set few environment variables as per suggested in http://wiki.openssl.org/index.php/Android. Now I am getting following error:
make[2]: Entering directory `/Android/openssl/apps'
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-arm-l
inux-androideabi-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO
_DLFCN -DHAVE_DLFCN_H --static -Wa,--noexecstack -march=armv7-a -mandroid -I/And
roid/android-ndk-r10c/platforms/android-19/arch-arm/usr/include -B/Android/andro
id-ndk-r10c/platforms/android-19/arch-arm/usr/lib -O3 -fomit-frame-pointer -Wall
-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_AS
M -DAES_ASM -DBSAES_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; d
one | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/
g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:
=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd
.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o
ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o
s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.
o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o eng
ine.o ocsp.o prime.o ts.o srp.o ${LIBDEPS} )
/Android/toolchain-arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlopen'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlclose'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlopen'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlclose'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_unload: error: undefined
reference to 'dlclose'
collect2: error: ld returned 1 exit status
make[2]: Leaving directory `/Android/openssl/apps'
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make[1]: Leaving directory `/Android/openssl/apps'
make: *** [build_apps] Error 1
INFO[0135] The command [/bin/sh -c cd openssl && ./config --static no-ssl2 no-ss
l3 no-comp no-hw no-engine && make depend && make && ls -hs . && cp l
ibssl.a /Android/output] returned a non-zero code: 2
docker#boot2docker:/home/curl_ssl$
Do you have suggestions to resolve above error? I am not able to find what is reason behind such error.
Android has openssl already. Perhaps you do not need to compile them. Try answer from this question Compiling OpenSSL on Android
[il#vmarch openwrt]$ make V=99
...
make -C /home/il/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.10.36 HOSTCFLAGS="-O2 -I/home/il/openwrt/staging_dir/host/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="mips-openwrt-linux-uclibc-" ARCH="mips" KBUILD_HAVE_NLS=no CONFIG_SHELL="/usr/bin/bash" V='' CC="mips-openwrt-linux-uclibc-gcc" modules
make[5]: Entering directory '/home/il/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.10.36'
...
CC [M] net/netfilter/xt_comment.o
net/netfilter/xt_comment.c:1:1: error: expected identifier or '(' before numeric constant
0 0
^
How to make it print gcc ... instead of CC [M]
According to make help:
make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
make V=2 [targets] 2 => give reason for rebuild of target
No V=99 anywhere... just use V=1 to see the commands run.
I'm trying to bootstrap the gcc/glibc toolchain. It always fails to build failures. I have been trying dozens of times with different methods.
Here is how I have been trying to bootstrap:
path:
export PATH=/home/defer/dev/linux/bin:/usr/bin:/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2
binutils:
../configure --prefix=/home/defer/dev/linux --target=x86_64-pc-linux-gnu --with-sysroot=/home/defer/dev/linux --with-lib-path=/home/defer/dev/linux/lib --disable-nls --disable-werror
gcc stage1:
../configure --target=x86_64-pc-linux-gnu --prefix=/home/defer/dev/linux --with-sysroot=/home/defer/dev/linux --with-newlib --without-headers --with-native-system-header-dir=/home/defer/dev/linux/include --disable-nls
--disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libitm --disable-libmudflap --disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libstdc++-v3 --enable-languages=c,c++
linux headers:
make INSTALL_HDR_PATH=/home/defer/dev/linux headers_install
glibc:
../configure --prefix=/home/defer/dev/linux --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-profile --enable-kernel=2.6.32 --with-headers=/home/defer/dev/linux/include libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes
Here are errors I get while building glibc:
a - ns_netint.os
a - ns_ttl.os
a - ns_print.os
a - ns_samedomain.os
a - ns_date.os
cd /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv && /home/defer/dev/linux/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ar cruv libnss_dns_pic.a dns-host.os dns-network.os dns-canon.os
cd /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv && /home/defer/dev/linux/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ar cruv libanl.a gai_cancel.o gai_error.o gai_misc.o gai_notify.o gai_suspend.o getaddrinfo_a.o
a - dns-host.os
a - dns-network.os
a - dns-canon.os
x86_64-pc-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/home/defer/dev/linux/lib/ld-linux-x86-64.so.2 -B/home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/ -Wl,--version-script=/home/defer/dev/linux/src/glibc-2.19/glibc-build/libresolv.map -Wl,-soname=libresolv.so.2 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -L/home/defer/dev/linux/src/glibc-2.19/glibc-build -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/math -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -Wl,-rpath-link=/home/defer/dev/linux/src/glibc-2.19/glibc-build:/home/defer/dev/linux/src/glibc-2.19/glibc-build/math:/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf:/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis:/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv:/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -o /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv.so -T /home/defer/dev/linux/src/glibc-2.19/glibc-build/shlib.lds /home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/abi-note.o -Wl,--whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a -Wl,--no-whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/interp.os -Wl,--start-group /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc.so /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc_nonshared.a -Wl,--as-needed /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
a - gai_cancel.o
a - gai_error.o
a - gai_misc.o
a - gai_notify.o
a - gai_suspend.o
a - getaddrinfo_a.o
cd /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv && /home/defer/dev/linux/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ar cruv libanl_pic.a gai_cancel.os gai_error.os gai_misc.os gai_notify.os gai_suspend.os getaddrinfo_a.os
a - gai_cancel.os
a - gai_error.os
a - gai_misc.os
a - gai_notify.os
a - gai_suspend.os
a - getaddrinfo_a.os
x86_64-pc-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/home/defer/dev/linux/lib/ld-linux-x86-64.so.2 -B/home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/ -Wl,--version-script=/home/defer/dev/linux/src/glibc-2.19/glibc-build/libanl.map -Wl,-soname=libanl.so.1 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -L/home/defer/dev/linux/src/glibc-2.19/glibc-build -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/math -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -Wl,-rpath-link=/home/defer/dev/linux/src/glibc-2.19/glibc-build:/home/defer/dev/linux/src/glibc-2.19/glibc-build/math:/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf:/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis:/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv:/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -o /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so -T /home/defer/dev/linux/src/glibc-2.19/glibc-build/shlib.lds /home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/abi-note.o -Wl,--whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl_pic.a -Wl,--no-whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/interp.os /home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl/libpthread_nonshared.a /home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl/libpthread.so -Wl,--start-group /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc.so /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc_nonshared.a -Wl,--as-needed /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
rm -f /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1.new
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(ns_print.os): In function `__GI_ns_sprintrrf':
/home/defer/dev/linux/src/glibc-2.19/resolv/ns_print.c:99: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/resolv/ns_print.c:728: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `getanswer':
/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:180: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:483: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `__GI_res_gethostbyname2':
/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:510: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os):/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:636: more undefined references to `__stack_chk_guard' follow
collect2: error: ld returned 1 exit status
/bin/sh ../scripts/rellns-sh /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1.new
../Makerules:438: recipe for target '/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv.so' failed
make[2]: *** [/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv.so] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1.new /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1
make[2]: Leaving directory '/home/defer/dev/linux/src/glibc-2.19/resolv'
Makefile:213: recipe for target 'resolv/others' failed
make[1]: *** [resolv/others] Error 2
make[1]: Leaving directory '/home/defer/dev/linux/src/glibc-2.19'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2
real 3m23.747s
user 9m57.851s
sys 1m21.334s
I solved the problem. Gentoo GCC had stack smash protection on by default.
I had to use:
CFLAGS="-O2 -fno-stack-protector" ../configure --prefix=/home/defer/dev/linux --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-profile --enable-kernel=2.6.32 --with-headers=/home/defer/dev/linux/include libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes
I'm having trouble compiling wmii v3.9.2 on Fedora 15; Here's the interesting part (things break down at the linking stage):
% bmake -de
MAKE all libbio/
MAKE all libfmt/
MAKE all libregexp/
MAKE all libutf/
MAKE all libixp/
MAKE all doc/
MAKE all man/
MAKE all cmd/
MAKE all cmd/wmii/
MAKE all cmd/menu/
LD cmd/wmii9menu.out
/usr/bin/ld: wmii/xext.o: undefined reference to symbol 'XRenderFindVisualFormat'
/usr/bin/ld: note: 'XRenderFindVisualFormat' is defined in DSO /usr/lib64/libXrender.so.1 so try adding it to the linker command line
/usr/lib64/libXrender.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
*** Failed target: wmii9menu.out
*** Failed command: ../util/link "cc" "$(pkg-config --libs 2>/dev/null) -g -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a" wmii9menu.out wmii9menu.o clientutil.o wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o util.o ../lib/libixp.a $(pkg-config --libs xft xrandr xinerama) -lXext
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2/cmd
*** Failed target: dall
*** Failed command: dirs="libbio libfmt libregexp libutf libixp doc man cmd libwmii_hack rc alternative_wmiircs"; set -e; targ=dall; targ=${targ#d}; for i in $dirs; do export WMII_HGVERSION=""; export BASE=$i/; if [ ! -d $i ]; then echo Skipping nonexistent directory: $i 1>&2; else echo MAKE $targ $BASE; (cd $i && bmake $targ) || exit ; fi; done
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2
Finally, in config.mk, I have the following settings:
...
INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
LIBS = -L$(ROOT)/lib -L/usr/lib64
...
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
SHARED = -shared -Wl,-soname=$(SONAME)
STATIC = -static
...
With a little more manual resolution, the statement generating the error is essentially as follows:
gcc \
-o wmii9menu.out\
-L../lib -L/usr/lib $(pkg-config --libs xft xrandr xinerama xext)\
../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a\
../lib/libutf.a ../lib/libixp.a\
wmii9menu.o clientutil.o util.o\
wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o
Here, the pkg-config resolves to the following, which by itself is perfectly correct:
-lXft -lXrandr -lXinerama -lXext
And the solution is as follows:
--- wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:22.950163074 +1000
+++ wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:16.086129011 +1000
## -32 +32 ##
-X11PACKAGES = xft
+X11PACKAGES = xft xext xrandr xrender xinerama