Resources for how to retarget mingw like you can retarget GCC? - mingw-w64

I know you can retarget GCC (with difficulty), but I'm not sure if the same thing is possible with mingw. I've found some excellent resources for how to retarget gcc itself, but I can't figure out if they apply to mingw's version, since none of GCC's folder structure appears to be present in my install of mingw. Is it even possible? If so, can someone provide resources for me to get started?

Related

How to link against system libraries and not Matlab's provided libraries

We have Matlab R2017a installed on a RHEL 7.3 machine and I can provide verbose installation instructions if necessary. We have the Matlab library paths saved in /etc/ld.so.conf.d/matlab.conf and have run ldconfig to make sure the paths get picked up. Matlab works and everything is functional. However, Matlab seems to come bundled with it's own versions of libraries such as libstdc++, libicui18n, and others.
I'm trying to build and link a non-Matlab executable with the two libraries mentioned above and it's linking against Matlab's and not the system. How can I tell the linker to use the system provided libraries? I'm pretty sure this isn't a Matlab-specific problem, but that happens to be the environment I'm working in. Any thoughts would be greatly appreciated.
Here is what our /etc/ld.so.conf.d/matlab.conf file looks like. Based on some testing, it does look like all three of these are necessary.
/opt/MATLAB/R2017a/bin/glnxa64
/opt/MATLAB/R2017a/runtime/glnxa64
/opt/MATLAB/2017a/sys/os/glnxa64
There are libraries installed in the runtime that depend on libraries installed in sys/os. The libraries in sys/os are the ones conflicting with the RHEL system libraries (such as libstdc++).

GCC - Dynamic Dependencies

Good day! I've got a problem with linkage on Linux using gcc. For example, I've compiled project on one machine and linked it with libGLEW. When I'm trying to run it on another machine - it can't find libGLEW, because first machine has libGLEW.so.1.7 and second has libGLEW.so.1.10.
ldd shows me, that it dependent on 'libGLEW.so.1.7'.
after creating symlink 'libGLEW.so.1.7 => libGLEW.so.1.10' everything works fine, but is there a way, to store 'libGLEW.so' as dependency instead of 'libGLEW.so.1.7'?
What makes you sure the function interface of GLEW doesn't have changed?
Or even the content of version 1.1 to 1.7 is still the same?
If it is build with 1.7, it also depends on 1.7.
So you shouldn't run it on another version of GLEW, except the api documentation of GLEW tells you that this cross versioning is possible for some reason (But I couldn't imagine that).
Otherwise also build it with GLEW 1.1 in addition
(because as if all features you use from 1.7 are also supported by 1.1 and for some reason you have to support both versions), so to serve different versions fo your programm for different versions of GLEW would be the best and valid way.
If that is not the case make it for the user as requirement to be on Glew version 1.7 or higher.
But there is no safe way of working around to archive what you want.
And there is not a gcc or any compiler command for that at all.

How to get rid of 'GLIBCXX_3.4.9 not found error'?

I am building a redistrbutable .so file.
However when my users try to use it they get the dreaded /usr/lib/libstdc++.so.6: version GLIBCXX_3.4.9' not found error.
Doing an objdump, it seems its this particular symbol in my binary that is causing the issue:
_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l##GLIBCXX_3.4.9
How do i tell my gcc/g++ to compile/link against an older version of GLIBXX so that my users dont get this error?
Or is the only way out of this conundrum to install a separate older version of linux which has an GLIBXX?
How do i tell my gcc/g++ to compile/link against an older version of GLIBXX so that my users dont get this error?
There is no way to do that. Your only choices are:
build with older g++ version, or
link libstdc++.a statically into your shared library, and hide its symbols (this may also have licensing implications, check with your lawyer).
package your version of libstdc++.so.6 together with your library, and ask users who have an older version to arrange to pick up your newer version instead (also has licensing implications, but I believe these are easier to satisfy).
You are building for GLIBCXX_3.4.9, hence your users also need to have at least GLIBCXX_3.4.9.

Run-everywhere statically-linked gcc binary for Linux

I have an old SuSE-10.1 setup which works basically fine, but has a broken YaST (package manager) and no gcc. (Yes, I am in progress of moving one website after another to another server to get rid of that fossil, so please don't tell me to "upgrade", but it's a slow process and I have to maintain it.)
To install anything from source, I need a C-compiler - preferrably one that doesn't need any shared libraries and runs on 32-bit.
Where can I get (or how can I create) such a binary?
You can retrieve a precompiled version with static-get
static-get -x gcc

How can I link glibc statically with qt

I have built a static version of qt and download a static version of glibc. Now I would like to link glibc statically to my qt application. I know about going into the .pro and adding the line LIBS += -L path/to/static_lib but I am wondering if these that is enough? Will it still link glibc statically even though the OS I am building on has the dynamic libraries also? The reason I am doing this is to deploy the application in a standalone manner. (After installing and updating Red Hat 5.3 glibc_2.9 was not found on the target computer)
Passing -static to gcc will force it to link statically when possible.
Alternatively, download and install CentOS 5 and build on that.
As you discovered, linking fully statically with glibc is not possible, because for instance nss support is loaded dynamically.
However, the required glibc version depends mostly on the features you actually use.
Anyway, I think you should instead use Linux Standard Base, also
because of reasons exposed here.

Resources