Build targets for Linux static library
NickName:Hyunjik Bae Ask DateTime:2015-01-20T11:23:29

Build targets for Linux static library

I am developing a C++ library for x86 or x64 Linux server programmers. The library is not open sourced and the compiled output shall be static library(.a) files.

Which build targets should I consider for most server programmers? So far, I am considering these:

  • GCC and CLANG
  • x86, x86_64
  • debug (assert is turned on, no optimized code), release (assert is turned off) [1]

The total combination shall be 2*2*2 = 8.

Are these enough? Should I consider Ubuntu and CentOS?


[1] I have used assert() instead of run-time junction (code below) only for some performance-sensitive functions. In other cases, I use runtime junction. Runtime junction is more needed for production code, but it cause performance impact to very frequently called functions. For example, executing two junction instructions and accessing m_length takes longer time than accessing array data only.

#define runtime_assert(x); { if (g_enableAssert && !(x)) ShowError(#x); }

#ifdef _DEBUG
#define assert(x) runtime_assert(x)
#else
#define assert(x) 0
#endif

bool g_enableAssert = true;

class Array
{
    int m_length;

    // doing runtime junction
    void Set(int index, int value)
    {
        runtime_assert(index>=0 && index<m_length);
        ...
    }

    // using assert
    void Set(int index, int value)
    {
        assert(index>=0 && index<m_length);
       ...
    }
}

Copyright Notice:Content Author:「Hyunjik Bae」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/28037263/build-targets-for-linux-static-library

More about “Build targets for Linux static library” related questions

Build targets for Linux static library

I am developing a C++ library for x86 or x64 Linux server programmers. The library is not open sourced and the compiled output shall be static library(.a) files. Which build targets should I consi...

Show Detail

Build a linux static library

For a website of mine I'm trying to make wkhtmltopdf(Link) work. The website is hosted on a shared hosting, which are a bit troublesome when using libraries not installed. After a few tries with

Show Detail

How to build static library for iOS on linux

I have c++ static library written on linux. Is it possible to build this library for iOS? I have installed g++-arm-linux-gnueabi, but when i try to do this: arm-linux-gnueabi-g++-4.7 main.cpp -o...

Show Detail

Compactly override a build script for all targets

Expanding on an earlier question about overriding build scripts with custom libraries... I have multiple build targets, and might have more in the future: .cargo/config: [target.x86_64-unknown-l...

Show Detail

How to build and install cmake targets only if the other targets depend on them?

My application consists of the core, many shared libraries and many plugins that use these shared libraries. I'm using cmake option() command to enable / disable each plugin. What I'd like to do i...

Show Detail

Build static library Target with main Target for proper architecture in XCode?

I am currently developing an iPhone app in XCode that requires a static library that is built from another XCode project I have made. I currently have both targets in the same project, and I need the

Show Detail

Disabling static library build in Gradle

I am using gradle to build a JNI library for our java project and it works fine, however I can't seem to figure out how to keep gradle from building both shared and static versions of the file. I'd...

Show Detail

Using static library in both App and Cocoa Touch Framework targets

I've created a new "Cocoa Touch Framework" target called MyAppCore in my iPad project called MyApp, with the intention of putting some common code in there. Overall it works great, however, I've

Show Detail

Cross compile Static Library from Linux for windows

I want to compile static library in linux for windows. Following is the procedure I followed for compiling Compile the source code of static library in linux using i586-mingw32msvc-cc -c static_l...

Show Detail

build static library for iOS on windows

I want to cross-build a C++ static library on Windows or Linux (*.a), which will be included in Xcode 4, and finally used in iOS app. Can anyone tell me how to do it?

Show Detail