Closed the-real-neil closed 10 months ago
If Chapter02/set-path-arm-cortex_a8-linux-gnueabihf does this...
Chapter02/set-path-arm-cortex_a8-linux-gnueabihf
PATH=${HOME}/x-tools/arm-cortex_a8-linux-gnueabihf/bin/:$PATH export CROSS_COMPILE=arm-cortex_a8-linux-gnueabihf- export ARCH=arm
...then why are those variables never consumed by any of the following Makefiles?
Makefile
Chapter02/library/shared/Makefile
Chapter02/library/static/Makefile
Chapter02/library/hello-arm/Makefile
Indeed, because the CROSS_COMPILE prefix is never used, it is the host's CC that is invoked. Indeed, the README shows exactly that:
CROSS_COMPILE
CC
README
https://github.com/PacktPublishing/Mastering-Embedded-Linux-Programming-Third-Edition/blob/c1424a5d8088df491b1abdc6d98671936e1bd6ca/Chapter02/library/README#L43
You should have two executables: hello-arm-shared and hello-arm-static $ list-libs hello-arm-shared [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] 0x0000000000000001 (NEEDED) Shared library: [libtest.so] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] $ list-libs hello-arm-static [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
The book, by contrast, uses the prefixed commands like this:
$ arm-cortex_a8-linux-gnueabihf-gcc -static helloworld.c -o helloworld-static
Is this discrepancy intentional? What purpose, if any, does the set-path-arm-cortex_a8-linux-gnueabihf script serve here?
set-path-arm-cortex_a8-linux-gnueabihf
@the-real-neil I don't think the examples from the section on Linking with libraries were meant to be cross-compiled. That is why the host's CC is invoked instead of the CROSS_COMPILE prefix.
If
Chapter02/set-path-arm-cortex_a8-linux-gnueabihf
does this......then why are those variables never consumed by any of the following
Makefile
s?Chapter02/library/shared/Makefile
Chapter02/library/static/Makefile
Chapter02/library/hello-arm/Makefile
Indeed, because the
CROSS_COMPILE
prefix is never used, it is the host'sCC
that is invoked. Indeed, theREADME
shows exactly that:https://github.com/PacktPublishing/Mastering-Embedded-Linux-Programming-Third-Edition/blob/c1424a5d8088df491b1abdc6d98671936e1bd6ca/Chapter02/library/README#L43
The book, by contrast, uses the prefixed commands like this:
Is this discrepancy intentional? What purpose, if any, does the
set-path-arm-cortex_a8-linux-gnueabihf
script serve here?