Domanda

My users complain that they have to install the linux thread building blocks on machines they do not own, and many hosts don't want intel thread building blocks to be installed of my end users, so I want to create a static version of my dynamic library / plugin / module / extension (whatever the corrct term is for a plugable C++ program / dll / so).

I found out that for Windows I have to use the /MT (multi threaded) instead of the default /MD switch (Multi Threaded DLL) so my program will have no dependencies (but, windows has a concurrent container library so I don't need to use TBB there).

I just cannot figure out what the equivalent for linux is?

Or is there maybe a .sln to makefile converter which can figure out all the options?

I'm developing on Windows, but most of my end users use linux so I would like to make sure they don't have any burden on them and I want them to be very comfortable using my open source releases.

È stato utile?

Soluzione

The /MT flag in the Microsoft C++ compiler causes the linker to link against the static versions of the C and C++ run-time libraries. Microsoft ships static and dynamic versions of the run-time libraries, so this option effectively selects which set of libs to link against. This flag does not affect linking against third party libraries.

On the Linux side you have the -static option to tell the linker to use static libraries. this option is not library specific like on Windows, it affects all libraries. But if you use this option you have to provide static versions of all the libraries that you need, the linker will not convert dynamic libraries automatically. This includes system and run-time libraries, which are not always available as static libs. It also includes the Intel TBB, which you will probably need to compile yourself as a static lib if Intel doesn't provide it in that form.

Altri suggerimenti

I'm guessing that you mean that your users have to install Intel Threading Building Blocks (TBB) on their Linux machines. If you're using the Intel TBB functionality and your clients have to compile your source code then they need to have Intel TBB installed. An alternative approach would be to compile the source code for your clients and only supply them with your solution binaries and not the source code - then they would not have to install TBB.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top