Hello, Chen
I think the problem is that you use the *same* build directory for both targets. When you look at the LINK command in case 2 and 3 you see that they both are the same regarding the dependent objects. Although you are building two different targets, the MAKE rule of the LINK command looks for a dependent object >main.o< at the given place. In case 1 there is none since the compilation failed. After case 2 a dependent object >main.o< exists from the compilation of >helloworld/src/app/main.cc<. After case 3 MAKE sees that the dependent object >main.o< exists which it shall build by the COMPILE rule, therefore it just invokes the LINK rule to build the target >thread-migration< which does not yet exist. You have run in a typical deficiency of MAKE. The rule checker only considers targets and dependents after there names and timestamps. It does not track from where dependent objects originated, therefore it does not recognize that >main.o< stems from the wrong source in case 3. Youre example is one of several reasons for which I do not understand that people keep staying with MAKE, although other build tools exist (for instance SCONS) which do not produce this kind of failures.
Regards Frank
-----Original Message----- From: Chen Tian [mailto:chen.tian@...60...] Sent: Monday, June 06, 2011 7:15 PM To: 'Genode OS Framework Mailing List' Subject: RE: Problem in Genode building system?
. (examples) |-- helloworld | `-- src | `-- app | |-- main.cc | `-- target.mk `-- thread-migration `-- src `-- app |-- 32 | `-- target.mk |-- 64 | `-- target.mk `-- main.cc
- a) add a wrong statement "error();" into main.cc of thread-migration. b) cd $GENODE_BUILD; c) update REPOSITORIES to include the path of thread-migration d) make: //failed as expected
Program app/32/thread-migration COMPILE ../main.o /usr/local/genode-gcc-4.4.5/bin/genode-x86-g++ -fPIC -fPIC - DL4SYS_USE_UTCB_WRAP=1 -DOMNIOS_VER=1 -D__FreeBSD__=8 -fno-builtin-sin -fno- builtin-cos -fno-builtin-sinf -fno-builtin-cosf -ffunction-sections -fno- strict-aliasing -nostdinc -g -march=i686 -O2 -MMD -MP -MT '../main.o ../main.d' -Wall -DOMNIOS_VER=1 -I. -I/usr/local/genode-gcc- 4.4.5/bin/../lib/gcc/i686-pc-linux-gnu/4.4.5/../../../../include/c++/4.4.5 - I/usr/local/genode-gcc-4.4.5/bin/../lib/gcc/i686-pc-linux- gnu/4.4.5/../../../../include/c++/4.4.5/i686-pc-linux-gnu -I/usr/local/genode- gcc-4.4.5/bin/../lib/gcc/i686-pc-linux- gnu/4.4.5/../../../../include/c++/4.4.5/backward - I/home/tianc/git/omnios/genode/base/src/core/include - I/home/tianc/git/omnios/genode/base/../base-foc/src/core/include - I/home/tianc/git/omnios/genode/base/../omnios/include - I/home/tianc/git/omnios/build/genode-build-omnios/include/x86/l4f - I/home/tianc/git/omnios/build/genode-build-omnios/include/l4f - I/home/tianc/git/omnios/build/genode-build-omnios/include/x86 - I/home/tianc/git/omnios/build/genode-build-omnios/include/ - I/home/tianc/git/omnios/genode/base/include/x86 - I/home/tianc/git/omnios/genode/base/include/x86_32 - I/home/tianc/git/omnios/genode/base/include/32bit - I/home/tianc/git/omnios/genode/libc/include/libc - I/home/tianc/git/omnios/genode/libc/include/libc-i386 - I/home/tianc/git/omnios/genode/base-foc/include - I/home/tianc/git/omnios/genode/base/include - I/home/tianc/git/omnios/genode/os/include - I/home/tianc/git/omnios/genode/demo/include -I/home/tianc/git/omnios/genode- omnios/include -I/home/tianc/git/omnios/genode/libc/include - I/usr/local/genode-gcc-4.4.5/bin/../lib/gcc/i686-pc-linux-gnu/4.4.5/include -c /home/tianc/git/omnios/genode-omnios/examples/thread- migration/src/app/32/../main.cc -o ../main.o /home/tianc/git/omnios/genode-omnios/examples/thread- migration/src/app/32/../main.cc:13: error: ISO C++ forbids declaration of ‘error’ with no type make[3]: *** [../main.o] Error 1 make[2]: *** [thread-migration.prg] Error 2 make[1]: *** [gen_deps_and_build_targets] Error 2 make[1]: Leaving directory `/home/tianc/git/omnios/build/genode-build-omnios' make: *** [thread-migration] Error 2
- a) remove the path of thread-migration from REPOSITORIES b) update REPOSITORIES to include the path of helloworld c) make: //success as expected
Program app/helloworld COMPILE main.o /usr/local/genode-gcc-4.4.5/bin/genode-x86-g++ -fPIC -DL4SYS_USE_UTCB_WRAP=1 -DOMNIOS_VER=1 -ffunction-sections -fno-strict-aliasing -nostdinc -g - march=i686 -O2 -MMD -MP -MT 'main.o main.d' -Wall -DOMNIOS_VER=1 -I. - I/home/tianc/git/omnios/build/genode-build-omnios/include/x86/l4f - I/home/tianc/git/omnios/build/genode-build-omnios/include/l4f - I/home/tianc/git/omnios/build/genode-build-omnios/include/x86 - I/home/tianc/git/omnios/build/genode-build-omnios/include/ - I/home/tianc/git/omnios/genode/base/include/x86 - I/home/tianc/git/omnios/genode/base/include/x86_32 - I/home/tianc/git/omnios/genode/base/include/32bit - I/home/tianc/git/omnios/genode/demo/include/mini_c - I/home/tianc/git/omnios/genode/base-foc/include - I/home/tianc/git/omnios/genode/base/include - I/home/tianc/git/omnios/genode/os/include - I/home/tianc/git/omnios/genode/demo/include -I/home/tianc/git/omnios/genode- omnios/include -I/home/tianc/git/omnios/genode/libc/include - I/usr/local/genode-gcc-4.4.5/bin/../lib/gcc/i686-pc-linux-gnu/4.4.5/include -c /home/tianc/git/omnios/genode-omnios/examples/helloworld/src/app/main.cc -o main.o LINK helloworld libs=/home/tianc/git/omnios/build/genode-build-omnios/var/libcache; /usr/local/genode-gcc-4.4.5/bin/genode-x86-g++ -Wl,-gc-sections -nostdlib - Wl,-nostdlib -Wl,-Ttext=0x01000000 -Wl,-T - Wl,/home/tianc/git/omnios/genode/base/src/platform/genode.ld -Wl,--whole- archive -Wl,--start-group main.o $libs/allocator_avl/allocator_avl.lib.a $libs/avl_tree/avl_tree.lib.a $libs/cap_alloc/cap_alloc.lib.a $libs/console/console.lib.a $libs/cxx/cxx.lib.a $libs/env/env.lib.a $libs/heap/heap.lib.a $libs/ipc/ipc.lib.a $libs/lock/lock.lib.a $libs/log_console/log_console.lib.a $libs/mini_c/mini_c.lib.a $libs/platform/platform.lib.a $libs/slab/slab.lib.a $libs/startup/startup.lib.a $libs/syscalls/syscalls.lib.a -Wl,--end-group - Wl,--no-whole-archive /usr/local/genode-gcc-4.4.5/bin/../lib/gcc/i686-pc- linux-gnu/4.4.5/libgcc.a -o helloworld ln -sf `pwd`/helloworld /home/tianc/git/omnios/build/genode-build- omnios/bin/helloworld make --no-print-directory -C bootstrap -f /home/tianc/git/omnios/genode/base/mk/prg.mk \ REP_DIR=/home/tianc/git/omnios/genode/base-foc \ PRG_REL_DIR=bootstrap \ BUILD_BASE_DIR=/home/tianc/git/omnios/build/genode-build-omnios \ DEPS="l4re_support.lib platform.lib platform.lib " \ SHELL=/bin/bash \ INSTALL_DIR="/home/tianc/git/omnios/build/genode-build-omnios/bin"
- a) remove the path of helloworld from REPOSITORIES b) update REPOSITORIES to include the path of thread-migration c) make: //success, which is incorrect.
Program app/32/thread-migration LINK thread-migration libs=/home/tianc/git/omnios/build/genode-build-omnios/var/libcache; /usr/local/genode-gcc-4.4.5/bin/genode-x86-g++ -Wl,-gc-sections -nostdlib - Wl,-nostdlib -Wl,-Ttext=0x01000000 -Wl,- T/home/tianc/git/omnios/genode/os/src/platform/x86/genode_dyn.ld -Wl,-- dynamic-linker=ld.lib.so -Wl,--whole-archive -Wl,--start-group ../main.o $libs/cap_alloc/cap_alloc.lib.a $libs/console/console.lib.a $libs/cxx/cxx.lib.a $libs/log_console/log_console.lib.a $libs/platform/platform.lib.a $libs/startup/startup.lib.a $libs/syscalls/syscalls.lib.a $libs/libc/libc.lib.so $libs/ld/ld.lib.so -Wl,-- end-group -Wl,--no-whole-archive /usr/local/genode-gcc- 4.4.5/bin/../lib/gcc/i686-pc-linux-gnu/4.4.5/../../../libstdc++.a /usr/local/genode-gcc-4.4.5/bin/../lib/gcc/i686-pc-linux-gnu/4.4.5/libgcc.a -o thread-migration ln -sf `pwd`/thread-migration /home/tianc/git/omnios/build/genode-build- omnios/bin/thread-migration make --no-print-directory -C bootstrap -f /home/tianc/git/omnios/genode/base/mk/prg.mk \ REP_DIR=/home/tianc/git/omnios/genode/base-foc \ PRG_REL_DIR=bootstrap \ BUILD_BASE_DIR=/home/tianc/git/omnios/build/genode-build-omnios \ DEPS="l4re_support.lib platform.lib platform.lib " \ SHELL=/bin/bash \ INSTALL_DIR="/home/tianc/git/omnios/build/genode-build-omnios/bin"
Hope the above information is enough for you to reproduce the bug.
Chen