| Summary: | Document environment file usage | ||
|---|---|---|---|
| Product: | [Documentation] ADT Manual | Reporter: | Mark Hatle <mark.hatle> |
| Component: | SDK | Assignee: | Costin <costin.c.constantin> |
| Status: | VERIFIED FIXED | QA Contact: | Costin <costin.c.constantin> |
| Severity: | enhancement | ||
| Priority: | Medium+ | CC: | alexandru.c.georgescu, bluelightning, costin.c.constantin, poky.doc.watcher, poky.watcher, richard.purdie, srifenbark |
| Version: | unspecified | ||
| Target Milestone: | 1.9 M3 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | 15 June 2015: Checking documentation changes | ||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | Done (doc changes complete) | |
|
Description
Mark Hatle
2015-01-13 15:20:20 UTC
I've talked to Scott about this offline. However, we don't seem to have a reference to SDKROOT anywhere I can find. Mark, is this something specific to your setup? You are correct. The SDKROOT is what was implemented in the meta-mingw patch that I submitted to the Yocto Project. (Not yet merged.) It's not in the default Linux SDK. So it likely should be documented. Hi, I have gone through the entire adt-manual and addressed this issue. The result was "feathering" in text to more fully describe the use and role for the cross-toolchain environment variables that are established when one runs the cross-toolchain environment setup script. Additionally, many new variables were added to the ref-manual to support the changes. I would like the stuff reviewed and notified of any further changes or issues. Note that the descriptions for the new variables are very brief and are based soley on the short descriptions provided in the bug. If you want to expand on them, give me some more details and I will. You can see the changes at: http://www.yoctoproject.org/docs/1.8/adt-manual/adt-manual.html (it would be good to check out most of the document - several areas were changed). http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-SDKROOT http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-SDKTARGETSYSROOT http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-PKG_CONFIG_PATH http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CONFIG_SITE http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CC http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CXX http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CPP http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-AS http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-LD http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-GDB http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-STRIP http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-RANLIB http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-OBJCOPY http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-OBJDUMP http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-AR http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-NM http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-TARGET_PREFIX http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CROSS_COMPILE http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CONFIGURE_FLAGS http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CFLAGS http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CXXFLAGS http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-LDFLAGS http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-CPPFLAGS Thanks, Scott Comments.. ADT section 5.2 is incorrect:
5.2. Makefile-Based Projects¶
For Makefile-based projects, you make sure your Makefile has statements that ensure proper use of the cross-toolchain. For example, the following statements inside a Makefile ensure the C compiler, linker, flags passed to the C compiler, and flags passed to the C++ compiler are specifically defined for the build:
CC=arm-poky-linux-gnueabi-gcc
LD=arm-poky-linux-gnueabi-ld
CFLAGS=”${CFLAGS} --sysroot=<sysroot-dir>”
CXXFLAGS=”${CXXFLAGS} --sysroot=<sysroot-dir>”
When using the cross compiler, the environment will set the CC and LD arguments to their appropriate values, including the --sysroot= value.
So the Makefile should either NOT have CC, CXX, LD, CFLAGS, CXXFLAGS set -- or if set should be overridden by the environment.
As for the other references.. they look to be correct in most cases. However, "SDKROOT" was something I added specifically for meta-mingw and should NOT be in the documentation. So please remove references to SDKROOT.
Hi Mark, I re-wrote that last section on the Makefile stuff. See http://www.yoctoproject.org/docs/1.8/adt-manual/adt-manual.html#makefile-based-projects. Tell me if I captured it okay. Also, "SDKROOT" has been eradicated from the YP manual set. Thanks, Scott Hi, No more feedback on this so I am marking it RESOLVED. Doc flag set to "Done". Thanks, Scott Hi Mark, Scott, I just tested this enhancement and I think there is some confusing info in the added/modified chapter of the ADT manual. Downwards are steps i took in order to check/test/verify: 1) downloaded last toolchain available (and installed it after): http://autobuilder.yoctoproject.org/pub/releases/yocto-1.8_m4.rc2/toolchain/x86_64/ 2) sourced the environment: autobuilder@sstate1:/opt/poky/1.8$ pwd /opt/poky/1.8 autobuilder@sstate1: . ./environment-setup-i586-poky-linux 3) checked for few variables as described in the manual: autobuilder@sstate1:/opt/poky/1.8$ echo $CC i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux autobuilder@sstate1:/opt/poky/1.8$ echo $CXX i586-poky-linux-g++ -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux autobuilder@sstate1:/opt/poky/1.8$ echo $CFLAGS -O2 -pipe -g -feliminate-unused-debug-types 4) created a Makefile for both a small helloworld.c and an helloworld.cxx. This file contains for both CC and CXX variables a wrong option (-t), meaning that if they are overridden(according to manual), there should be no problem: autobuilder@sstate1:/opt/poky/1.8/tests_dir$ cat Makefile buildc: CC=gcc -t $(CC) hello.c -o hello.o buildcpp: CXX=g++ -t $(CXX) hello.cxx -o hellocxx.o 5) tried the Makefile: autobuilder@sstate1:/opt/poky/1.8/tests_dir$ sudo make buildc CC=gcc -t /bin/sh: 1: -t: not found make: *** [buildc] Error 127 autobuilder@sstate1:/opt/poky/1.8$ sudo make buildcpp CXX=g++ -t /bin/sh: 1: -t: not found make: *** [buildcpp] Error 127 As a result of the above, i believe that there is an error in the manual, since local Makefile variables are not overridden by the environment ones. I also tried other variables (CFLAGS) and behavior is the same. I also tried without -t option and everything is fine, meaning OS gcc and g++ are used. Costin Hey Costin, So thanks for looking at this. What would you say the fix is here for the docs? Should we remove that part about the running the cross-toolchain environment setup script overriding any settings you might have in your Makefile? Scott Hi Scott,
I realized I made a small mistake in my previous comment, but I will correct it here. Also, in my opinion the section for Makefile stuff should look something like:
For Makefile-based projects, the cross-toolchain environment variables established by running the cross-toolchain environment
setup script are subject to general make rules. Suppose the resulted environment variables look like this, 3 cases apply:
CC=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux
LD=i586-poky-linux-ld --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux
CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
Case 1: None of these variables are set in the Makefile
The result will be that make considers the variables as set from environment.
eg. of Makefile content:
build:
echo $(CC)
echo $(LD)
echo $(CFLAGS)
echo $(CXXFLAGS)
Case 2: Variables are set in Makefile:
The result will be that these variables override the content of those from environment.
eg. of Makefile content:
CC=gcc
LD=ld
CFLAGS=-g
CXXFLAGS=$(CFLAGS) -O
build:
echo $(CC)
echo $(LD)
echo $(CFLAGS)
echo $(CXXFLAGS)
Case 3: Variables are set when make is executed from command line:
The result is that no matter what the Makefile contains, the respective variable will be overridden with the command line content.
In this case, also environment variables are not considered. The content of Makefile is the same as on case 2.
eg.: make CFLAGS='-p' build
If the desired behavior is to override any Makefile variable with the content of those from environment, then the "-e" flag for make should be used.
eg.: make -e build
Thank you,
Costin
Costin, I updated that section based on your suggestions. Note that I did not provide example output as your explanation did. I think the points for the three cases can be make without those. You can see the modified section at http://www.yoctoproject.org/docs/1.8/adt-manual/adt-manual.html#makefile-based-projects. Please let me know of any issues or changes that might still be needed. Note - I am setting the target for this bug to 1.9 M1 as the deadline for doc changes to 1.8 has passed. Thanks, Scott Setting status to RESOLVED as I have had no feedback on it. Assuming it is okay. Scott Hi Scott, I think there is a small mistake in the manual: As it is now: For Makefile-based projects, the cross-toolchain environment variables established by running the cross-toolchain environment setup script override any settings you might have in your Makefile. For example, if you had settings such as the following in your Makefile, the environment variables defined by the script would override them: Should be: For Makefile-based projects, the cross-toolchain environment variables established by running the cross-toolchain environment setup script are overridden by those in your Makefile. For example, if you had settings such as the following in your Makefile, the environment variables defined by the script would be overridden: ... Thank you, Costin Hi Costin, Since this change was made in the 1.8 manual as noted in Comment 10, further work has been done to that section for the upcoming YP release. Could you look at that new work and see if that addresses your concerns? You can see the changes here - http://www.yoctoproject.org/docs/1.9/adt-manual/adt-manual.html#makefile-based-projects. If this section in the 1.9 manual is okay, then I can push it into the fido tree for the latest 1.8 manuals online. Thanks, Scott Costin, Please reply to Scott's comment. Hi, Yes, looks fine now. Cositn Marking as verified. |