Bug 3057

Summary: gcc linker doesn't work in "bitbake devshell" environment
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Chunrong Guo <b40290>
Component: devtools / tool chainAssignee: Bogdan Marinescu <bogdan.a.marinescu>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Undecided CC: meta.mr.watcher, meta.watcher, msm-oss, sgw, zhenhua.luo
Version: unspecified   
Target Milestone: ---   
Hardware: mpc8315e-rdb   
OS: ppc   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Chunrong Guo 2012-09-04 08:05:08 UTC
gcc linker in devshell environment doesn't work, following is the log of kernel build, the issue can be reproduced in both master and denzil branch. 

$ bitbake -c devshell linux-yocto
$ make modules
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (LOCKDEP && FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && FUNCTION_TRACER && KMEMCHECK) selects FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CRIS || M68K || FRV || UML || AVR32 || SUPERH || BLACKFIN || MN10300) || ARCH_WANT_FRAME_POINTERS)
warning: (LOCKDEP && FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && FUNCTION_TRACER && KMEMCHECK) selects FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CRIS || M68K || FRV || UML || AVR32 || SUPERH || BLACKFIN || MN10300) || ARCH_WANT_FRAME_POINTERS)
make: Circular arch/powerpc/lib/crtsavres.o <- prepare dependency dropped.
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/data.o
  SHIPPED scripts/dtc/dtc-lexer.lex.c
  SHIPPED scripts/dtc/dtc-parser.tab.h
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  SHIPPED scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/util.o
  HOSTLD  scripts/dtc/dtc
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/modpost.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/conmakehash
  AS      arch/powerpc/lib/crtsavres.o
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/powerpc/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC [M]  kernel/trace/ring_buffer_benchmark.o
  CC [M]  fs/9p/vfs_super.o
  CC [M]  fs/9p/vfs_inode.o
  CC [M]  fs/9p/vfs_inode_dotl.o
  CC [M]  fs/9p/vfs_addr.o
  CC [M]  fs/9p/vfs_file.o
  CC [M]  fs/9p/vfs_dir.o
  CC [M]  fs/9p/vfs_dentry.o
  CC [M]  fs/9p/v9fs.o
  CC [M]  fs/9p/fid.o
  CC [M]  fs/9p/xattr.o
  CC [M]  fs/9p/xattr_user.o
  CC [M]  fs/9p/cache.o
  LD [M]  fs/9p/9p.o
powerpc-poky-linux-ld: unrecognized option '-Wl,-O1'
powerpc-poky-linux-ld: use the --help option for usage information
make[2]: *** [fs/9p/9p.o] Error 1
make[1]: *** [fs/9p] Error 2
make: *** [fs] Error 2
Comment 1 Matthew McClintock 2012-09-04 16:47:00 UTC
You are probably not exporting flags correctly to build the kernel. Did you look at everything the kernel.bbclass is changing (as in what linker flags it might be overriding?)
Comment 2 Matthew McClintock 2012-09-04 17:41:01 UTC
(In reply to comment #1)
> You are probably not exporting flags correctly to build the kernel. Did you
> look at everything the kernel.bbclass is changing (as in what linker flags
> it might be overriding?)

In fact just try:

$ LDFLAGS= make modules

devshell does not properly set every variable, that's what the recipe is for. I think this can be marked NOTABUG.

-M
Comment 3 Saul Wold 2012-09-04 21:04:58 UTC
You can also look at the temp/run.do_compile script to see what variable are set and the shell code overrides.

I agree probably not a bug.