Discussion:
Warning - non-POSIX variable name
Dharmil Shah
2017-08-07 11:17:00 UTC
Permalink
Hey guys,

I need to make my api using the llvm c compiler. Hence I am specifying the
llvm path in the CC variable. in the Makefile.am, I did something like this:

CC=${CC - /../../llvm-arm-toolchain-ship/3.8/bin/clang}

I am getting the following warning when I run the autoreconf command

Makefile.am:14: warning: CXX -
/../../llvm-arm-toolchain-ship/3.8/bin/clang++: non-POSIX variable name
Makefile.am:14: (probably a GNU make extension)

What's the correct way to go about this?

Thanks!




--
View this message in context: http://gnu-automake.7480.n7.nabble.com/Warning-non-POSIX-variable-name-tp22506.html
Sent from the Gnu - Automake - General mailing list archive at Nabble.com.
Warren Young
2017-08-07 18:29:15 UTC
Permalink
Post by Dharmil Shah
CC=${CC - /../../llvm-arm-toolchain-ship/3.8/bin/clang}
I don’t know that syntax, and due to its form, I’ve failed to Google up a reference to it, so I don’t know what exactly it is you’re trying to accomplish.

However, I don’t see what’s wrong with either:

1. CC=../../llvm-arm-toolchain-ship/3.8/bin/clang

2. autoconf CC=../../llvm-arm-toolchain-ship/3.8/bin/clang

3. Writing an autoconf macro that seeks out the nearest Clang installation compatible with your necessary build flags (-march=armwhatever, etc.).

That’s in increasing order of preference.
Dharmil Shah
2017-08-08 05:39:16 UTC
Permalink
Warren,

I followed your suggestions and hence I am able to compile my package using
the llvm compiler.

Thanks!
Dharmil




--
View this message in context: http://gnu-automake.7480.n7.nabble.com/Warning-non-POSIX-variable-name-tp22506p22510.html
Sent from the Gnu - Automake - General mailing list archive at Nabble.com.
Warren Young
2017-08-08 15:36:58 UTC
Permalink
Post by Dharmil Shah
I followed your suggestions and hence I am able to compile my package using
the llvm compiler.
I hope you chose option 3.

On re-reading that email, I think option 2 is wrong, or at least, it isn’t what I meant to write:

$ ./configure CC=../../llvm-arm-toolchain-ship/3.8/bin/clang

The main problem with option 2 is that it requires you to give that long command on each manual re-configure. It’s better to code the clang-seeking rules into an autoconf macro, if only because you will eventually move on to Clang 3.9+.
Bob Friesenhahn
2017-08-09 15:00:12 UTC
Permalink
Post by Warren Young
Post by Dharmil Shah
I followed your suggestions and hence I am able to compile my package using
the llvm compiler.
I hope you chose option 3.
$ ./configure CC=../../llvm-arm-toolchain-ship/3.8/bin/clang
The main problem with option 2 is that it requires you to give that long command on each manual re-configure. It’s better to code the clang-seeking rules into an autoconf macro, if only because you will eventually move on to Clang 3.9+.
Passing a relative path to CC seems error prone since it only applies
to the current working directory and will fail as soon as any Makefile
recurses.

Bob
--
Bob Friesenhahn
***@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Warren Young
2017-08-09 17:02:00 UTC
Permalink
Passing a relative path to CC seems error prone since it only applies to the current working directory and will fail as soon as any Makefile recurses.
Maybe you have a better answer to this related question: is there a portable alternative to GNU readlink’s -f option?

On a Linux box, I’d get around the problem you raise with:

$ ./configure CC=$(readlink -f ../../llvm-arm-toolchain-ship/3.8/bin/clang)

On other platforms, you can install GNU coreutils, but since there is often an OS-provided readlink implementation, you then have to have extra code to look for greadlink or similar and run that instead.

Is there a better way?
Eric Blake
2017-08-09 17:39:00 UTC
Permalink
Passing a relative path to CC seems error prone since it only applies to the current working directory and will fail as soon as any Makefile recurses.
Maybe you have a better answer to this related question: is there a portable alternative to GNU readlink’s -f option?
$ ./configure CC=$(readlink -f ../../llvm-arm-toolchain-ship/3.8/bin/clang)
Why not just:

./configure CC="$PWD/../../llvm-arm-toolchain-ship/3.8/bin/clang"

which turns your relative name into an absolute one?

Do you HAVE to have the canonical name?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Warren Young
2017-08-09 18:08:39 UTC
Permalink
Post by Eric Blake
./configure CC="$PWD/../../llvm-arm-toolchain-ship/3.8/bin/clang"
which turns your relative name into an absolute one?
Do you HAVE to have the canonical name?
<shrug> It just makes the log messages nicer to read.

Loading...