Trying to bootstrap gcc/glibc toolchain - linux

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

Related

espeak-ng cross compile make install issue

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

make command error: undefined reference to `pthread_create

I was trying to run the codes from sourceforge.net, but when I was trying to run the "make" command in linux, I got the following error message:
make all-recursive
make[1]: Entering directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp'
Making all in src
make[2]: Entering directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src'
/bin/sh ../libtool --mode=link --tag=CXX g++ -g -O2 -o agent_rsvp agent_rsvp.o configuration.o floatformat.o generic_interface.o ip_mask.o ip_route.o mgmt_interface.o mgmt_packet.o mpls_ioctl.o rsvp_configuration.o rsvp_connection.o rsvp_dispatcher.o rsvp_error.o rsvp_packet.o rsvp_socket.o semaphore.o tools.o verbose.o
g++ -g -O2 -o agent_rsvp agent_rsvp.o configuration.o floatformat.o generic_interface.o ip_mask.o ip_route.o mgmt_interface.o mgmt_packet.o mpls_ioctl.o rsvp_configuration.o rsvp_connection.o rsvp_dispatcher.o rsvp_error.o rsvp_packet.o rsvp_socket.o semaphore.o tools.o verbose.o
mgmt_interface.o: In function `mgmt_interface::init()':
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/mgmt_interface.cpp:108: undefined reference to `pthread_create'
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/mgmt_interface.cpp:109: undefined reference to `pthread_create'
rsvp_connection.o: In function `rsvp_connection::create_refresh_thread()':
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/rsvp_connection.cpp:136: undefined reference to `pthread_create'
rsvp_dispatcher.o: In function `rsvp_dispatcher::init(unsigned int)':
/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src/rsvp_dispatcher.cpp:72: undefined reference to `pthread_create'
collect2: ld returned 1 exit status
make[2]: *** [agent_rsvp] Error 1
make[2]: Leaving directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp/src'
make[1 ]: * ** [all-recursive] Error 1
make[1 ]: Leaving directory `/home/lliu/MyDoc/rsvp-agent/trunk/agent_rsvp'
make: *** [all] Error 2

Error while building OpenSSL for android using ndk

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

Creating CMake executables using multiple libraries

I have succeeded in creating static libraries from my source files using CMake. Now I need to create quite a few executables using these libraries. I have read the CMake examples and attempted to duplicate what they had listed but did not seem to work. I am receiving the error:
Linking CXX executable ../../build/bin/discoveryService
armv5l-timesys-linux-uclibcgnueabi-g++: CMakeFiles/discoveryService.dir/discoveryService.cpp.o: linker input file unused because linking not done
Here is a quick overview of my directory structure. Each directory creates a static library from the source files included in that directory. Most directories also need to generate executables which rely on libraries within the 633/arm directory:
Here is my original Makefile:
$(shell ../../build_environment.sh)
BIN = ../../build/bin
TMP = build
BUILD_DEF = -DBUILD=$(BUILD_VERSION) -DBUILD_DATE=$(BUILD_DATE)
# these files are captured from the DSPLink Sample build directory (and the named changed)
# they contain the appropriate includes and flags to build a dsplink application.
DSPLINK_INCLUDES = $(shell cat ../dsplink_config/dsplink_includes.txt)
DSPLINK_FLAGS = $(shell cat ../dsplink_config/dsplink_flags.txt)
DSPLINK_DEFINES = $(shell cat ../dsplink_config/dsplink_defines.txt)
DSPLINK_LIBS = $(DSPLINK_PACKAGE_DIR)/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplink.lib
#Our project variables
INCLUDE= -I. -I../framework -I../flagDictionary -I../logging -I../../dsp/include - I../modbus -I../expat
TOOLCHAIN = /OMAP-L137/timesys/SDK/omapl137_evm/toolchain/bin
#TOOLCHAIN = ${FACTORY_DIR}/build_armv5l-timesys-linux-uclibcgnueabi/toolchain/bin
PLATFORM=armv5l-timesys-linux-uclibcgnueabi
#Compile Options
CC=$(TOOLCHAIN)/$(PLATFORM)-g++
LINKER=$(TOOLCHAIN)/$(PLATFORM)-g++
CFLAGS+=$(BUILD_DEF) $(INCLUDE)
DEBUG =
#list of things to compile.
FW_BUILD_DIR=../framework/build
LOG_BUILD_DIR=../logging/build
XML_BUILD_DIR=../expat/build
MODBUS_BUILD_DIR=../modbus/build
FLAG_DICT_BUILD_DIR=../flagDictionary/build
CORE_FRAMEWORK_OBJECTS= $(FW_BUILD_DIR)/application.o \
$(FW_BUILD_DIR)/arguments.o \
$(FW_BUILD_DIR)/com.o \
$(FW_BUILD_DIR)/memoryManagerBase.o \
$(FW_BUILD_DIR)/memoryManager.o \
$(FW_BUILD_DIR)/lockManager.o \
$(FW_BUILD_DIR)/stopWatch.o \
$(FW_BUILD_DIR)/controlCom.o \
$(FW_BUILD_DIR)/status.o \
$(FW_BUILD_DIR)/paths.o \
$(LOG_BUILD_DIR)/subsystemLogMasks.o \
$(LOG_BUILD_DIR)/logger.o
# removed utils.o from CORE
NET_FRAMEWORK_OBJECTS= $(FW_BUILD_DIR)/message.o \
$(FW_BUILD_DIR)/chunk.o \
$(FW_BUILD_DIR)/multicastSocket.o \
$(FW_BUILD_DIR)/serverSocket.o \
$(FW_BUILD_DIR)/socket.o \
$(FW_BUILD_DIR)/tcpReader.o
CONF_FRAMEWORK_OBJECTS= $(FW_BUILD_DIR)/configuration.o \
$(FW_BUILD_DIR)/editConfig.o \
$(FW_BUILD_DIR)/parseConfig.o \
$(FW_BUILD_DIR)/xpath.o \
$(XML_BUILD_DIR)/xmlparse.o \
$(XML_BUILD_DIR)/xmlrole.o \
$(XML_BUILD_DIR)/xmltok.o
MODBUS_OBJECTS= $(MODBUS_BUILD_DIR)/modbus.o \
$(MODBUS_BUILD_DIR)/modbusFacade.o
MODBUS_RTU_OBJECTS= $(MODBUS_BUILD_DIR)/modbus.o \
$(MODBUS_BUILD_DIR)/rtuFacade.o
FLAG_DICT_OBJECTS= $(FLAG_DICT_BUILD_DIR)/flagEntry.o \
$(FLAG_DICT_BUILD_DIR)/flagDictionary.o
OBJECTS = discoveryService.o \
httpService.o \
modbusService.o \
streamingService.o \
trendMap.o \
trendService.o \
tripBuffer.o \
modbusRTUService.o \
tripReader.o
EXES = discoveryService httpService modbusService streamingService trendService tripReader modbusRTUService cmprXfr
all: $(OBJECTS) $(EXES)
.c.o:
mkdir -p build
$(CC) -c $(CFLAGS) $(DSPLINK_INCLUDES) $(DSPLINK_FLAGS) $(DSPLINK_DEFINES) $(DEBUG) -o $(TMP)/$# $<
.cpp.o:
mkdir -p build
$(CC) -c $(CFLAGS) $(DSPLINK_INCLUDES) $(DSPLINK_FLAGS) $(DSPLINK_DEFINES) $(DEBUG) -o $(TMP)/$# $<
discoveryService: $(FRAMEWORK_OBJECTS) discoveryService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/discoveryService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
httpService: $(FRAMEWORK_OBJECTS) httpService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/httpService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS)
modbusService: $(FRAMEWORK_OBJECTS) modbusService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/modbusService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(MODBUS_OBJECTS) $(NET_FRAMEWORK_OBJECTS)
modbusRTUService: $(FRAMEWORK_OBJECTS) modbusRTUService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/modbusRTUService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(MODBUS_RTU_OBJECTS)
cmprXfr: $(FRAMEWORK_OBJECTS) cmprXfr.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/cmprXfr.o $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(MODBUS_OBJECTS) $(FLAG_DICT_OBJECTS)
streamingService: $(FRAMEWORK_OBJECTS) streamingService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/streamingService.o build/tripBuffer.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
trendService: $(FRAMEWORK_OBJECTS) trendService.o trendMap.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/trendService.o build/trendMap.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
tripReader: $(FRAMEWORK_OBJECTS) tripReader.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/tripReader.o build/tripBuffer.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS) $(NET_FRAMEWORK_OBJECTS) $(CONF_FRAMEWORK_OBJECTS)
USBstreamingService: $(FRAMEWORK_OBJECTS) USBstreamingService.o
$(LINKER) -lpthread -lc -o $(BIN)/$# $(DSPLINK_LIBS) build/USBstreamingService.o $(FLAG_DICT_OBJECTS) $(CORE_FRAMEWORK_OBJECTS)
Here is my top-level CMakeList.txt
INCLUDE(CMakeForceCompiler)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(633.CMake)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
SET(FACTORY_CURRENT /home/projects/OMAP-L137/timesys/factory-current)
SET(DSPLINK_PATH ${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink- 1_65_01/DSPLink-1_65_01)
SET(DSPLINK_PACKAGE_DIR ${FACTORY_CURRENT}/${DSPLINK_PATH})
SET(TOOLCHAIN_LOC ${FACTORY_CURRENT}/build_armv5l-timesys-linux- uclibcgnueabi/toolchain/bin)
#read file into variable 'defines'
file(READ ${CMAKE_SOURCE_DIR}/arm/dsplink_config/dsplink_defines.txt defines)
#turn space separation into CMake list
string(REPLACE " " ";" defines "${defines}")
ADD_DEFINITIONS(${defines})
# specify the cross compiler
SET(CMAKE_C_COMPILER ${TOOLCHAIN_LOC}/armv5l-timesys-linux-uclibcgnueabi-g++)
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_LOC}/armv5l-timesys-linux-uclibcgnueabi-g++)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -c")
SET(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /home/projects/OMAP-L137/timesys/factory-current)
SET(PROJECT_SOURCE_DIR /home/chrisk/633/)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
ADD_SUBDIRECTORY(arm)
And here is my CMakeList.txt in the directory 633/arm/communications where my source files are located.
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/arm/framework ${CMAKE_SOURCE_DIR}/arm/flagDictionary ${CMAKE_SOURCE_DIR}/arm/logging ${CMAKE_SOURCE_DIR}/dsp/include ${CMAKE_SOURCE_DIR}/arm/modbus ${CMAKE_SOURCE_DIR}/arm/expat)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux- uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(/home/projects/OMAP-L137/timesys/factory-20120925-633/build_armv5l- timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(/home/projects/OMAP-L137/timesys/factory-20120925-633/build_armv5l- timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/sys/Linux)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/sys/Linux)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/sys/Linux/2.6.18)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/src/samples/loop)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/src/samples/loop/Linux)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/src/samples/loop/Linux/2.6.18)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/BUILD/INCLUDE/USER)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink- 1_65_01/dsplink/gpp/export/INCLUDE/Linux/OMAPL1XX/internal)
INCLUDE_DIRECTORIES(${FACTORY_DIR}/build_armv5l-timesys-linux-uclibcgnueabi/toolchain/include)
TARGET_LINK_LIBRARIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink- 1_65_01/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplink.lib)
SET(communications_SOURCES
discoveryService.cpp
httpService.cpp
modbusRTUService.cpp
modbusService.cpp
streamingService.cpp
trendMap.cpp
trendService.cpp
tripBuffer.cpp
tripReader.cpp
)
ADD_LIBRARY(communications ${communications_SOURCES})
TARGET_LINK_LIBRARIES(${CMAKE_SOURCE_DIR}/arm/flagDictionary/libflagDictionary.a)
TARGET_LINK_LIBRARIES(${CMAKE_SOURCE_DIR}/arm/framework/libframework.a)
TARGET_LINK_LIBRARIES(${CMAKE_SOURCE_DIR}/arm/communications/libcommunications.a)
TARGET_LINK_LIBRARIES(${DSPLINK_PACKAGE_DIR}/dsplink/gpp/export/BIN/Linux/OMAPL1XX/RELEASE/dsplink.lib)
ADD_EXECUTABLE(discoveryService discoveryService.cpp)
I used the ADD_EXECUTABLE as shown in the CMake Tutorial and tried using TARGET_LINK_LIBRARIES to link the libraries. Any help is appreciated.

Compiling wmii on Fedora 15 x86_64

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

Resources