Ticket #495 (closed todo: fixed)

Opened 6 years ago

Last modified 5 years ago

[TODO] remove hardcoded path from installable pbc_to_exe

Reported by: allison Owned by:
Priority: normal Milestone:
Component: install Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

Running an installed version of pbc_to_exe doesn't currently work, because it includes a hardcoded path to the build directory for include headers. Already talked to chromatic about it, and he knows a fix. I'm submitting this ticket to record the output from the failure (attached).

Attachments

installed_pbc_to_exe_output.txt Download (4.6 KB) - added by allison 6 years ago.
output from using installed pbc_to_exe to build pynie executable
patch Download (2.5 KB) - added by gerd 5 years ago.
generated with "diff -u" it patches three files

Change History

Changed 6 years ago by allison

output from using installed pbc_to_exe to build pynie executable

  Changed 5 years ago by heidnes

Another instance of this problem can be found in  http://gnats.netbsd.org/41275/ i.e. from the packaging of parrot 1.0.0 for the pkgsrc package system.

  Changed 5 years ago by gerd

pbc_to_exe access src/parrot_config.o from the build directory. My suggestion is to rebuilding the Parrot library with the object parrot_config included aber building miniparrot, config.fpmc and the object parrot_config. So pbc_to_exe do not need explicit to link with parrot_config.

Here is an example that extends the target: $(SRC_DIR)/parrot_config$(O) of the Makefile to rebuild the Parrot shared library after generating parrot_config.o

$(SRC_DIR)/parrot_config$(O) : $(SRC_DIR)/parrot_config.c $(O_FILES)

$(CC) $(CFLAGS) -I$(@D) -o $(SRC_DIR)/parrot_config$(O) -c $(SRC_DIR)/parrot_config.c @echo "Rebuild the Parrot Library" $(MKPATH) blib/lib $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) -o $(LIBPARROT_SHARED) -Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION) \

$(SRC_DIR)/parrot_config$(O) $(O_FILES) $(C_LIBS) $(ICU_SHARED)

( cd blib/lib ; ln -sf libparrot$(SHARE_EXT).$(SOVERSION) libparrot$(SHARE_EXT) )

  Changed 5 years ago by allison

Thanks gerd, the problem isn't linking pbc_to_exe to parrot_config, the problem is that pbc_to_exe itself is using hardcoded paths instead of parrot_config values. Note that it's trying to find parrot/parrot.h and parrot/embed.h.

  Changed 5 years ago by gerd

There is a linking problem with an installed pbc_to_exe program to the object parrot_config at the current version when the build directory will be removed.

Executing installed pbc_to_exe with existing build directory:

pbc_to_exe hello.pbc

gcc -o hello.o -I/home/gz016/rpmbuild/BUILD/parrot-1.2.0/include -D_REENTRANT -D_GNU_SOURCE gs ... -DHAS_GETTEXT -c hello.c Compiled: hello.o gcc -o hello hello.o /home/gz016/rpmbuild/BUILD/parrot-1.2.0/src/parrot_config.o -Wl,-rpath=/home/gz016/rpmbuild/BUILD/parrot-1.2.0/blib/lib -L/home/gz016/rpmbuild/BUILD/parrot-1.2.0/blib/lib -lparrot -Wl,-E -Wl,-rpath,/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/CORE -Wl,-E -lcurses -lm -lgmp -lreadline -licuuc -licudata -lpthread -lm Linked: hello

Executing installed pbc_to_exe with deleted build directory:

pbc_to_exe hello.pbc

gcc -o hello.o -I/home/gz016/rpmbuild/BUILD/parrot-1.2.0/include -D_REENTRANT -D_GNU_SOURCE gs ... -DHAS_GETTEXT -c hello.c Compiled: hello.o cc1: Warnung: /home/gz016/rpmbuild/BUILD/parrot-1.2.0/include: Datei oder Verzeichnis nicht gefunden Compiled: hello.o gcc -o hello hello.o /home/gz016/rpmbuild/BUILD/parrot-1.2.0/src/parrot_config.o -Wl,-rpath=/home/gz016/rpmbuild/BUILD/parrot-1.2.0/blib/lib -L/home/gz016/rpmbuild/BUILD/parrot-1.2.0/blib/lib -lparrot -Wl,-E -Wl,-rpath,/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/CORE -Wl,-E -lcurses -lm -lgmp -lreadline -licuuc -licudata -lpthread -lm gcc: /home/gz016/rpmbuild/BUILD/parrot-1.2.0/src/parrot_config.o: Datei oder Verzeichnis nicht gefunden linking failed current instr.: 'link_file' pc 822 (tools/dev/pbc_to_exe.pir:438) called from Sub 'main' pc 120 (tools/dev/pbc_to_exe.pir:101)

  Changed 5 years ago by gerd

I looks like that an installed pbc_to_exe should use install_config.o to link programs. But install_config.o will not be installed from the script tools/dev/install_files.pl. I think a line like the following should be added to MANIFEST.generated to fix this:

src/install_config.o [main]lib

  Changed 5 years ago by pmichaud

  • component changed from none to install

  Changed 5 years ago by gerd

My favour solution is still: rebuilding libparrot after install_config.fpmc is created

install_config.fpmc is created with the command: ./parrot config_lib.pasm --install > install_config.fpmc

After that libparrot could rebuilded with including src/install_config.o.

Calling "make install" or "make install-dev" should do this, so that the installable_* do not need to link explicit with src/install_config.o.

The installed pbc_to_exe program should get the reference to `Parrot_set_config_hash' from the parrot library included on the system.

If not anyone is against this solution, I will start to write a patch that will do that.

  Changed 5 years ago by allison

The problem is here in tools/dev/pbc_to_exe.pir:

518     .local string includedir, pathquote
519     includedir = concat build_dir, slash
520     includedir = concat includedir, 'include'

It's hardcoding the include directory to a subdirectory of the build directory, which is wrong.

  Changed 5 years ago by allison

Fixed the hardcoded path in r39993 and r39995, which resolves the original bug report. But, once that's out of the way, gerd is right that there's an additional linking problem.

cc -o pynie pynie.o /home/allison/tcltmp/snark/parrot-1.3.0/src/parrot_config.o -Wl,-rpath=/home/allison/tcltmp/snark/parrot-1.3.0/blib/lib -L/home/allison/tcltmp/snark/parrot-1.3.0/blib/lib -lparrot -Wl,-E  -L/usr/local/lib -Wl,-E -ldl -lm -lpthread -lcrypt

'snark' here is the build path ('boojum' was the install path). The paths for -rpath and -L (for -lparrot) can be fixed by using the configuration values 'rpath_lib' instead of 'rpath_blib' and 'inst_libparrot_linkflags' instead of 'libparrot_linkflags' when the 'installed' configuration value is true.

For the other part, installing parrot_config.o (or install_config.o) is a better solution than including it in installable_libparrot.so.

Changed 5 years ago by gerd

generated with "diff -u" it patches three files

  Changed 5 years ago by gerd

The patch changes the files: tools/build/parrot_config_c.pl, tools/dev/pbc_to_exe.pir and config/gen/makefiles/root.in

to rebuild libparrot.so to adding src/parrot_config.o.

So an installed pbc_to_exe only need his libparrot for linking. I tested it under Fedora 11. The output is:

[gz016@hilton t_prog]$ /home/gz016/parrot-sources/test/installed/bin/pbc_to_exe hello.pbc gcc -o hello.o ... gcc -o hello hello.o -L/home/gz016/parrot-sources/test/build/blib/lib -lparrot -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE -L/usr/local/lib -Wl,-E -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lgmp -lreadline -licuuc -licudata -lpthread -lm Linked: hello [gz016@hilton t_prog]$

So an installed pbc_to_exe from an package should work for building languages. Perhaps I have time to try this tomorrow.

  Changed 5 years ago by gerd

I tried the patch in a rpm. It makes the pbc_to_exe program from the Parrot rpm working. The build directory can removed.

I have no windows for trying the patch, but all windows relevant things are unchanged.

  Changed 5 years ago by coke

pbc_to_exe status...

                     Patch Applied  Patch Not Applied
                     -------------  -----------------
Build dir in place : works          fails (link)
Build dir removed  : fails (link)   fails (link) 

This ticket is tied to TT #691.

follow-up: ↓ 14   Changed 5 years ago by pmichaud

See also TT #829 (just added), in which the r39993 commit is causing Rakudo to fail one of its tests under 32-bit kubuntu.

Pm

in reply to: ↑ 13   Changed 5 years ago by pmichaud

Replying to pmichaud:

See also TT #829 (just added), in which the r39993 commit is causing Rakudo to fail one of its tests under 32-bit kubuntu.

It appears to have been fixed as of r40017.

Pm

  Changed 5 years ago by allison

We want libparrot to be relocatable, which means not linking the frozen config values in parrot_config.o into libparrot.so.

I made changes in r40038 and r40039 which install src/install_config.o as lib/parrot/[version]/parrot_config.o and change pbc_to_exe to correctly use configured paths rather than hardcoded paths for the lib directories.

With these changes I'm able to build the pynie and tclsh executables from an installed parrot with the build directory deleted. Would appreciate tests on other languages.

follow-up: ↓ 17   Changed 5 years ago by gerd

I tried an installed pbc_to_exe program now and all thinks are looking fine yet, so I think this ticket can be closed.

in reply to: ↑ 16   Changed 5 years ago by darbelo

  • status changed from new to closed
  • resolution set to fixed

Replying to gerd:

I tried an installed pbc_to_exe program now and all thinks are looking fine yet, so I think this ticket can be closed.

No complaints or any other activity in three months. Closing ticket as suggested by the comments.

Note: See TracTickets for help on using tickets.