Use of __FILE__ macro prevents reproducible builds in appfw components

Description

 

The _FILE_ macro will embed the BUILD path into the binary.

This leads to non-reproducible builds.

 

Either we remove the _FILE_ macro or we only use the base filename. There is no default macro for that, but solutions using a cmake define.

 

Details:

 

The diffoscope output shows the build-path as part of .rodata of the binary:

Environment

None

Attachments

1

Activity

Show:

jose bollo 
November 15, 2019 at 1:23 PM

I had issues when I wanted to debug: the sources wasn't retrieved by debugger on my host when I defined the prefix in CMakeList.txt of the project.

I think that it is an issue in the build system.

Jan-Simon Moeller 
September 13, 2019 at 7:43 PM

It needs to be a trailing space with prepend.

I'd probably go for

as this is aligned with the debug-prefix-map statements.

Wrt location:

  • to get started, we'd use it for the appfw and through the cmake module in the wgt's.

  • we can also check if a global CFLAGS makes sense (need to check upstream master).
    .

Stephane Desneux 
September 13, 2019 at 7:29 AM

... or write a small class that does the tweak on CFLAGS (gcc-tweaks.bbclass for example) then inherit from it in the needed recipes. This way, some logic can be added to be smarter if needed. And for apps, aglwgt.bbclass can also inherit from gcc-tweaks: so no need to update each app recipe.

jose bollo 
September 13, 2019 at 6:28 AM

The option must be prepended to be evaluated before -fdebug-prefix-map.
So the courrent definition should be

Where ${S} is yocto compatible.

An other option:

That produce p/a/t/h instead of ./p/a/t/h

I don't known where to put that line. Setting it globally is perhaps dangerous: does clang accept that option? (checking that ... No it doesn't!: clang-6.0: error: unknown argument: '-ffile-prefix-map=...').

So I propose to revert all what i pushed to quickly and to instead add the prepend option recipes by recipe.

Stephane Desneux 
September 12, 2019 at 6:56 PM

yes, order is important: file-prefix-map overrides debug-prefix-map => debug opts must come last to be preserved.

DEBUG_PREFIX_MAP might also be the variable to tweak

Fixed

Details

Assignee

Reporter

Fix versions

Labels

Contract ID

Priority

Created September 5, 2019 at 5:23 PM
Updated April 8, 2021 at 11:04 PM
Resolved April 8, 2021 at 11:04 PM