Was muss ich tun um ein Apache2 modul kompilieren zu können?

Alles, was den Apache betrifft, kann hier besprochen werden.

Was muss ich tun um ein Apache2 modul kompilieren zu können?

Postby extol » 11. July 2005 08:26

hi!

ich habe mir von der apache seite die 2 tutorials heruntergeladen auf
die dort verlinkt wurde...

wenn ich das ganze aber kompilieren will krieg ich einen fehler in diesem
bereich:

Code: Select all
static void mod_tut1_register_hooks (apr_pool_t *p)
{
   // I think this is the call to make to register a handler for method calls (GET PUT et. al.).
   // We will ask to be last so that the comment has a higher tendency to
   // go at the end.
   ap_hook_handler(mod_tut1_method_handler, NULL, NULL, APR_HOOK_LAST);
}


die funktion ap_hook_handler scheint es gar nicht zu geben...

ich habe bis jetzt nur geschaut das alles mit den header includes in
ordnung geht.. muss ich noch spezielle libraries einbinden?

aja ich versuche es momentan unter WINDOWS zu kompilieren
letztendlich würde mir das wissen aber wohl auch bei linux zugute
kommen.

Wäre nett wenn mir jemand erklären könnte was ich inkludieren muss
und wie...

bin für jede hilfe dankbar
extol
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby extol » 11. July 2005 14:50

ok hab herausgefunden das man Visual C schon fast benutzen MUSS damit
das nur irgendwie möglich ist...

leider bekomme ich noch immer ein paar fehlermeldungen.
vielleicht kann mir jetzt jemand helfen:

------ Build started: Project: mod_tut1, Configuration: Release Win32 ------
Compiling...
mod_tut1.cpp
Linking...
Creating library C:\apache_modules\tut_mod1\Release\mod_tut1.lib and object C:\apache_modules\tut_mod1\Release\mod_tut1.exp
mod_tut1.obj : warning LNK4248: unresolved typeref token (0100000F) for 'apr_pool_t'; image may not run
mod_tut1.obj : error LNK2028: unresolved token (0A000014) "void __stdcall ap_hook_handler(int (__cdecl*)(struct request_rec *),char const * const *,char const * const *,int)" (?ap_hook_handler@@$$J216YGXP6AHPAUrequest_rec@@@ZPBQBD2H@Z) referenced in function "void __cdecl `anonymous namespace'::mod_tut1_register_hooks(struct apr_pool_t *)" (?mod_tut1_register_hooks@?A0x0d424b99@@$$FYAXPAUapr_pool_t@@@Z)
mod_tut1.obj : error LNK2019: unresolved external symbol "void __stdcall ap_hook_handler(int (__cdecl*)(struct request_rec *),char const * const *,char const * const *,int)" (?ap_hook_handler@@$$J216YGXP6AHPAUrequest_rec@@@ZPBQBD2H@Z) referenced in function "void __cdecl `anonymous namespace'::mod_tut1_register_hooks(struct apr_pool_t *)" (?mod_tut1_register_hooks@?A0x0d424b99@@$$FYAXPAUapr_pool_t@@@Z)
C:\apache_modules\tut_mod1\Release\mod_tut1.dll : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\apache_modules\tut_mod1\tut_mod1\Release\BuildLog.htm"
mod_tut1 - 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

wär echt toll wenn mir jemand helfen könnte!
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby extol » 12. July 2005 08:32

hat das denn noch niemand gemacht?
bzw probleme damit gehabt?

leider find ich den fehler einfach nicht...

naja weiterprobieren halt
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby Wiedmann » 12. July 2005 10:57

Ich habe mir von der apache seite die 2 tutorials heruntergeladen auf
die dort verlinkt wurde...

Was hast du heruntergeladen? Bei apache.org gibt es viele Links...

BTW:
Was für ein Modul versuchst du denn zu kompilieren?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby extol » 12. July 2005 11:19

das was unter diesem downloadlink zu finden ist:
http://threebit.net/tutorials/tutorials.tar.gz

auf dieser seite gibts die erklärung zum modul:


http://threebit.net/tutorials/apache2_modules/tut1/tutorial1.html

es ist ein modul für apache2 soviel ist sicher...

Aber man muss dazu sagen das es KEIN VS Projekt beinhaltet da der
Autor das ganze auf linux kompiliert hat...

ich scheine ja auch kein problem mit dem source code zu haben...

die fehler sind LINKER fehler... (sprich es sind alle HEADER FILES etc
zumindest da)... ich scheine trotzdem etwas zu vergessen...

ne kurze erklärung was ich gemacht habe...

1. tutorial in ein eigenes verzeichnis getan.

2. versucht al dll zu kompilieren (->header nicht gefunden)

3. diese header gesucht und in den Pfad aufgenommen (->alle header
gefunden)...

nun bleiben nur noch diese errors wie oben geschrieben.

ich benutze den source: httpd-2.0.54

zum abschluss noch der miniquelltext dieses testmoduls:
Code: Select all

#include "httpd.h"
#include "http_config.h"

static int mod_tut1_method_handler (request_rec *r)
{
   fprintf(stderr,"apache2_mod_tut1: A request was made.\n");

   fflush(stderr);

   return DECLINED;
}

static void mod_tut1_register_hooks (apr_pool_t *p)
{
   ap_hook_handler(mod_tut1_method_handler, NULL, NULL, APR_HOOK_LAST);
}


module AP_MODULE_DECLARE_DATA tut1_module =
{

   STANDARD20_MODULE_STUFF,
   NULL,
   NULL,
   NULL,
   NULL,
   NULL,
   mod_tut1_register_hooks         
};
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby Wiedmann » 12. July 2005 12:12

Code: Select all
vcvars32

cl /MD /W3 /Zi /O2 /DNDEBUG /D_WINDOWS /DWIN32 /Fd"mod_tut1" /FD /I. /I"\Apache2\Include" /c mod_tut1.c

link /MACHINE:I386 /SUBSYSTEM:windows /OUT:mod_tut1.so /DLL /OPT:REF /DEBUG /LIBPATH:"\Apache2\lib" libapr.lib libaprutil.lib libhttpd.lib mod_tut1.obj
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby extol » 12. July 2005 12:35

vielen vielen dank!!!

lag wohl an meinen einstellungen...

jetzt ist mein nächstes problem aber das einbinden...
hoffentlich kann man mir damit auch nochmal helfen.

ich hab die datei mod_tut1.so jetzt in den modules ordner geschoben
und in der httpd.conf folgende zeile eingetragen:

LoadModule tut1_module modules/mod_tut1.so


die fehlermeldung die ich bei nem syntax check bekomme ist:

Syntax error on line 173 of C:/appserver/Apache Group/Apache2/conf/httpd.conf:
Can't locate API module structure `tut1_module' in file C:/appserver/Apache Grou
p/Apache2/modules/mod_tut1.so: No error


womit hängt das nun zusammen? hoffentlich versteh ich das auch
irgendwann mal :o
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby Wiedmann » 12. July 2005 12:47

k.a. bei mir tut's.

Hast du die Ausgabedateien gelöscht, bevor du es neu gebaut hast?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby extol » 12. July 2005 12:48

nein werd ich gleich einmal probieren...

danke für deine geduld :D
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby extol » 12. July 2005 12:57

also langsam wirds skuril hab es jetzt nochmal im modules verzeichnis
überschrieben und jetzt kommt gar:

C:\appserver\Apache Group\Apache2\bin>Apache
Syntax error on line 173 of C:/appserver/Apache Group/Apache2/conf/httpd.conf:
Cannot load C:/appserver/Apache Group/Apache2/modules/mod_tut1.so into server: Das angegebene Modul wurde nicht gefunden.

dabei ist das file sicher im ordner... also ich pack gar nix mehr glaub ich

edit: was ihm da wohl wieder nicht passt...
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby extol » 12. July 2005 13:57

hatte jetzt alles wieder gesäubert und ein neues build gemacht...

jetzt kommt wieder der fehler von zuvor:

Syntax error on line 173 of C:/appserver/Apache Group/Apache2/conf/httpd.conf:
Can't locate API module structure `tut1_module' in file C:/appserver/Apache Group/Apache2/modules/mod_tut1.so: No error

vielleicht schaff ichs ja am system bei mir zuhause...
ich hoffs mal

PS: noch eine frage... ist das normal das man beim linken diese message
bekommt? (hab jetzt im VC gebastelt das es funktioniert aber mit dieser
WARNING)

------ Build started: Project: mod_tut1, Configuration: Release Win32 ------
Compiling...
mod_tut1.c
Linking...
Creating library C:\apache_modules\tut_mod1\Release\mod_tut1.lib and object C:\apache_modules\tut_mod1\Release\mod_tut1.exp
mod_tut11.obj : warning LNK4248: unresolved typeref token (0100000F) for 'apr_pool_t'; image may not run
Build log was saved at "file://c:\apache_modules\tut_mod1\tut_mod1\Release\BuildLog.htm"
mod_tut1 - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


edit:
oh gott ich bin ganz knapp drann... wenn ich jetzt den modul namen
falsch eingebe sagt er das... bloss wenn ich ihn richtig eingebe bekomme
ich dieses "Problem berichten" fenster von Microsoft...

puh bald könnte das mal funktionieren das wär ja super *g*
extol
 
Posts: 14
Joined: 04. July 2005 12:48

Postby extol » 12. July 2005 20:22

ok zuhause funktioniert es bei mir... keine ahnung wieso....

naja immerhin mal etwas ;)

PS: hat jemand das ganze schon mit der Express Edition BETA zum laufen
gebracht? es scheint damit irgendein problem zu geben
extol
 
Posts: 14
Joined: 04. July 2005 12:48


Return to Apache

Who is online

Users browsing this forum: No registered users and 17 guests