On Thu, Jun 22, 2017 at 12:13 AM, Uros Bizjak <[email protected]> wrote:
>
> However, there is one another issue with zdefaultcc.go generation. On
> my system, the default gccgo, gcc and g++ are installed in:
>
> $ which gccgo
> /usr/bin/gccgo
> $ which gcc
> /usr/bin/gcc
>
> but gotools Makefile uses $(bindir) to derive absolute path to the binaries:
>
> echo 'package main' > zdefaultcc.go.tmp
> echo 'const defaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"'
>>> zdefaultcc.go.tmp
> echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >>
> zdefaultcc.go.tmp
> echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >>
> zdefaultcc.go.tmp
> echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
>
> However, since $prefix (by default) points to /usr/local, $bindir
> points to /usr/local/bin. Consequently, zdefaultcc.go reads:
>
> package main
> const defaultGCCGO = "/usr/local/bin/gccgo"
> const defaultCC = "/usr/local/bin/gcc"
> const defaultCXX = "/usr/local/bin/g++"
> const defaultPkgConfig = "pkg-config"
>
> The absolute path is wrong, since - as mentioned above - the system
> compiler is installed in /usr/bin.
>
> Probably we just need to remove $bindir and assume that these binaries
> exist in $PATH.
I did that for defaultCC and defaultCXX, as appended.
Ian
2017-06-26 Ian Lance Taylor <[email protected]>
* Makefile.am (s-zdefaultcc): Don't record $(bindir) for defaultCC
or defaultCXX.
* Makefile.in: Rebuild.
Index: Makefile.am
===================================================================
--- Makefile.am (revision 249668)
+++ Makefile.am (working copy)
@@ -100,8 +100,8 @@ zdefaultcc.go: s-zdefaultcc; @true
s-zdefaultcc: Makefile
echo 'package main' > zdefaultcc.go.tmp
echo 'const defaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"' >>
zdefaultcc.go.tmp
- echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >>
zdefaultcc.go.tmp
- echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >>
zdefaultcc.go.tmp
+ echo 'const defaultCC = "$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
+ echo 'const defaultCXX = "$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
$(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
$(STAMP) $@
Index: Makefile.in
===================================================================
--- Makefile.in (revision 249668)
+++ Makefile.in (working copy)
@@ -582,8 +582,8 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-@NATIVE_FALSE@uninstall-local:
@NATIVE_FALSE@install-exec-local:
+@NATIVE_FALSE@uninstall-local:
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
@@ -682,8 +682,8 @@ zdefaultcc.go: s-zdefaultcc; @true
s-zdefaultcc: Makefile
echo 'package main' > zdefaultcc.go.tmp
echo 'const defaultGCCGO = "$(bindir)/$(GCCGO_INSTALL_NAME)"' >>
zdefaultcc.go.tmp
- echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >>
zdefaultcc.go.tmp
- echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >>
zdefaultcc.go.tmp
+ echo 'const defaultCC = "$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
+ echo 'const defaultCXX = "$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
echo 'const defaultPkgConfig = "pkg-config"' >> zdefaultcc.go.tmp
$(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
$(STAMP) $@