How to statically link libevent with gcc while compiling? - c

I have used event.h in on of my project but the server it has to run on does not support it. Moreover I can not install it also. Is there a way I can run my project with minimum modifications.
It has to be compiled statically linked in but how do I do that?

What do you mean the server it has to run on does not support it? If a shared library is not installed, you can just build your project with the library statically linked in.
Alternatively, compile a shared library of libevent and include it with your application. I have had success using the RUNPATH headers in ELF binatries and shared libraries to put an application directory at the beginning of the dynamic library loading search path.
https://github.com/wavetossed/pybuild is an example of a build script for Python 2.7.2 and a couple dozen binary modules, which includes using libevent. Building just a single library using RUNPATH is much simpler.

Related

Install C dynamic libraries locally

I want to install a library (all .so files in my case) in my C project folder in order to make it portable.
The wanted result is a project that, when you download it, allows you to compile it without needing to install something with "apt", "dpkg", etc...
I managed to copy .so files from /usr/lib/... in my project folder and link it with -Lmylibfolder "gcc" option. (I did the same for headers with -Imyincludefolder).
But that, this is for libraries I need directly, and I think there are sub-dependencies I need to copy too. Moreover my method consist in copying files manually and this is not very "clean".
Is there a good way to do what I want?

How to arrange for Quicklisp to load the local version of a given library

I am using Quicklisp to load libraries in my Common Lisp project and
I need to load a customised version of some library instead of the version provided by Quicklisp.
The customised version of the library is stored in the local projects directory from Quicklisp and local projects have been registered. However Quicklisp still tries to load its own version of the library.
How can arrange for Quicklisp to prefer the customised of the library? (Side question: how can I ask Quicklisp which location it will use to load a library?)
If the project's system file is loadable with ASDF, it is loaded in preference to the Quicklisp-provided version. The easiest way to do that is to put the project's sources into ~/quicklisp/local-projects/ (or wherever your quicklisp is installed rather than ~/quicklisp/) and run (ql:register-local-projects). But other methods, like updating the ASDF registry configuration and putting the project somewhere known to ASDF via the registry, also work.
To find out where Quicklisp is loading your project, you can use (ql:where-is-system "system-name").
Remember that
The local-projects mechanism is configured through a special variable ql:*local-project-directories*. By default, it includes only the local-projects subdirectory in the Quicklisp install directory, but you can add or remove directories at any time to have more places scanned for systems.
To disable the local-projects mechanism entirely, set ql:*local-project-directories* to NIL.
(Quicklisp News Blog)

When doing make (gcc), how can you pull in all required libraries into a specific folder?

I am trying to recompile a program compiled for linux, to run under Windows using cygwin. But there are obviously a lot of libraries that are dependencies.
When I use make/gcc to build, how can I somehow pull in all the dependencies into a folder in linux, and then copy those dependencies over to cygwin and do the make over there?
Thanks

How to make Visual C++ solution to not remove one project when start build another

I've got two projects in solution, library and executable.
First I build library but then when I start build another project it cleans library even when library files is in different folder and should not anyhow conflict with it.
How to say to not remove library by building my executable?
If your executable depends on your library, the library will be automatically cleaned when cleaning or regenerating the executable.
It will not be cleaned if only generating the executable (not regenerating), which will only compile modifications since the last build.
If your executable does not depend on your library, the library should not be cleaned.
If this is really the case, you can try to build the executable by right clicking on the project located in the solution explorer.

xcode c include files

I would like to use XCode 4 as IDE for my C program.
I am using few libraries, which are not installed in system paths. Also, I am using external program for building (waf).
So, basically, I need XCode for everything, except building.
But I can't figure out how to tell XCode where my library include files are for it to be able to autocomplete functions and everything from that libraries?
In the build settings for the Target - look for the HEADER_SEARCH_PATHS setting.
Have you added the library headers to the project? You can just add them by reference.

Resources