Author |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Thu 03 Feb '11 14:10 Post subject: New to Apache |
|
|
I am a VC++ Developer and I am new to Apache
I have an existing C++ source code, which is developed in Windows. Now in order to compile it, I need to have all those
1) APR
2) APR-Util
and other projects that reside inside the scrlib directory. Can someone guide me in configuring this? Or is there any good tutorial which step by step guide on how to make an existing code compilable or a new code for apache ?
Because I am unable to compile it
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Fri 04 Feb '11 20:35 Post subject: |
|
|
You have an own module? What error message do you get? Do you have the full source tree from apache? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 06 Feb '11 0:29 Post subject: |
|
|
apr-iconv & pcre are also required.
what version are you trying to build?
win32 or unix sources?
James already asked about errors. |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Tue 08 Feb '11 9:10 Post subject: |
|
|
glsmith wrote: | apr-iconv & pcre are also required.
what version are you trying to build?
win32 or unix sources?
James already asked about errors. |
glsmith wrote: | apr-iconv & pcre are also required.
what version are you trying to build?
win32 or unix sources?
James already asked about errors. |
Sorry for the late reply. I am building this in VC++ 2005. Earlier I thought that it might be a Linux verison of the source code. But whe I saw functions like this
Code: |
LPCSTR CUtil::GetUrl()
{
if (m_pszUrl == NULL)
{
LPCSTR pszAppPath = GetApplicationPath();
LPCSTR pszPath = GetPath();
m_pszUrl = strcmp("<invalid>", pszAppPath) == 0 ? pszPath : pszPath+strlen(pszAppPath);
}
return m_pszUrl;
}
|
This has to be windows. The error message that I am receiving are
Code: |
Error 19 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 Trace.obj
Error 20 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 UserToken.obj
Error 21 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 Encryptor.obj
Error 22 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 File.obj
|
I know why this error is coming because the compiler is unable to find the implementation of apr_pool_create and all other apache functions.
Now the defination of apr_pool_create is in "apr_pools.h" and its implementation is in "apr_pools.c".
Now "apr_pools.h" resides in
Code: |
.\srclib\apr\include
|
Folder and
"apr_pools" resides in
Code: |
.\srclib\apr\memory\unix
|
I have included these directories in Project settings (ALT +F7)>Additional Include Directory tab.
But still it was unable to find the implementation. Similary for all apache functions (function starting from apt_ ) are unable to find the implementation |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Tue 08 Feb '11 14:54 Post subject: |
|
|
James Blond wrote: | You have an own module? What error message do you get? Do you have the full source tree from apache? |
If I am not wrong. By full source tree are you referring to those 100 projects that come with Apache.dsw? httpd-2.2.17-win32-src.zip
http://www.poolsaboveground.com/apache//httpd/httpd-2.2.17-win32-src.zip |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Tue 08 Feb '11 17:18 Post subject: |
|
|
Ok, looking at those object file names you are trying to build something other than Apache itself (e.g module).
If it was a problem with including the .h files the build would fail creating the .obj files.
Your build is failing at linking to the Apache libraries. Why, my guess is you did not build Apache first or you're not also adding the extra lib directories as you did the includes.
If you were building on VC6 or VC9 I could give you a shortcut but I do not know of any Apache binaries built on VC8 (2005).
Once you have a built Apache, it's pretty simple to build extra modules at the command line.
Just for FYI, the unix & win32 Apache sources are almost exact, the differences are
1. Line endings (win vs. unix)
2. no apr-iconv included in unix tarball
3. no .mak files (dsp, dsw & makefile.win are in the unix tarball)
What module are you trying to build?
---------- bellow written before it dawned on me what is going on ----------
Your source package, in VC9 (2008) Express IDE
========== Build: 94 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Full build log: http://www.apachehaus.net/httpd-2.2.17-build.log
Built Source Tree: http://www.apachehaus.net/httpd-2.2.17-postbuild.zip
What did I do post unzipping the package:
1. Ran "perl srclib/apr/build/cvtdsp.pl -2005" <- do not do this you will get RC errors building in IDE
2. Opened the VC6 Workspace in VC9 & converted projects.
3. Added a dependency to Buildbin project for apr_dbd_odbc
4. Set target to Release, right clicked on Buildbin project and chose "Build"
If it cannot find this apr stuff, especially once adding these directories via Additional Include Directory then I must assume there was an error in the building of apr and the libs are not present. If you look in srclib/apr/Release do you see a libarp-1.lib & dll?
Hmmm ... you added the include but maybe in that 2005 you need to add srclib/apr/Release to addition Library directories as well. But only if it actually built libarp-1.lib.
Since libapr is the first thing built, you will want to watch it when building.
But wait, where are these coming from?
Trace.obj, UserToken.obj,Encryptor.obj & File.obj, these do not exist in the Apache Source. |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Wed 09 Feb '11 12:08 Post subject: |
|
|
Yes they don't exist in Apache Source code. I will explain
Code: |
Trace.obj,
UserToken.obj,
Encryptor.obj & File.obj
|
files are generated from
Code: |
Trace.cpp,
UserToken.cpp,
Encryptor.cpp & File.cpp
|
And these source files contain these function "apr_pool_create(....)" since it is able to find the defincation of this function in
Code: |
.\srclib\apr\include\apr_pools.h
|
But unable to find its implementation in
Code: |
.\srclib\apr\memory\unix\apr_pools.c
|
thats why generated this error in these obj files
Anyways I tried this workout.
1) Downloaded Apache solution from the below mentioned location specified by you
http://www.apachehaus.net/httpd-2.2.17-postbuild.zip
2) Opened the "Apache2217.sln" solution in VS2008 and rebuild the following projects
a) Apr
b) Apriconv
c) AprUtil
3) After successful rebuild, I created an empty VC++ project using VC2008
4) Added the header and source files provided with the project (add existing items from solution)
5) Created a new folder named scrlib within the project directory itself
6) And added the newly rebuild Apr, Apriconv, AprUtil and in addition in scrlib folder.
7) In addition I copied 1)include, 2)Modules and 3)OS folder within the project folder itself.
Went to Project Settings (ALT+F7) and in C/C++>Genral>Additional Include Directories Added the following line
Code: |
.\include;.\srclib\apr\include;".\srclib\apr-util\include";.\srclib\apr\memory\unix;.\srclib\apr\include\arch\win32
|
9) In C/C++>Proprocessor>Preprocessor Definations Added the following line
Code: |
WIN32;_DEBUG;_CONSOLE;APR_DECLARE_STATIC;WINNT;_WINDOWS
|
But when I compiled I came across this error
Code: |
fatal error LNK1561: entry point must be defined
|
Now this is how the main.cpp file is. Is it because the main function is missing? I am first time working on Apache code. So just like any other C/C++ program does an Apache C++ code also needs a main function or does Apache handles it internally?
The source code is available <a href="http://apache.pastebin.com/download.php?i=MLBvyPk2">here</a>
http://apache.pastebin.com/download.php?i=MLBvyPk2
Last edited by maverick786us on Thu 10 Feb '11 6:41; edited 3 times in total |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 09 Feb '11 23:59 Post subject: |
|
|
I don't know and please edit and remove the module code from your prior post, you can post it at http://apache.pastebin.com/ and post that link here. If you would like to zip that up along with all supporting files and headers (not apache's), I'm game to try and build it myself, which might give me an idea. Maybe someone else might know before then. |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Thu 10 Feb '11 6:38 Post subject: |
|
|
glsmith wrote: | I don't know and please edit and remove the module code from your prior post, you can post it at http://apache.pastebin.com/ and post that link here. If you would like to zip that up along with all supporting files and headers (not apache's), I'm game to try and build it myself, which might give me an idea. Maybe someone else might know before then. |
Done. I added a default main fucntion in main.cpp file
Code: |
static int main()
{
return 0;
}
|
That error was gone but this time again it started showing those previous errors
Code: |
Error 2 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 Trace.obj
Error 3 error LNK2019: unresolved external symbol _apr_pool_create_ex@16 referenced in function "public: __thiscall CUserRoles::CUserRoles(void)" (??0CUserRoles@@QAE@XZ) UserToken.obj
Error 4 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 Encryptor.obj
Error 5 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 File.obj
Error 6 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 Globals.obj
Error 7 error LNK2001: unresolved external symbol _apr_pool_create_ex@16 Test.obj
|
In the meantime can you provide me your email address? I will mail you the entire zip file |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 10 Feb '11 17:25 Post subject: |
|
|
certainly,
alposts -at- apachehaus.net |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Thu 24 Feb '11 12:49 Post subject: |
|
|
glsmith wrote: | certainly,
alposts -at- apachehaus.net |
I am sorry I need sometime, because I need to take permission from the company before sending the source code.
I have the latest source code, I've seen that output of this code is a dll. But while configuring it in apache, we need the .rpm file. So how can a VC++ DLL project generate 2 different output files?
And then in the source code when I went to project properties (ALT + F7) in C/C++>General>Additional Inclulde Directories I saw that this directory was included
Code: |
C:\Program Files\Apache Software Foundation\Apache2.2\include
|
But I already have Apache 2.2 installed and I don't see any such include folder that consists any header file |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 24 Feb '11 21:11 Post subject: |
|
|
apr_pool_create_ex is in libapr-1.lib.
I cannot speak for an ASF build, last time I unpacked one of those msi files the includes and libs were there.
The problem isn't in the includes, it's finding them or vc would have died during compile stage. The error is a link error so it's not finding, or you're not linking to the above mentioned library.
However, I see this: C:\Program Files\Apache Software Foundation\Apache2.2\include
I immediately think that is Apache installed by an ASF .msi installer since that is the default path that installer installs to. Problem is that is built in vc6, you've stated vc2005 as your compiler, therefor, you should build Apache in vc2005, that way the crt's match.
Once that is done, the Installbin project will install it to c:\Apache22 so you do not have to worry about it polluting your ASF install.
In Apache22, will be an include folder with the most needed headers and a lib folder that will have a bunch of libraries in it. You will see the one I listed at the top of this post.
Link to it.
When compiling Apache, before converting the projects, you will need to run
perl srclib/apr/build/cvtdsp.pl -2005
if not you will get RC errors through much of the different projects, including libhttpd. Without libhttpd, nothing will build but APR, APR-Util & APR-Iconv.
If you already done a convert, you can easily "start over". Just
del /s *.sln *.vcp* from the top build folder (where Apache.dsw is).
that will remove all the vc2005 projects. Run the above perl script and convert again and build. |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Fri 25 Feb '11 9:55 Post subject: |
|
|
glsmith wrote: | apr_pool_create_ex is in libapr-1.lib.
I cannot speak for an ASF build, last time I unpacked one of those msi files the includes and libs were there.
The problem isn't in the includes, it's finding them or vc would have died during compile stage. The error is a link error so it's not finding, or you're not linking to the above mentioned library.
However, I see this: C:\Program Files\Apache Software Foundation\Apache2.2\include
I immediately think that is Apache installed by an ASF .msi installer since that is the default path that installer installs to. Problem is that is built in vc6, you've stated vc2005 as your compiler, therefor, you should build Apache in vc2005, that way the crt's match.
Once that is done, the Installbin project will install it to c:\Apache22 so you do not have to worry about it polluting your ASF install.
In Apache22, will be an include folder with the most needed headers and a lib folder that will have a bunch of libraries in it. You will see the one I listed at the top of this post.
Link to it.
When compiling Apache, before converting the projects, you will need to run
perl srclib/apr/build/cvtdsp.pl -2005
if not you will get RC errors through much of the different projects, including libhttpd. Without libhttpd, nothing will build but APR, APR-Util & APR-Iconv.
If you already done a convert, you can easily "start over". Just
del /s *.sln *.vcp* from the top build folder (where Apache.dsw is).
that will remove all the vc2005 projects. Run the above perl script and convert again and build. |
Thanks. Finally I am able to compile it. Now the question is this is a .DLL project and I believe DLL does'nt work with LINUX Apache so how can i create a .rpm out of it, which suppose is linux version of MSI Installer
Can you pls also check your email, you must have receiced an email from maverick786us at gmail.com |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Fri 25 Feb '11 16:10 Post subject: |
|
|
You have to compile it on linux to load it in that apache. a dll won't load into it. |
|
Back to top |
|
maverick786us
Joined: 03 Feb 2011 Posts: 11
|
Posted: Wed 02 Mar '11 8:32 Post subject: |
|
|
James Blond wrote: | You have to compile it on linux to load it in that apache. a dll won't load into it. |
Can you tell me the actual command line parameters that I have to give in G++? The name of the solution (which is an DLL Projet) or the name of the mail file?
thanks in Advance |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
|
Back to top |
|