How to build axis2c Unofficial source code - c

I have to create SOAP services in C using axis2C. But since axis2C is kind of not maintained properly as per this question, I have to use axis2C unofficial source code. But I could not see configure file to build the sources. How should I build this. I checked all the documentation both in here and in the github repo but no luck. All points to the axis2C official documentation. Should I copy the sources from unofficial to official code and try with the configure script in official folder ?

This project probably uses the GNU build system. In this system, ./configure is a portable shell script that is automatically generated from hand-written input files, the main file is configure.ac.
So, distribution packages of the source will contain ./configure, therefore enabling anyone on any platform with a sh-compatible shell and a make utility to build the software. But as it is a generated file, you will not find it in source-code repositories, e.g. on github.
To build a package using the GNU build system directly from source controls, you have to use the GNU autotools yourself to generate ./configure. In order to do this, install the following packages:
autoconf -- generates ./configure from ./configure.ac.
automake -- generates portable makefile templates Makefile.in from Makefile.am (those templates are then filled with values by the ./configure script to write the final Makefiles)
libtool -- tools for building dynamic shared objects on different platforms
Then, the command autoreconf -i given in the root of your source package should generate the ./configure script for you.
Note that there are packages providing a script ./autogen.sh (or similarly named). If this is there, you should call it instead of running autoreconf -i yourself, it might contain additional necessary preparation steps. ./autogen.sh will typically directly run the generated ./configure for you.

Related

How to use cmake on the machine which cmake is not installed

I am using the cmake to build my project. However, I need to build this project on a machine that I do not have the permission to install any software on it. I thought I can use the generated makefile but it has the dependencies on CMake,and says cmake:command not found.Is there any solution that force the generated makefile do not have any cmake related command such as check the system version? Thanks
Is there any solution that force the generated makefile do not have any cmake related command such as check the system version?
No. There is no incentive for cmake to provide such an option, because the whole point of the cmake system is that the cmake program examines the build machine and uses what it finds to generate a Makefile (if you're using that generator) appropriate to the machine. The generated Makefiles are tailored to the machine, and it is not assumed that they would be suitable for any other machine, so there is no reason to suppose that one would need to use one on a machine that does not have cmake. In fact, if you look at the generated Makefiles you'll find all sorts of dependencies on cmake.
Depending on the breadth of your target machine types, you might consider the Autotools instead. Some people dislike them, and they're not a good choice if you want to support Microsoft's toolchain on Windows, but they do have the advantage that an Autotools-based build system can be used to build software on machines that do not themselves have the Autotools installed.
one easy solution is to use static libraries and the 'static' parameter in the command line.
Then you should be able to drop the executable on the target machine and run it.

Is it possible to build a package with bitbake without poky?

I have all compiled binaries for target machine. I want to create a binary package - say .ipk, .rpm - for target machine. As this suggested to clone poky, which will have bitbake within it. But, as this document says, we can directly use bitbake without poky, however, it not mentioned anywhere that we need poky as well as bitbake to build a custom package. But of course poky is required if we have to compile source code and create binaries.
If I don't need to compile any source code at all, does I need to have Poky?
Is it possible to build a package with only bitbake?
First, Poky is a reference distribution that contains primarily bitbake and openembedded-core.
Yes, you need oe-core to build packages as the logic to build packages is part of oe-core, not bitbake.

Statically link libraries into a dynamic library (dll) [duplicate]

I'm working on a C++ application for Windows that uses OpenSSL 1.0.1e library. I'm on Visual Studio 2008.
For portability reasons my application is statically linked against runtime libraries (/MT and /MTd options). And I don't ship runtime libs with my application.
Per the OpenSSL FAQ, the library is by default linked against multithreaded DLL runtime (/MDd) which is obviously incompatible with my scenario. So to make my program work I've added applink.c to my project. On my dev machine and on most test computers the program works fine.
But unfortunately I've located computers where the app doesn't start. Windows displays error:
The application failed to initialize properly (0xc0150002). Click on OK to
terminate the application.
I've opened libeay32.dll in Dependency Walker and I see that MSVCR90.dll is not found. So the trick with applink.c doesn't really work for me.
How do I build OpenSSL with /MT or /MTd option?
Use the nt.mak makefile rather than the ntdll.mak makefile.
As an aside, I have written some scripts around the standard OpenSSL build scripts which make it 'easier' (for me at least) to use OpenSSL on Windows with a mix of both x86 and x64, you can get them from here.
To build 64-bit OpenSSL statically linked (which results in a single .exe file without any DLLs) with Visual Studio 2015, you will need the following prerequisites:
Git for Windows. You can download it at https://git-scm.com/download/win. This guide uses version 2.11.0.3.
Strawberry perl. You can download it at http://strawberryperl.com/ (Warning: ActivePerl is highly not recommended. It will give you strange errors during the process). This guide uses version 5.24.1.1.
NASM assembler, which is available from http://www.nasm.us/. This guide uses version 2.12.03rc1.
You are expected to install all those tools system-wide and add them to your %PATH% environmental variable.
After you got everything we need, just follow this simple steps:
Open VS2015 x64 Native Tools Command Prompt from your Start Menu. You will see command prompt.
Create C:\build directory and issue the following command in the command prompt:
cd c:\build
Download latest zlib & OpenSSL source codes to your build dir by using the following commands:
git clone https://github.com/madler/zlib
git clone https://github.com/openssl/openssl
First we have to build static zlib. To do that first we will need to edit some configuration files:
Navigate to the zlib source folder: cd C:\build\zlib
Edit the win32\Makefile.msc file:
Find the line starting with CFLAGS
Replace -MD with -GL -MT -Zc:wchar_t-
Find the line starting with LDFLAGS
Replace -debug with -opt:icf -dynamicbase -nxcompat -ltcg /nodefaultlib:msvcrt
Build zlib using the following command (should take less than a minute):
nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -DNDEBUG -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
Copy resulting files to your OpenSSL directory:
xcopy zlib.h C:\build\openssl\
xcopy zconf.h C:\build\openssl\
xcopy zlib.lib C:\build\openssl\
xcopy zlib.pdb C:\build\openssl\
Navigate to OpenSSL source: cd C:\build\openssl\ and configure it to use static zlib & read configuration files (openssl.cnf) from C:\Windows\ directory.
perl Configure VC-WIN64A no-shared zlib no-zlib-dynamic threads --prefix=C:\Windows\
Now make the following edits to the C:\build\openssl\makefile:
Find the line that starts with: CFLAG
Append: /Zc:wchar_t- /GL /Zi
Find the line that starts with: LDFLAGS
Replace /debug with /incremental:no /opt:icf /dynamicbase /nxcompat /ltcg /nodefaultlib:msvcrt
Find the line that starts with: EX_LIBS
Replace ZLIB1 with zlib.lib
Save changes
Build OpenSSL by issuing the nmake command (will take around 15 minutes).
The resulting ~3MB openssl.exe file will be located at C:\build\openssl\apps\ directory. It is fully portable, since all DLLs are included. If you need to use custom configuration file, copy C:\build\openssl\apps\openssl.cnf to your C:\Windows\ directory & edit it to your liking.
The most elegant option I have found for Windows involves using the scripts provided at http://p-nand-q.com/programming/windows/building_openssl_with_visual_studio_2013.html
They provide scripts for VS2010/VS2013/VS2015 for each script version it builds all combinations of x86/x86-64 with runtimes MDd/MD/MTd/MT.
Quoting the instructions:
PREREQUISITES:
The script assumes you are on Windows.
The script assumes you have Visual Studio 2010, 2013 or 2015 installed
in all the usual places. Important: If you have a different
installation folder, your mileage may vary
The script assumes you have downloaded an OpenSSL tarball, like this
one.
The script assumes you have Python (2.7 or 3.x) installed and on your
PATH
The script assumes you have 7-zip installed (doesn't need to be on
your PATH) Choose the script you want to use and edit it. For example,
let's take a look at the top of rebuild_openssl_vs2015.cmd:
T:
set OPENSSL_VERSION=1.0.1p
set SEVENZIP="C:\Program Files\7-Zip\7z.exe"
set VS2015="C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\vcvars32.bat"
set VS2015_AMD64="C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\amd64\vcvars64.bat"
so it is pretty easy to see: you must enter the OpenSSL version
manually, the rest should have sensible defaults...
Note: The script uses the SUBST T:\ drive for building OpenSSL.
I tested and it works, in less than 10 min! KUDOS for the authors of the scripts!!
UPDATE: For the x64 builds to be generated you need to install nasm assembler and have it in the PATH.
If you want precompiled OpenSSL libraries with MT look here: http://www.npcglib.org/~stathis/blog/precompiled-openssl/
You will find a patch for the OpenSSL sources that enables producing libraries with suffixes MT/MD and "d" for debug to make identifying the libraries easier.
What's more, you will also find the actual build script to build all of them at once for many different version of Visual Studio. I build and use them myself to exactly produce binaries that need no DLLs for my projects and you may find them useful.
It appears OpenSSL now links with -MT -Zl (at least when using msvc) meaning it discards default named libraries which are then decided in your final binary. Applications appear to use the static runtime by default.
In other words, no action needs to be taken in order to use it with your binary, just provide whatever flag you want and the OpenSSL library will just work with it. Unfortunate there isn't a lot of concrete documentation on building such an important library.
I solved this problem by manually editing the ntdll.mak file. You only need to change two lines:
in the CFLAG line change /MD with /MT
in the EX_LIBS line append these libraries: libcmt.lib libvcruntime.lib
Save the makefile then run nmake as per OpenSSL instructions.
You can check that the Windows runtime dependencies has been removed with these commands (VS Command Line):
dumpbin /dependents out32dll\libeay32.dll
dumpbin /dependents out32dll\ssleay32.dll

Automake error './ltmain.sh' not found

I've installed mingw and msys by using mingw-get-setup.exe. I've also installed Autotools(autoconf, automake,m4,libtool) into C:\/opt/autotools.
When I run automake, the following error always occurs:
configure.ac:11: error: required file './ltmain.sh' not found
If I copy ltmain.sh from libtool’s installed tree, execution will finish normally.
How can I configuure automake to find ltmain.sh without copying?
In an autoconf/automake/libtool project you need to run:
libtoolize: this copies/links a few support scripts, including ltmain.sh (which is the main component of libtool).
aclocal: this looks up all m4 macros that your configure script will need, and make a local copy for easier access.
autoheader: optional, if you want to use config.h/AC_CONFIG_HEADERS, otherwise all the test result macros will be inlined when you call the compiler.
autoconf: to expand all the macros used by configure.ac into the configure script.
automake: to convert all the Makefile.am into Makefile.in templates. You probably want to invoke this with --add-missing so additional support scripts can be linked/copied to your project (such as compile, missing, depcomp, test-driver, etc).
Don't worry about running each tool. Just invoke autoreconf -i and it'll run the tools that are needed. Add -v if you want to see what tools is being executed. To avoid mistakes, just put a script like this at the root of your project:
#!/bin/bash -x
mkdir -p m4
exec autoreconf --install "$#"
Users that checkout/clone the project directly from the source repository will need to run this ./bootstrap script at least once. This is not needed if the user got a tarball distribution.
Automake can take fairly good care of itself; it'll re-invoke the above tools when needed, when you run make. But if you generate a broken Makefile, you'll need to invoke ./bootstrap and ./configure again to generate new Makefiles.
As DanielKO stated, ltmain.sh is created by libtoolize.
However, what if it doesn't?
The following requirements need to be met:
configure.ac must exist and contain at least one of:
AM_PROG_LIBTOOL,AC_PROG_LIBTOOL,LT_INIT
(see function func_require_seen_libtool in /usr/bin/libtoolize)
If configure.ac does not contain a AC_CONFIG_AUX_DIR, libtoolize will look for a file called 'install-sh' or 'install.sh' in ., .. and ../.. and if found use that as "auxdir" and install ltmain.sh there (see function func_require_aux_dir inside libtoolize).
In my case, I was working on an "example project" in a subdirectory of another project, and the example project did not have a AC_CONFIG_AUX_DIR in its configure.ac; therefore libtoolize found the root of the parent project and installed ltmain.sh there instead of in the example project's root.

What is the right way to install header files from some package?

I want to build some package from source (e2fsprogs to be more concrete) and install its header files to my system. After that I will delete the build tree so it will not be accessible anymore. What is the right way to do this?
When I want to install program, I make simply:
$ ./configure
$ make
# make install
What are the equivalent actions when I want to install headers?
For e2fsprogs, quoting verbatim from the INSTALL file shipped with the sources:
7) Install the include files and libraries
You can run `make install-libs' to install the include files and
libraries. Please note that this installation is not needed for the
programs to work. It is only needed if you expect to develop other
programs using the libraries or if you want to compile other program
using these libraries (like the 4.4BSD dump and restore port).
More generally though, when I want to find out what is the 'proper' way to install something that has worked for others, I look at:
What the package looks like, in my favourite distro
How the package is built for my favourite distro

Resources