public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH cygport] bin/cygport.in: Allow `-fdebug-prefix-map` to be selected instead of `-ffile-prefix-map`
@ 2024-05-25  7:25 Daisuke Fujimura
  2024-05-27 21:16 ` Jon Turney
  0 siblings, 1 reply; 3+ messages in thread
From: Daisuke Fujimura @ 2024-05-25  7:25 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Having seen this commit (
https://cygwin.com/git/?p=cygwin-apps/cygport.git;a=commit;h=9e82685e32f6717675e9f6bf55dd1336e3fc3831
),
I understand that this is problematic from a reproducibility point of
view, but I would like to be able to specify a `-fdebug-prefix-map`
because C sources with code like `#include __FILE__` cannot be
compiled.

https://github.com/cygwin/scallywag/actions/runs/9002845391/job/24732313857#step:6:1302

```
/cygdrive/d/a/scallywag/ruby/ruby-3.3.1-1.x86_64/src/ruby-3.3.1/debug_counter.h:359:10:
fatal error: /usr/src/debug/ruby-3.3.1-1/debug_counter.h: No such file
or directory
359 | #include __FILE__
| ^~~~~~~~
compilation terminated.
```

The patch is as follows.

Shell variable names in the patch should be changed to appropriate ones.

[-- Attachment #2: force-debug-prefix-map.diff --]
[-- Type: application/octet-stream, Size: 925 bytes --]

diff --git a/bin/cygport.in b/bin/cygport.in
index 15bd559e..074c86e1 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -630,14 +630,19 @@ fi
 # this requires S and B to be already defined
 if ! defined _CYGPORT_RESTRICT_debuginfo_
 then
+	prefix_map_option=file-prefix-map
+	if defined FORCE_DEBUG_PREFIX_MAP
+	then
+		prefix_map_option=debug-prefix-map
+	fi
 	for flags in {C,CXX,F,FC,GO,OBJC,OBJCXX}FLAGS
 	do
 		for map in ${DEBUG_PREFIX_MAPS[*]}
 		do
-			declare ${flags}+=" -ffile-prefix-map=${map}=/usr/src/debug/${PF}"
+			declare ${flags}+=" -f${prefix_map_option}=${map}=/usr/src/debug/${PF}"
 		done
-		declare ${flags}+=" -ffile-prefix-map=${B}=/usr/src/debug/${PF}"
-		declare ${flags}+=" -ffile-prefix-map=${S}=/usr/src/debug/${PF}"
+		declare ${flags}+=" -f${prefix_map_option}=${B}=/usr/src/debug/${PF}"
+		declare ${flags}+=" -f${prefix_map_option}=${S}=/usr/src/debug/${PF}"
 	done
 	unset flags map
 fi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH cygport] bin/cygport.in: Allow `-fdebug-prefix-map` to be selected instead of `-ffile-prefix-map`
  2024-05-25  7:25 [PATCH cygport] bin/cygport.in: Allow `-fdebug-prefix-map` to be selected instead of `-ffile-prefix-map` Daisuke Fujimura
@ 2024-05-27 21:16 ` Jon Turney
  2024-06-07 14:11   ` Daisuke Fujimura
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Turney @ 2024-05-27 21:16 UTC (permalink / raw)
  To: Daisuke Fujimura; +Cc: cygwin-apps

On 25/05/2024 08:25, Daisuke Fujimura via Cygwin-apps wrote:
> Having seen this commit (
> https://cygwin.com/git/?p=cygwin-apps/cygport.git;a=commit;h=9e82685e32f6717675e9f6bf55dd1336e3fc3831
> ),
> I understand that this is problematic from a reproducibility point of
> view, but I would like to be able to specify a `-fdebug-prefix-map`
> because C sources with code like `#include __FILE__` cannot be
> compiled.
> 
> https://github.com/cygwin/scallywag/actions/runs/9002845391/job/24732313857#step:6:1302
> 
> ```
> /cygdrive/d/a/scallywag/ruby/ruby-3.3.1-1.x86_64/src/ruby-3.3.1/debug_counter.h:359:10:
> fatal error: /usr/src/debug/ruby-3.3.1-1/debug_counter.h: No such file
> or directory
> 359 | #include __FILE__
> | ^~~~~~~~
> compilation terminated.
> ```
> 
> The patch is as follows.

Thanks very much for the patch.

Yeah, I tripped over this when I was testing your previous patch.

This seems like a generic problem which everyone is going to have with 
ruby, though.  And from a brief look at the debug_counter.h header, it 
does seem like a case of excessive cleverness - on first glance, it 
looks like this could just be written using a separate header, rather 
than recursively including itself with some define set...

(and I guess it's actually a gcc bug, or at least misfeature, that you 
can make '#include __FILE__' do something other than it's plain meaning)

Nevertheless, I guess this is needed.

> Shell variable names in the patch should be changed to appropriate ones.

Yeah, not sure what a good name for this is. Something like 
'DEBUGINFO_ONLY_DEBUG_PREFIX_MAP', maybe?

It needs to be mentioned in the documentation somewhere, as well.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH cygport] bin/cygport.in: Allow `-fdebug-prefix-map` to be selected instead of `-ffile-prefix-map`
  2024-05-27 21:16 ` Jon Turney
@ 2024-06-07 14:11   ` Daisuke Fujimura
  0 siblings, 0 replies; 3+ messages in thread
From: Daisuke Fujimura @ 2024-06-07 14:11 UTC (permalink / raw)
  To: cygwin-apps

The issue about debug_counter.h was resolved by merging the pull
request upstream.

https://github.com/ruby/ruby/pull/10895

Therefore, this patch is no longer needed and will be withdrawn.

On Tue, May 28, 2024 at 11:07 PM Jon Turney <jon.turney@dronecode.org.uk> wrote:
>
> On 25/05/2024 08:25, Daisuke Fujimura via Cygwin-apps wrote:
> > Having seen this commit (
> > https://cygwin.com/git/?p=cygwin-apps/cygport.git;a=commit;h=9e82685e32f6717675e9f6bf55dd1336e3fc3831
> > ),
> > I understand that this is problematic from a reproducibility point of
> > view, but I would like to be able to specify a `-fdebug-prefix-map`
> > because C sources with code like `#include __FILE__` cannot be
> > compiled.
> >
> > https://github.com/cygwin/scallywag/actions/runs/9002845391/job/24732313857#step:6:1302
> >
> > ```
> > /cygdrive/d/a/scallywag/ruby/ruby-3.3.1-1.x86_64/src/ruby-3.3.1/debug_counter.h:359:10:
> > fatal error: /usr/src/debug/ruby-3.3.1-1/debug_counter.h: No such file
> > or directory
> > 359 | #include __FILE__
> > | ^~~~~~~~
> > compilation terminated.
> > ```
> >
> > The patch is as follows.
>
> Thanks very much for the patch.
>
> Yeah, I tripped over this when I was testing your previous patch.
>
> This seems like a generic problem which everyone is going to have with
> ruby, though.  And from a brief look at the debug_counter.h header, it
> does seem like a case of excessive cleverness - on first glance, it
> looks like this could just be written using a separate header, rather
> than recursively including itself with some define set...
>
> (and I guess it's actually a gcc bug, or at least misfeature, that you
> can make '#include __FILE__' do something other than it's plain meaning)
>
> Nevertheless, I guess this is needed.
>
> > Shell variable names in the patch should be changed to appropriate ones.
>
> Yeah, not sure what a good name for this is. Something like
> 'DEBUGINFO_ONLY_DEBUG_PREFIX_MAP', maybe?
>
> It needs to be mentioned in the documentation somewhere, as well.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-07 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-25  7:25 [PATCH cygport] bin/cygport.in: Allow `-fdebug-prefix-map` to be selected instead of `-ffile-prefix-map` Daisuke Fujimura
2024-05-27 21:16 ` Jon Turney
2024-06-07 14:11   ` Daisuke Fujimura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).