What would the "right" way to use a local build of cmake without tampering with the system one? - installation

There is a current "vogue" in some categories of software (I have observed it with 3D software), to force the use of the last library or tool, making them the facto incompatible with (not so) old distribution. e.g.:
some (non free) recent slicers for resin printing are incompatible
with my 2019!!!(doh) linux mint because it was build with a more
recent version of glibc, or even
I looks like I won't be able to build the last release version of
openscad, because it requires a more recent version of cmake...
So, in this last case, I thought I should be able to make a local built of the more recent cmake, but I didn't find an alt-install make's tag like with python, for an example (in python, make alt-install will install in /usr/local/bin instead of /usr/bin which would break your system.

Related

GCC: How to find out why a library is included in the executable

This is the problem:
(On Linux Slackware64) I compiled Inkscape (0.92.3) and found that exporting to PNG doesn't work. An indication on the terminal tells me:
libpng warning: Application built with libpng-1.6.16 but running with 1.5.13
First reaction was to list the linked libraries using ldd. Indeed, both libpng-1.6.16 and libpng-1.5.13 are listed as necessary.
So, I suspected that some of the other libraries was requiring libpng-1.5.13. I made a small Python program which takes all the libraries (except the libpngs) and applies ldd to each of them. None of them listed libpng15. What now? I suspect that if any of the secondary libraries needed libpng15, it would be listed here, but, just in case I made the search recursive. No luck.
So it was, apparently, inkscape itself requesting the old version. A simple search in all files in the search tree only showed the string 'png15' in the viewer and actual inkscape executable.
There are probably older programs of mine still linked with png15, so I probably want to keep that version around.
Most, if not all references on the net mentioning this error (or similar) refer to programs with very old pnglibs (1.2.4x) trying to use a newer version, but here it's the other way around.
libpng-config --version reports 1.6.16
Any suggestion how to identify the source of this problem? Particularly why inkscape included the old libpng?

Link specific version of C library to golang program

I develop a utility in Go that requires recent version of sqlite. I'm interested only in targeting specific architecture, to be specific: x64 linux. I'm developing that utility on Mac OS X. I'm using go-sqlite3 driver. I use GNU Make + Glide to build my utility. In order to cross compile on my Mac I pass specific arch flags to make.
Repos on Linux platforms that I'm targeting usually have quite old versions of sqlite that don't have features that I need in my utility.
I can manually compile and install required version of sqlite on all the platforms that I need, but it is quite cumbersome. I wonder if there is a good way to either statically link a specific version of sqlite or somehow bundle a utility with specific version of sqlite dynamic library.
Even though I mention sqlite a lot, this question can be generalized to other libraries: how to bundle a golang app with a specific version of C library an outdated version of which may be installed on the target platform.
Also: how to better organize development of that utility so that other devs won't need to manually compile and install specific version of the library - the preference is to use Makefile that would build all the binaries for required target platform. I see that I can just copy code of specific version of library (e.g. sqlite) to my utility's repo though I wonder if there is a better option - maybe I can somehow use glide dependencies for that purpose and build library that I need as part of my other dependencies.

Tutorial on building whole toolchain on CentOS

I am working on CentOS 6 machines, which has very old GCC/GlibC version. I want to build the whole glibc, binutils, gcc toolchain with latest or at least very recent versions in order to use c++11 support in latest gcc, and ld.gold in recent binutils, and possibly improvements in recent glibc.
I want to put the whole toolchain in some separate directory, and not to influence any existing system files. I also want to build gcc with --sys-root so that when using the gcc, I don't need to specify -I/some/directory/include and -L/some/directory/lib or whatever other parameters. Also the generated executable will automatically use the new ld-linux-xxxxx program loader which will automatically find the new libc.so.
Anyone knows if there exists some tutorial on this task?
The compiler is very dependent on glibc, altough you manage to build the compiler either in a chrooted system or equivalent, you will need to build also all libraries needed with the program you will build with this new compiler.
The best you can do is use a fresh new system (vm or whatever) or upgrade your existing one
You can download the latest toolchain from Openembedded or Yocto.
And here you don't have to do any package installation to your current system.
Just download the toolchain, source the environment and thats it you are ready to check the c++11 support.
The location to download the toolchain:
http://downloads.yoctoproject.org/releases/yocto/yocto-1.7/toolchain/ (Just select the architecture either 32bit or 64 bit based on your machine support)
If you need the latest toolchain, you'd better migrate to Fedora.
If you can't/won't, the best bet is to get the pieces as source RPMs for CentOS and Fedora, unpack them and fix up the CentOS by pilfering the sources and patches from Fedora, take care it doesn't overrule the system packages, correct versions and fix to install elsewhere (don't mess up your system too much! /usr/local comes to mind). The pieces are at least binutils, gcc.
I do not knwo Why you need this ? If this is needed that to compile for another computer, I would suggest using a virtual machine running the same OS as target. much more easier !!

Haskell at a user level

I love coding in Haskell, but often am on a computer where I cannot install software, and which has some restrictions about what you can run. I would like to write Haskell code and test it while on this computer. Does anyone know of version of Haskell, interpreted or compiled, written in Java, JavaScript, Ruby, Python, or another interpreted language available in the default install on a Mac? A standalone version of Haskell which can be installed at the user level works too, but compiling Haskell myself is not an option.
The GHC binary distributions (the ones that come as tarballs, not installers) all can be installed locally trivially easily.
./configure --prefix=$HOME/ghc
make install
Then update your path to include $HOME/ghc/bin
If you want cabal, get the tarball from hackage, then untar it and run bootstrap.sh.
GHC works really well as a local install. In fact, I never use it as a system install.
I do this on my workstation, too, so that the distribution I'm on (Debian in my case) doesn't suddenly start upgrading stuff without me noticing in a simple apt-get upgrade.
This solution installs a full ghc and haskell-platform as well as ~/.cabal prefix.
First of all, I have a ~/local directory that I use in order to put custom-compiled programs in my home directory. I usually dislike the sudo make install step, because I'm giving some random Makefile root access to my system, and that makes me feel queasy.
Then I download the ghc binary distribution from the ghc site. NOTE that I linked you to 7.4.2. I hear there's some segfault bug on Mac OS X, but I'm not aware of the details. You should check that out or get the newer ghc instead, but be aware that there are many packages on hackage that are not yet fixed to work with 7.6. Also, ignore that "STOP!" warning, you're the 1% who actually want a non-distrib GHC binary.
You can just cd into the ghc directory, then do ./configure --prefix=$HOME/local/haskell or so, followed by make install (no compiling necessary, it's just going to install, not compile.)
At this point, you should add ~/local/haskell/bin to your path. Here's the code that I put in my ~/.zshrc, which will add all ~/local/*/bin directories to your path.
You can then get the Haskell Platform, and do the same ./configure --prefix=$HOME/local/haskell && make && make install dance. This step will need compilation. It means that you will need some header libraries installed. I find the random openGL headers that are necessary particularly annoying.
You can also of course skip haskell-platform, and just download cabal-install directly, then install what you need. You should in any case not forget to add ~/.cabal/bin to your $PATH!
Do a cabal update and you should be good to go.
NOTE: there's one important part that the binary distribution of GHC needs, which can sometimes be a pita on old Linux systems: libgmp. It's linked dynamically against it, and if you get some errors about the shared libgmp not being found on OS X, too, you can… well, ask that question in a comment, and I shall explain how to get there. Basically, you'll have to compile libgmp + deps yourself.
But I don't think that should be a problem on OS X. It's just been a problem on a couple old debian boxes I've tried this on.
For single files, you can use codepad.

Difference between MinGW and the regular GCC?

On the SourceForge page for MinGW, you can download the GCC 4.5.2 and that's the latest version. On the GNU mirrors, you can download the GCC 4.6 source and compile it with one of the possible windows targets:
i[3456789]86-w64-mingw*
i[3456789]86-*-mingw*
x86_64-*-mingw*
Is there a difference between using one of these targets and the traditional GCC for MinGW? Would it make sense to use the regular GCC because it has more up-to-date versions or would it make more sense to wait until an up-to-date GCC for MinGW is released?
As you can see in the README file accompanying the MinGW release of GCC on SourceForge, no local patches were used, and I think this has been the case for quite a while now, so assuming there were no changes in the GCC codebase that require new local patches, you can very well download the GCC sources from one of the mirrors and build them yourself.
I have done so myself in the past, especially because I use gfortran, which is under quite heavy development, so from time to time I take the most recent snapshot and build that myself, so I can use certain new features that were only recently introduced.
(I have to admit that it took some trying to get the build to run without errors, and after a period without problems, I recently ran into some new ones that I couldn't completely smooth out. I will have to try again soon.)

Resources