linker

C++ Linker Question -- Dynamic and Static library dependency.

I have a Library X that depends on Library Y. I have an App A that calls functions from X. Assume that Library Y is only available as a static library. If both X and Y are statically linked to App A, everything works fine. However, I want X to be a dynamic (shared) library. Currently, having A link Y statically doesn't work as the...

Easy check for unresolved symbols in shared libraries?

I am writing a fairly large C++ shared-object library, and have run into a small issue that makes debugging a pain: If I define a function/method in a header file, and forget to create a stub for it (during development), since I am building as a shared object library rather than an executable, no errors appear at compile-time telling me...

Visual C++: linking takes ages in release mode

For an unknown reason, the linking step in my C++ app step takes just a few seconds in debug builds but over a minute in release mode. Does anyone have any idea if it's likely to be due to my project settings, or the external libs which are being linked in? Is it a common problem? ...

Cross-compile libgcrypt for the iPhone? Linker error... can't seem to find "fwrite" and "strerror"?

I have successfully cross-compiled the Apache Portable Runtime (APR) for the iPhone, using a set of configure scripts that invoke the GNU Autotools "./configure" with the necessary cross-compilation options. I am now attempting to cross-compile GNUTLS which depends on libtasn1 and on libgcrypt, which in turn, depends on libgpg-error. Th...

Scons on Windows: kernel32.lib

I have an SConstruct file for scons: env = Environment() env.Append(CPPPATH = ['./']) env.Append(LIBS = 'kernel32.lib') env.Append(LIBPATH = 'C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib') env.SharedLibrary(target='warpLib', source='warplib.cpp') If I don't inlcude 'kernel32.lib' and specifiy the LIBPATH I get a link error. My s...

C++ linker issues

Hello there, I have this: a.cpp int localfunction () { return 1; } int local_symbol = localfunction(); b.cpp void thirdfunction () {}; main.cpp void main () { thirdfunction (); } When I compile this in a main executable everything works (even with optimizations), and the localfunction is executed at startup even if I don't ...

JQuery - Appended Links don't work

I have created a dynamic list picker script using Jquery 1.3 and PHP that sends a JSON AJAX request and returns a list of items to choose from. The AJAX call works perfectly returning an array of items that I use Jquery to append them as an unordered list to an empty container DIV. That portion of the process works as expected. The pro...

ld: linker error

ld: foo.o: relocation R_X86_64_PC32 against undefined symbol `bar' can not be used when making a shared object; recompile with -fPIC I recompile with -fPIC and it still produces this error. ...

Yet another unit testing / code coverage question. Is my approach sane?

This is yet another Unit Testing question. I'm trying to draw knowledge from a number of places regarding how to proceed, and I wanted to bounce my current understanding off of the collection of experts here. assume a project for which all dependencies except opengl funkiness are statically linked (except the c run time) My current un...

c++ class with templates compilation error

I'm not an experienced C++ programmer and I'm having problems compiling. I've got a Heap class that uses a template: template <class T> class Heap { public: Heap(const vector<T>& values); private: vector<T> d; // etc. }; And then in a separate implementation file: template <class T> Heap<T>::Heap(const vector<T>& val...

How do I use MacPorts to downgrade a dynamic library?

My py-mysql is farking because I've upgraded MySQL which replaced libmysqlclient_r.15.dylib with libmysqlclient_r.16.dylib. How do I find and get back the older version? EDIT: I found that to intall an older version of MySQL, I need to do @, but I'm still looking for the way to find the older versions. ...

ld64 -s strip output flag - "ignored" but not really? OS X

I was bored and playing around with various options to gcc to see what size binaries I could produce. I found a -s flag in ld64 that is supposedly supposed to not include symbol table information in an executable. The manpage for ld64 says the flag is ignored. The manpage for gcc says it's a linker option(which to me implies it means i...

boost lib build configuraton variations

I am new to boost - can you please tell me what are the difference b/w the following variations of the boost lib and which one do I need to link to in which case? libboost_unit_test_framework-vc80-1_35.lib libboost_unit_test_framework-vc80-gd-1_35.lib libboost_unit_test_framework-vc80-mt-1_35.lib libboost_unit_test_framework-vc80-mt-...

Is it possible using Linux's clone() system call to run multiple applications in the same address space?

If you don't pass the CLONE_VM flag to clone(), then the new process shares memory with the original. Can this be used to make two distinct applications (two main()'s) run in the same process? Ideally this would be as simple as calling clone() with CLONE_VM and then calling exec(), but I realize it's probably more involved. At the very l...

Freezing Ruby version - is it possible? (Linker flags question)

Hi, I have a problem with RubyCocoa, which has a weak link to a libruby.dylib and not always can find this dylib on user's computer, which resulting a crash on the launch of my application (RubyCocoa based). I wonder whether it's possible to copy Ruby.framework to the bundle of my application and tell somehow to RubyCocoa to look for ru...

How can I get the exact compiler command line from visual studio?

I have to port the build of a DLL from building in Visual Studio to another build system. The DLL solution wasn't made by me and it's got lots of modified command line switches etc. I've copied the compiler/linker options from Visual Studio's Project Properties -> Config Properties -> C/C++ -> Command Line Project Properties -> Confi...

Avoid linking to libstdc++

I'm working on an embedded project that currently uses C in Linux and uClibc. We're interested in moving it to C++, but I don't want the overhead associated with linking in libstdc++. My impression is that this is possible provided we don't use anything from STL, such as iostream or vector. How does one direct g++ to compile without li...

How to build an application that requires both libstdc++.so.5 and libstdc++.so.6?

I want to preface this with the important notice that I am not a C/C++ programmer, and know very little about how linkage of libraries works in C. Our code uses libstdc++.so.6 (gcc 3.4, i think). We have third-party precompiled (closed source) libraries that use libstdc++.so.5 (gcc 2.something or 3.2, i think). This is on linux. We h...

Pruning a static library in c++

I am trying to expose a single well defined class by building a static library and then shipping the built library with a few header files that define that class and the interfaces needed to use it. I have that working but the problem I am running into is the library is gigantic. It has every single object file from the whole project and...

Linkers and architectures

Why do we have linkers for different architectures? Service of the linker is to resolve addresses. So how it is related to the instructions of target architecture? ...