[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make opens Android Studio

From: Bob Proulx
Subject: Re: Make opens Android Studio
Date: Mon, 21 Mar 2016 18:08:05 -0600
User-agent: Mutt/1.5.24 (2015-08-30)

Sideboard wrote:
> Bob Proulx wrote:
> > An error in the make rules breaking an assembler call $(AS) and
> > invoking "AS" instead of the value of AS?  Just guessing.
> That is a very good guess. I thought I had that covered when commenting
> out an alias 'as' in my .bashrc.

Just fyi but shell aliases are only for your command line.  They won't
be available to programs you are launching.  Programs will only be
able to access things found on your $PATH.

> But I just found a symlink $HOME/bin/as pointing to the Android
> Studio executable. When I rename it, `make' compiles again.

Yay!  So the problem was that you has a different "as" that shadowed
and overrode the /usr/bin/as one.  Of course being able to do that so
as to be able to use a newer gcc suite for example is a good thing.
But when the association isn't immediately obvious (such as what does
make have to do with android studio?) then it can be surprising.

I once knew someone who made an "install file" alias to "if" in their
bashrc file.  And then was surprised to find that later control flow
in their bashrc file of 'if ...; then ...; fi' no longer worked. :-)

> I thought I found the culprit in the initial Makefile: AS =
> $(CROSS_COMPILE)as But even when changing that to the full path the
> error occurs. Turns out `gcc' calls `as' and thereby executes the
> symlinked Android Studio.

Yep.  Glad you figured it out.

> This also works with an alias 'as'.

Are you sure?  Bash aliases are specific to bash interactive shells.

> I'm not sure whether that is the intended behavior to keep it
> customizable or if some edge-case was overlooked. Should I report that
> to the gcc list?

The gcc suite gcc, cpp, ld, as, and others, not a complete list, too.
If any of those are overridden then the overridden versions will be
called instead.  This is a very useful feature.

I am not sure I have completely understood the nuance of your question
but I don't see any behavior that is unexpected here.

It might be useful for you to create a very small C program and
compile it with gcc -v to see all of the processing that goes on under
the gcc hood.  Some things have become more internal to compilers for
performance reasons but in the classic case one expects to see it
invoke a C-preprocessor (cpp), followed by compiler (cc1) to assembly
language, followed by assembler (as) to assemble to machine code,
followed by link-editor (ld) to link into an executable or library.
Implementations differ on exact details.


$ gcc -v -o hello hello.c output...adding -v for verbose information...
$ gcc -v -o hello hello.c
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 5.3.1-12' 
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-5 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib 
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home 
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar 
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic 
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu 
Thread model: posix
gcc version 5.3.1 20160316 (Debian 5.3.1-12) 
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1 -quiet -v -imultiarch x86_64-linux-gnu 
hello.c -quiet -dumpbase hello.c -mtune=generic -march=x86-64 -auxbase hello 
-version -o /tmp/ccVPgzPE.s
GNU C11 (Debian 5.3.1-12) version 5.3.1 20160316 (x86_64-linux-gnu)
        compiled by GNU C version 5.3.1 20160316, GMP version 6.1.0, MPFR 
version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory 
#include "..." search starts here:
#include <...> search starts here:
End of search list.
GNU C11 (Debian 5.3.1-12) version 5.3.1 20160316 (x86_64-linux-gnu)
        compiled by GNU C version 5.3.1 20160316, GMP version 6.1.0, MPFR 
version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 81f31b6fda39aed0d8a25d5b883a3885
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-mtune=generic' '-march=x86-64'
 as -v --64 -o /tmp/cckV3QSK.o /tmp/ccVPgzPE.s
GNU assembler version 2.26 (x86_64-linux-gnu) using BFD version (GNU Binutils 
for Debian) 2.26
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin 
-plugin-opt=-fresolution=/tmp/cc5RmrXQ.res -plugin-opt=-pass-through=-lgcc 
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc 
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ 
--build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker 
/lib64/ -o hello 
/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu 
-L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib 
-L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. /tmp/cckV3QSK.o -lgcc --as-needed 
-lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]