3

I have source code of a compiler which I am building like this:

/path/to/srcdir/configure --prefix=/path/to/installdir
make
make install

I want to distribute the resulting 'installdir' to other machines, with the intent that anybody could use the compiler binaries without going through the 3-stage build process (I am just including the installdir in my distribution tarball).

For testing, I am copying the installdir to another machine under a different user, and then just trying to compile a test program using the binaries I just copied over, like this:

installdir/bin/ucc -mp -o test load_bl.c

Then, I get an error as follows:

cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/include: Permission denied
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/lib/gcc/x86_64-redhat-linux/4.2.0/include: Permission denied
cc1: error: /home/sghosh/normalbuild/installdir/open64-gcc-4.2.0/x86_64-redhat-linux/include: Permission denied

The /home/sghosh/normalbuild/install is what is specified as --prefix during configure on my build machine. The installdir/bin/ucc binary require some files in the open64-gcc-4.2.0 dir under installdir, but since that is the path mentioned in --prefix, so it's still looking for it there, and I want it to look into the same dir in the current machine. FYI, I do not have sudo/root privileges.

How do I come up with a binary distribution that would work in any machine (build once, use anywhere sorts), and not look into the initial --prefix path in this case?

I have had a similar question in superuser, but since lots of edit happened and I got no response to the new question, so I am writing it here.

Sayan
  • 2,662
  • 10
  • 41
  • 56
  • are you making a static bin or one that uses shared objects (.so). If you can't create the same dir hierarchy on all machines, the embedded paths to `.so`s will fail because they don't exist in the right loc. I don't get why you're getting 'Permission denied'. Have you checked that the users/groups NAMES for obj ownership (possibly the integer values for same) match with your build machine AND that the perms are set correct to these directories?. If you can't `su root` on the rmt machs to overcome perm issues, then building a static binary with all libraries embedded may be a better solution. – shellter Nov 14 '11 at 04:08
  • Thank you for answering, yes I am passing the `--disable-shared` option to the `configure` statement. But I noticed that despite of that there are still some `.so` files in the installdir. The 'Permission Denied' is perhaps because it's trying find the same dir as my build machine for `.so` files (as you said). I guess the problem is solely because I am not able to make a static bin. – Sayan Nov 14 '11 at 04:41
  • I searched on `[make] static linking`, and found several good answers for related issues. Good luck. – shellter Nov 14 '11 at 04:44
  • It looks the "prefix" path is being built into the compiler binary as part of its default search path for include files. The solution to that, if one exists, will be specific to the particular compiler. You should mention its name to get the attention of people familiar with it. – slowdog Nov 15 '11 at 22:53
  • 1
    If this is happening even when you specify `--disable-shared` in the `./configure` step, then this _might_ be a build bug in the software distribution you're using. Therefore, it might be worth asking about this in the support spaces for that tool. – Norman Gray Jul 24 '12 at 17:32
  • 3
    Do not include binaries in your distribution tarball. Period. If you want to distribute binaries, you must use a binary distribution tool. Most platforms provide very good support for some sort of package management tool (`deb`, `rpm`, `pkg` ). If you want to distribute binaries, use one of those tools. – William Pursell Aug 09 '12 at 16:26

1 Answers1

0

Check this tool: https://github.com/pgbovine/CDE

CDE is a tool that automatically packages up the Code, Data, and Environment involved in running any set of Linux commands so that they can execute identically on another computer without any installation or configuration.

Naruil
  • 2,300
  • 11
  • 15