Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/build.py does not adhere to $CXX env variable settings #24289

Closed
mulander opened this issue Sep 3, 2015 · 5 comments
Closed

tools/build.py does not adhere to $CXX env variable settings #24289

mulander opened this issue Sep 3, 2015 · 5 comments
Labels
area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.

Comments

@mulander
Copy link

mulander commented Sep 3, 2015

While building on OpenBSD the base system ships with g++ 4.2.1

$ g++ --version
g++ (GCC) 4.2.1 20070719 
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

There is a newer gcc/g++ installed via ports as egcc/eg++

$ eg++ --version
eg++ (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Doing export CXX=eg++ allowed me to move forward with the port but after a significant amount of code got build the setting seems to no longer being adhered to. Leading to a build failure due to a flag that is not recognised in g++ but would normally be recognized by eg++.

$ ./tools/build.py -v runtime
gmake -j 2 BUILDTYPE=DebugX64 V=1 runtime
  g++ '-DDEBUG' '-D_FORTIFY_SOURCE=2' '-DNATIVE_CODE_HAS_FRAME_POINTERS' -Iruntime  -Werror -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wvla -Wno-conversion-null -Woverloaded-virtual -g3 -ggdb3 -fno-rtti -fno-exceptions -fstack-protector -m64 -msse2 -mno-omit-leaf-frame-pointer -O2 -fno-omit-frame-pointer  -MMD -MF out/DebugX64/.deps/out/DebugX64/obj.host/libdart_lib_nosnapshot/runtime/vm/bootstrap.o.d.raw  -c -o out/DebugX64/obj.host/libdart_lib_nosnapshot/runtime/vm/bootstrap.o runtime/vm/bootstrap.cc
  g++ '-DDEBUG' '-D_FORTIFY_SOURCE=2' '-DNATIVE_CODE_HAS_FRAME_POINTERS' -Iruntime  -Werror -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wvla -Wno-conversion-null -Woverloaded-virtual -g3 -ggdb3 -fno-rtti -fno-exceptions -fstack-protector -m64 -msse2 -mno-omit-leaf-frame-pointer -O2 -fno-omit-frame-pointer  -MMD -MF out/DebugX64/.deps/out/DebugX64/obj.host/libdart_lib_nosnapshot/gen/async_gen.o.d.raw  -c -o out/DebugX64/obj.host/libdart_lib_nosnapshot/gen/async_gen.o out/DebugX64/obj/gen/async_gen.cc
cc1plus: error: unrecognized command line option "-Wvla"
cc1plus: error: unrecognized command line option "-Wno-conversion-null"
runtime/libdart_lib_nosnapshot.host.mk:1319: recipe for target 'out/DebugX64/obj.host/libdart_lib_nosnapshot/runtime/vm/bootstrap.o' failed
cc1plus: error: unrecognized command line option "-Wvla"gmake: *** [out/DebugX64/obj.host/libdart_lib_nosnapshot/runtime/vm/bootstrap.o] Error 1

cc1plus: error: unrecognized command line option "-Wno-conversion-null"
gmake: *** Waiting for unfinished jobs....
runtime/libdart_lib_nosnapshot.host.mk:1327: recipe for target 'out/DebugX64/obj.host/libdart_lib_nosnapshot/gen/async_gen.o' failed
gmake: *** [out/DebugX64/obj.host/libdart_lib_nosnapshot/gen/async_gen.o] Error 1
BUILD FAILED
$ echo $CXX
eg++
@mulander
Copy link
Author

mulander commented Sep 4, 2015

This is of course related with my BSD porting efforts: #10260

@mulander
Copy link
Author

mulander commented Sep 4, 2015

I was provided by a nice temporary workaround from http://bsdguru.in/29/shadow-the-base-from-external-apps-they-use-egcc-unkowningly - I still think this is a build issue that should eventually get fixed.

For anyone wondering the workaround is:

  1. create a directory pbin
  2. create symlinks to eg++ & egcc in it as gcc, g++, egcc, eg++
  3. put it on your path
$ ln -sf `which egcc` egcc
$ ln -sf `which egcc` gcc
$ ln -sf `which eg++` eg++
$ ln -sf `which eg++` g++  
$ ls -l
total 16
-rw-r--r--  1 mulander  mulander  104 Sep  4 19:38 README.txt
lrwxr-xr-x  1 mulander  mulander   19 Sep  4 19:39 eg++ -> /usr/local/bin/eg++
lrwxr-xr-x  1 mulander  mulander   19 Sep  4 19:38 egcc -> /usr/local/bin/egcc
lrwxr-xr-x  1 mulander  mulander   19 Sep  4 19:39 g++ -> /usr/local/bin/eg++
lrwxr-xr-x  1 mulander  mulander   19 Sep  4 19:39 gcc -> /usr/local/bin/egcc

$ export PATH=`pwd`/pbin:$PATH

$ gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
g++ (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@dgrove dgrove added the area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes. label Sep 4, 2015
@mulander
Copy link
Author

mulander commented Sep 6, 2015

Found another place that ignores the environment. This one is even worse than the previous one since base gcc & g++ are not on PATH so it must hard code the path somewhere?

$ time ./tools/build.py runtime 
gmake -j 2 BUILDTYPE=DebugX64 runtime
  LINK(target) out/DebugX64/libdart_dependency_helper.target
  CXX(target) out/DebugX64/obj.target/libdart_io/runtime/bin/socket_openbsd.o
  CXX(target) out/DebugX64/obj.target/libdart_io/runtime/bin/stdio_macos.o
  CXX(target) out/DebugX64/obj.target/libdart_io/runtime/bin/stdio_win.o
  CXX(host) out/DebugX64/obj.host/libdart_builtin/runtime/bin/dbg_connection_openbsd.o
  CXX(host) out/DebugX64/obj.host/libdart_builtin/runtime/bin/directory_openbsd.o
  CXX(host) out/DebugX64/obj.host/libdart_builtin/runtime/bin/file_openbsd.o
  CXX(host) out/DebugX64/obj.host/libdart_builtin/runtime/bin/thread_openbsd.o
  CXX(host) out/DebugX64/obj.host/libdart_io/runtime/bin/eventhandler_openbsd.o
  CXX(host) out/DebugX64/obj.host/libdart_io/runtime/bin/socket_openbsd.o
  CC(target) out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o
  CC(target) out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o
cc1: error: unrecognized command line option "-Wvla"
cc1: error: unrecognized command line option "-Wvla"
runtime/bin/net/zlib_dart.target.mk:1279: recipe for target 'out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o' failed
gmake: *** [out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o] Error 1
gmake: *** Waiting for unfinished jobs....
runtime/bin/net/zlib_dart.target.mk:1279: recipe for target 'out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o' failed
gmake: *** [out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o] Error 1
BUILD FAILED
    0m07.24s real     0m05.25s user     0m03.21s system
$ gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
g++ (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@mulander
Copy link
Author

mulander commented Sep 6, 2015

Checked with build.py -v, seems that this spot of the build uses 'cc' which I didn't shadow from the system. Still another place that should be fixed up imho.

  cc '-DDEBUG' '-D_FORTIFY_SOURCE=2' '-DNATIVE_CODE_HAS_FRAME_POINTERS' -Ithird_party/zlib  -w -UHAVE_CVAR_BUILT_ON_SEM -Wextra -Wno-unused-parameter -Wvla -g3 -ggdb3 -fno-exceptions -fstack-protector -m64 -msse2 -mno-omit-leaf-frame-pointer -O2 -fno-omit-frame-pointer  -MMD -MF out/DebugX64/.deps/out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o.d.raw  -c -o out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o third_party/zlib/adler32.c
cc1: error: unrecognized command line option "-Wvla"
runtime/bin/net/zlib_dart.target.mk:1279: recipe for target 'out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o' failed
gmake: *** [out/DebugX64/obj.target/zlib_dart/third_party/zlib/adler32.o] Error 1
gmake: *** Waiting for unfinished jobs....
  cc '-DDEBUG' '-D_FORTIFY_SOURCE=2' '-DNATIVE_CODE_HAS_FRAME_POINTERS' -Ithird_party/zlib  -w -UHAVE_CVAR_BUILT_ON_SEM -Wextra -Wno-unused-parameter -Wvla -g3 -ggdb3 -fno-exceptions -fstack-protector -m64 -msse2 -mno-omit-leaf-frame-pointer -O2 -fno-omit-frame-pointer  -MMD -MF out/DebugX64/.deps/out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o.d.raw  -c -o out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o third_party/zlib/compress.c
cc1: error: unrecognized command line option "-Wvla"
runtime/bin/net/zlib_dart.target.mk:1279: recipe for target 'out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o' failed
gmake: *** [out/DebugX64/obj.target/zlib_dart/third_party/zlib/compress.o] Error 1

@rmacnak-google
Copy link
Contributor

The GYP build was replaced with a GN build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.
Projects
None yet
Development

No branches or pull requests

3 participants