Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 683336

Summary: dev-lang/gforth-0.7.3-r1 generates image file with paths to /var/tmp/portage/...
Product: Gentoo Linux Reporter: Tommy Pettersson <ptp>
Component: Current packagesAssignee: Sergei Trofimovich (RETIRED) <slyfox>
Status: RESOLVED OBSOLETE    
Severity: minor CC: jstein
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: gforth-0.7.3-includedir.patch

Description Tommy Pettersson 2019-04-14 20:00:58 UTC
I was trying a gforth example which uses ffi to link to xlib, and got the following error:

cc1: error: /var/tmp/portage/dev-lang/gforth-0.7.3-r1/work/gforth-0.7.3/include: Permission denied

in file included from *OS command line*:-1
in file included from jedi-bob.fs:2
in file included from xlib.fs:1
in file included from /usr/share/gforth/0.7.3/lib.fs:24
/usr/share/gforth/0.7.3/fflib.fs:136: libtool compile failed
>>>end-c-library<<<
Backtrace:
$7F1E59FCA988 throw 
$7F1E5A0067C0 c(abort") 
$7F1E5A0073D8 compile-wrapper-function1 


I think the following patch should fix the problem (It does on my computer):


Index: gforth-0.7.3/Makefile.in
===================================================================
--- gforth-0.7.3.orig/Makefile.in
+++ gforth-0.7.3/Makefile.in
@@ -767,7 +767,7 @@
 #		-$(CP) $< $@
 
 gforth.fi:	$(kernel_fi) gforthmi gforth-ditc$(EC)$(EXE) $(GFORTH_FI_SRC) comp-i.fs
-		GFORTHD="./gforth-ditc -p .$(PATHSEP)$(srcdir)" GFORTH="./gforth-ditc --die-on-signal -p .$(PATHSEP)$(srcdir) -i $(kernel_fi) $(STARTUP)" includedir=`pwd`/include bindir=`pwd` libccdir=`pwd`/lib/gforth/$(VERSION)/libcc-named/ ./gforthmi gforth.fi $(FORTHSIZES) $(FORTHKFLAGS) $(STARTUP)
+		GFORTHD="./gforth-ditc -p .$(PATHSEP)$(srcdir)" GFORTH="./gforth-ditc --die-on-signal -p .$(PATHSEP)$(srcdir) -i $(kernel_fi) $(STARTUP)" includedir=$(includedir) bindir=`pwd` libccdir=$(libccdir) ./gforthmi gforth.fi $(FORTHSIZES) $(FORTHKFLAGS) $(STARTUP)
 
 # -------------	Make c-engine
 

--
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2019-05-26 09:26:40 UTC
Can you provide a minimal example to test on?
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-05-26 09:34:13 UTC
Created attachment 577822 [details, diff]
gforth-0.7.3-includedir.patch
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-05-26 09:42:12 UTC
Found it on http://qualdan.com/forth/jedi-bob-1.tar.bz2 but my session seems to work:
    $ jedi-bob-1:gforth jedi-bob.fs
    <window created>
Comment 4 Tommy Pettersson 2019-05-26 18:30:31 UTC
What do you get if ty try this?:

gforth -e 'libcc-path .path cr bye'

I get:

~/.gforth/libcc-named/ /var/tmp/portage/dev-lang/gforth-0.7.3-r1/work/gforth-0.7.3/lib/gforth/0.7.3/libcc-named/

So gforth can't find /usr/lib64/gforth/0.7.3/libcc-named/fflib.la
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2019-05-26 20:57:49 UTC
I get the same:

$ gforth -e 'libcc-path .path cr bye'
~/.gforth/libcc-named/ /tmp/portage-tmpdir/portage/dev-lang/gforth-0.7.3-r1/work/gforth-0.7.3/lib/gforth/0.7.3/libcc-named/
Comment 6 Tommy Pettersson 2019-05-27 08:37:19 UTC
Maybe you have the build files left in /var/tmp/portage/dev-lang/gforth-0.7.3-r1/ ?

When I run strace I see that gforth tries to open /var/tmp/.../fflib.la, and when it can't find it it tries to open $HOME/.gforth/libcc-named/fflib.la, and when it can't find that either it writes a source file there and tries to compile and link it, which also fails, and I think the linking fails because the libtool command in the gforth image uses the same wrong patch to /var/tmp/portage/

I see now that I do however have a compiled socket.la there, which suggests that gforth did not find /usr/lib64/gforth/0.7.3/libcc-named/socket.la, but the compilation of $HOME/.gforth/libcc-named/socket.la succeded, and that maybe the compilation of $HOME/.gforth/libcc-named/fflib.la fails for some other reason on my computer.

In any case, the build should not result in libcc-path pointing to things in /var/tmp/portage/
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2019-05-27 09:14:44 UTC
Oh, thank you for the hint!

I do have fflib.la and socket.la files in ~/.gforth/libcc-named. Those get recreated every time I run gforth jedi-bob.fs even if I delete them.

I agree final path should point to /usr/. Unfortunately your patch seems to break 
gforth build on a system where gforth is not installed yet as:

for i in fflib.fs cstr.fs unix/socket.fs; do ./gforth -e "s\" `pwd`/lib/gforth/0.7.3/libcc-named/\" libcc-named-dir-v 2! libcc-path clear-path libcc-named-dir libcc-path also-path :noname 2drop s\" /usr/lib64/gforth/0.7.3/libcc-named/\" ; is replace-rpath" ./$i -e bye; done
/tmp/portage/dev-lang/gforth-0.7.3-r2/work/gforth-0.7.3/lib/gforth/0.7.3/libcc-named/fflib.c:1:10: fatal error: gforth/0.7.3/libcc.h: No such file or directory
    1 | #include <gforth/0.7.3/libcc.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.


Which makes some sense as inplace paths are not consulted now.
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2019-06-22 16:57:12 UTC
Hardcoding would need to be fixed upstream.

What do you think if we try to sort out you fflib.la failure here instead? Can you extract source file, libtool invocation and resulting error?
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-07-05 17:58:31 UTC
Let's close as obsolete. Removing image path hardcoming should be done in upstream project as it changes bootstrap behaviour quite a bit.