Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Environment Variables expanded in subdir.mk when "Expand Env. Variables Refs in Makefiles" not checked

Thanks Martin,

I added the info there.

Jonah

~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com


On 11 July 2016 at 15:56, Jonah Graham <jonah@xxxxxxxxxxxxxxxx> wrote:
> Hi Martin,
>
> I can indeed confirm that having a space causes the problem. That is a
> good patience for narrowing down the problem! Thanks for following
> through on this.
>
> Can you raise a bug on this?
>
> Based on what you have provided, I can track down the problem code, or
> at least where the space makes a difference:
>
> https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java#n2250
>
> In the generateToolCommandLineInfo method it resolves command
> differently depending on whether there is a space in the input or
> output file name. As the build config is used as the directory name
> that makes a difference. This can be demonstrated also by creating any
> folders with spaces in the names.
>
> Note, the difference is not just the expansion of variables. There is
> also a difference in the rule, the pattern rule is not used, which
> implies that the same space checking convention is used elsewhere.
>
> e.g. with no spaces:
> # Each subdirectory must supply rules for building sources it contributes
> src/%.o: ../src/%.c
>  @echo 'Building file: $<'
>  @echo 'Invoking: Cygwin C Compiler'
>  ${CC} -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)"
> -MT"$(@)" -o "$@" "$<"
>  @echo 'Finished building: $<'
>  @echo ' '
>
> with spaces:
> # Each subdirectory must supply rules for building sources it contributes
> src/Hello\ With\ Space.o: ../src/Hello\ With\ Space.c
>  @echo 'Building file: $<'
>  @echo 'Invoking: Cygwin C Compiler'
>  gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Hello With
> Space.d" -MT"src/Hello\ With\ Space.d" -o "$@" "$<"
>  @echo 'Finished building: $<'
>  @echo ' '
>
> All that said, I can identify a problem, but I don't know the right
> way to resolve it.
>
> I hope that helps.
>
> Jonah
> ~~~
> Jonah Graham
> Kichwa Coders Ltd.
> www.kichwacoders.com
>
>
> On 11 July 2016 at 13:49, Martin Townsend
> <Martin.Townsend@xxxxxxxxxxxxxx> wrote:
>> Hi Jonah,
>>
>>
>> Thanks for the prompt reply.  I do have the GNU Arm Eclipse plugins as I
>> tried these out but realised I could do what I needed with just the CDT by
>> using GCC Cross with Envrionment variables.
>>
>> I tried uninstalling the GNU Arm Eclipse plugins but the problem still
>> persists.
>>
>> So I installed a clean version of Mars with CDT and created a Hello World
>> project using Cross GCC and set it up with my environment variables and
>> subdir.mk contained the environment variables with no expansion.
>>
>> So I imported my troublesome project into the clean installation of eclipse
>> and the problem still persists, so it is something todo with my project.
>>
>> After several hours of trying different things I think I have found the
>> problem.  My configuration name has spaces in and if I remove them the
>> subdir.mk files are generated correctly.  I doubled checked in the clean
>> installation and if you rename the Debug Configuration to something like
>> "Debug (Test)" then you will see the problem.
>>
>>
>> Could you try renaming the configuration to have spaces in and confirm that
>> you see this as well?
>>
>>
>> Many Thanks,
>> Martin.
>>
>>
>> ________________________________
>> From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of
>> Jonah Graham <jonah@xxxxxxxxxxxxxxxx>
>> Sent: 11 July 2016 11:02:03
>> To: CDT General developers list.
>> Subject: Re: [cdt-dev] Environment Variables expanded in subdir.mk when
>> "Expand Env. Variables Refs in Makefiles" not checked
>>
>> Hi Martin,
>>
>> I doubt this bug would have been fixed between CDT 8.8 and CDT 9.0,
>> but it may have. It also may be more subtle than that because on CDT
>> 8.8.1 and 9.0 I see the correct behaviour. Perhaps there are some
>> additional settings at play here? Are you using some additional
>> plug-ins such as http://gnuarmeclipse.github.io/?
>>
>> As for where subdir,mk is generated, see:
>>
>> subdir.mk defined here:
>> https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java#n51
>>
>> the setting is accessed via keepEnvironmentVariablesInBuildfile() here:
>> https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/build//org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java#n301
>>
>> Checking the references/call hierarchy of the above should point you
>> at all the relevant code.
>>
>> Jonah
>> ~~~
>> Jonah Graham
>> Kichwa Coders Ltd.
>> www.kichwacoders.com
>>
>>
>> On 11 July 2016 at 10:33, Martin Townsend
>> <Martin.Townsend@xxxxxxxxxxxxxx> wrote:
>>> Hi,
>>>
>>> I'm using CDT 8.8.1 with Mars.2 Release of Eclipse (4.5.2) and have setup
>>> a project for cross compilation which works great.  We put the generated
>>> makefiles under source control as they are used by external tools that can
>>> compile and package the same code base.
>>>
>>> Before starting eclipse we set several Environment variables which are
>>> then used within the CDT (mainly $CC and $CFLAGS), then we ensure that the
>>> "Expand Env. Variables Refs in Makefiles" is not checked.  Then in the C/C++
>>> build settings -> Tool Settings we use ${CC} ${CFLAGS} in the Command to
>>> invoke our cross compiler.  The main generated makefile uses the environment
>>> variables as expected:
>>>
>>>     ....
>>>     @echo 'Building target: $@'
>>>     @echo 'Invoking: Cross GCC Linker'
>>>     ${CC} ${CFLAGS} ${LDFLAGS} -shared -o "mod_smu.so" $(OBJS)
>>> $(USER_OBJS) $(LIBS)
>>>     @echo 'Finished building target: $@'
>>>     @echo ' '
>>>     ....
>>>
>>>
>>> but the generated subdir.mk files do expand the environment variables:
>>>
>>>         @echo 'Building file: $<'
>>>         @echo 'Invoking: Cross GCC Compiler'
>>>         arm-none-linux-gnueabi-gcc  -march=armv7-a -marm -mfpu=neon
>>> -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/sdk/2016.01/....[snip]....
>>>         @echo 'Finished building: $<'
>>>         @echo ' '
>>>
>>> Is this a bug? if so has it been fixed in 9.0?
>>> Also if someone could point me to where in the code that the subdir.mk
>>> files are generated so I can put a temporary fix in place it would be most
>>> appreciated.
>>>
>>>
>>> Many Thanks,
>>> Martin.
>>>
>>> _______________________________________________
>>> cdt-dev mailing list
>>> cdt-dev@xxxxxxxxxxx
>>> To change your delivery options, retrieve your password, or unsubscribe
>>> from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>> _______________________________________________
>> cdt-dev mailing list
>> cdt-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from
>> this list, visit
>> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>>
>>
>> _______________________________________________
>> cdt-dev mailing list
>> cdt-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from
>> this list, visit
>> https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top