Warning - non-POSIX variable name

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Warning - non-POSIX variable name

Dharmil Shah
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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Warren Young
On Aug 7, 2017, at 5:17 AM, Dharmil Shah <[hidden email]> wrote:
>
> I did something like this:
>
> 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Dharmil Shah
Warren,

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

Thanks!
Dharmil
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Warren Young
On Aug 7, 2017, at 11:39 PM, Dharmil Shah <[hidden email]> wrote:
>
> 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+.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Bob Friesenhahn
On Tue, 8 Aug 2017, Warren Young wrote:

> On Aug 7, 2017, at 11:39 PM, Dharmil Shah <[hidden email]> wrote:
>>
>> 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+.

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
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Warren Young
On Aug 9, 2017, at 9:00 AM, Bob Friesenhahn <[hidden email]> wrote:
>
> 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?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Eric Blake-3
On 08/09/2017 12:02 PM, Warren Young wrote:
> On Aug 9, 2017, at 9:00 AM, Bob Friesenhahn <[hidden email]> wrote:
>>
>> 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)

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


signature.asc (632 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Warning - non-POSIX variable name

Warren Young
On Aug 9, 2017, at 11:39 AM, Eric Blake <[hidden email]> wrote:
>
> 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?

<shrug>  It just makes the log messages nicer to read.

Loading...