1

If I have installed a program from source (.tar.gz) using ./configure, make, make install – and then later on, want to add a build option (not sure the proper terminology – compile option?), is this possible?

Do I have to uninstall the program first (like make uninstall or something) or, assuming I am using the same source files, can I just run the same ./configure --with-option, make, make install again?

I would like to add an option to a working installation of Squid that wasn't added by default.

  • You can re-run the build process and include the new option at configure time. HOWEVER... backup any modified config files first, as the make install will likely overwrite with defaults provided. – ivanivan Dec 31 '18 at 6:31
1

To add to Fabby's answer:

  • The answer to your question is Yes and No.  Yes, it's possible to add compile-time options to a program that you have installed.  But no, you can't do it without replacing / overwriting the compiled binary.

    At the risk of belaboring the obvious, some programs allow you to change how they work by changing configuration files, without touching the binary.  But then you're talking about configuration options, not compile-time options.

  • You generally don't need to uninstall the program; make install will replace the existing, installed binary.
  • In the case of a background process, daemon, server or service, you should probably make sure that the program is not running when you replace it.
  • To clarify, yes, I would like to replace the binary with a newly compiled one with the additional option added. Both answers were helpful, but I'm accepting this one because it added "you should probably make sure that the program is not running when you replace it" which (duh) I hadn't thought of. – lchras Jan 1 at 18:26
  • The last point is bogus; you can replace a program while it is running. This is not windows ;-). The install(1) utility (which is used by make install) will not try to open the binary for writing (which is bound to fail with ETXBUSY), but will call rename(2) to replace the directory entry, and the running process will continue to use the old binary until restarted. – Uncle Billy Jan 1 at 20:17
  • @Ichras there's no need to make sure the program is not running while you're doing make install. The process will continue to use the old binary. Try this if you don't believe me: install /bin/sleep /tmp/sleep; /tmp/sleep 400 & install /bin/true /tmp/sleep; ls -l /proc/$!/exe => ... /tmp/sleep (deleted). /proc/PID/exe is linux-specific, but the install/rename/mv behavior is the same on any unix system. – Uncle Billy Jan 1 at 20:28
  • @UncleBilly Ah, okay. So I can just do the regular install, and the effect will be that it will overwrite everything, but I won't be able to use the new options until the process is stopped and restarted? – lchras Jan 2 at 0:34
  • @Ichras. Exactly. – Uncle Billy Jan 2 at 6:48
4

When following the original instructions and adding an additional build option, and recompiling again, the existing version of any program (including squid) will be replaced by the new version.

Therefore, in case you do something stupid disastrous, make a copy of the existing working program before proceeding. ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.