Anyterm Forum

Anyterm: A Terminal Anywhere

You are not logged in.

#1 2006-01-15 09:05:40

k6ek
Member

Can't locate API module structure `anyterm_module'

I've compiled and installed anyterm version 1.1.6. I'm getting this error when I start apache


Can't locate API module structure `anyterm_module' in file /usr/lib/apache2/anyterm.so: /usr/lib/apache2/anyterm.so: undefined symbol: anyterm_module

Thanks for your help.

Offline

#2 2006-01-15 13:37:46

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

I haven't seen that error before.

The "API module structure" is defined at the very end of apache.cc.  It defines the entry points into the Anyterm code from Apache.  But it defines a module called "anyterm", not "anyterm_module".

I wonder if you have done something wrong in your Apache config.  Please post the LoadModule line that you are using.  Have you changed anything in the .htaccess file?  What version of Apache are you using?

--Phil.

p.s. why 1.1.6?

Offline

#3 2006-02-10 17:36:43

Richard
Guest

Re: Can't locate API module structure `anyterm_module'

I'm getting the same error. I wonder if the other guy is using SUSE linux, too. SUSE has a bizarre way of deconstructing common programs and their directory structures to make them "easier" to modify. Ha!

#4 2006-02-10 17:49:53

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

Hi Richard,

k6ek never replied, but my strong feeling was that his LoadModule line was wrong.  What have you used?

--Phil.

Offline

#5 2006-02-12 06:40:53

Richard
Guest

Re: Can't locate API module structure `anyterm_module'

Very frustrating. I enter the line as it appears in your installation instructions, but YaST (the SUSE installer) overwrites it when I try to start Apache. It changes "LoadModule anyterm" to "LoadModule anyterm_module", then it gives me the following error message:

/etc/init.d/apache2 start returned 1 (unspecified error):
Starting httpd2 (prefork) Syntax error on line 28 of /etc/apache2/sysconfig.d/loadmodule.conf:
Can't locate API module structure `anyterm_module' in file /usr/lib/apache2/anyterm.so: /usr/lib/apache2/anyterm.so: undefined symbol: anyterm_module

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

[1A..failed

I don't know why it changes the line and then complains about its own mistake, and I don't know how to fix it.

#6 2006-02-12 14:40:49

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

Well at least you know where the problem is now.

If you find a way to make SUSE do the right thing, please post it here.

Otherwise, you could change the declaration at the very end of apache.cc so that it says "anyterm_module" rather than "anyterm".

--Phil.

Offline

#7 2008-01-02 23:40:24

frank
Guest

Re: Can't locate API module structure `anyterm_module'

Hi,
i am having exactly the same problem on opensuse 10.3:

/etc/apache2/sysconfig.d/loadmodule.conf: Can't locate API module structure `anyterm_module' in file /usr/lib/apache2/anyterm.so: /usr/lib/apache2/anyterm.so: undefined symbol: anyterm_module.

Changing

module AP_MODULE_DECLARE_DATA anyterm_module = {

  // Normally one uses the macro "STANDARD20_MODULE_STUFF" here, but
  // that uses __FILE__ to get the module name.  This file is called
  // "apache.cc" so that is not ideal.  Instead, write it out in full
  // and give "anyterm" as the module name.
  MODULE_MAGIC_NUMBER_MAJOR,
  MODULE_MAGIC_NUMBER_MINOR,
  -1,
  "anyterm_module",
  NULL,
  NULL,
  MODULE_MAGIC_COOKIE,
  NULL,

  anyterm_create_dir_cfg, /* per-directory config creator */
  NULL, /* dir config merger */
  NULL, /* server config creator */
  NULL, /* server config merger */
  anyterm_command_table,   /* command table */
  anyterm_register_hooks,  /* set up other request processing hooks */
};

brings this error:

Cannot load /usr/lib/apache2/anyterm.so into server: /usr/lib/apache2/anyterm.so: undefined symbol: anyterm

Is there something else in apache.cc which would need to renamed from anyterm to anyterm_module ?

Thanks

frank

#8 2008-01-03 00:55:53

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

Try it with this line changed:

  -1,
  "anyterm_module",

but this one NOT changed:

  module AP_MODULE_DECLARE_DATA anyterm = {


Earlier in the file there is this:

  // If request does not have handler "anyterm", decline it so that
  // other handlers get the chance to look at it.
  if (string(r->handler)!="anyterm") {
    return DECLINED;
  }

You might try changing that "anyterm" to "anyterm_module".

You can also use some sort of nm|grep on the object files to look for any 'anyterm' symbols.

Let me know how you get on....

Phil.

Offline

#9 2008-01-03 13:32:23

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

I've just thought of something else, and I think this is the important thing: in apachemod/Makefile, the "make install" rule passes a -n option to apxs; this needs to change too:

install: FORCE
        $(APXS) -n anyterm_module -i anyterm.la


In summary, I think that:

- The apxs -n value needs to agree with the AP_MODULE_DECLARE_DATA value.  Both need to agree with the LoadModule value.
- The quoted string after -1 in the module declaration needs to agree with the string that's compared with r->handler.
- I think it's safe to change all 5 things to "anyterm_module".


Do please tell me whether this works.

Phil.

Offline

#10 2008-01-03 20:52:28

frank
Guest

Re: Can't locate API module structure `anyterm_module'

Hi Phil,

ive changed the following:

apache.cc:

54 extern module AP_MODULE_DECLARE_DATA anyterm_module;

153 static int anyterm_handler(request_rec* r)
154 {
155   // If request does not have handler "anyterm", decline it so that
156   // other handlers get the chance to look at it.
157   if (string(r->handler)!="anyterm_module") {
158     return DECLINED;
159   }
160

177     anyterm_dir_config_t* config =
178       (anyterm_dir_config_t*)ap_get_module_config(r->per_dir_config, &anyterm_module);

256 module AP_MODULE_DECLARE_DATA anyterm_module = {
257
258   // Normally one uses the macro "STANDARD20_MODULE_STUFF" here, but
259   // that uses __FILE__ to get the module name.  This file is called
260   // "apache.cc" so that is not ideal.  Instead, write it out in full
261   // and give "anyterm" as the module name.
262   MODULE_MAGIC_NUMBER_MAJOR,
263   MODULE_MAGIC_NUMBER_MINOR,
264   -1,
265   "anyterm_module",

Now suse apache2 sucessfully loads the anyterm modul,but when i access the anyterm.html, there is an error message in apaches error_log:

[Thu Jan 03 21:45:35 2008] [error] [client xxxxxxxx] File does not exist: /srv/www/htdocs/anyterm1/anyterm-module, referer: http://xx.xx.xx.xx/anyterm1/anyterm.html.

Any ideas ?

Thanks for you help and a great piece of software.

Cheers
frank

#11 2008-01-03 21:23:01

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

177     anyterm_dir_config_t* config =
178       (anyterm_dir_config_t*)ap_get_module_config(r->per_dir_config, &anyterm_module);

Thanks, I missed that one.

File does not exist: /srv/www/htdocs/anyterm1/anyterm-module

OK, in browser/.htaccess you need to change a couple of things.  Near the start:

<IfModule anyterm>

changes to

<IfModule anyterm_module>

and later,

<Files anyterm-module>
  SetHandler anyterm

to

<Files anyterm-module>
  SetHandler anyterm_module

At the end there's another <IfModule>, with an !, that needs to change.

Note the "-" in <Files anyterm-module>; everywhere else uses _.

Phil.

Offline

#12 2008-01-03 22:07:49

frank
Guest

Re: Can't locate API module structure `anyterm_module'

Hi Phil,

works now :-),

I owe you a beer..

Cheers

Frank

#13 2008-01-03 23:10:14

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

Thanks, that's great news.

Enjoy, and don't hesitate to ask if you have any other questions or problems.

Phil.

Offline

#14 2008-02-27 17:13:11

SebaMinguez
Member

Re: Can't locate API module structure `anyterm_module'

I modified:

apache.cc:
extern module AP_MODULE_DECLARE_DATA anyterm_module;

// Apache configuration commands:
--
  // other handlers get the chance to look at it.
  if (string(r->handler)!="anyterm_module") {
    return DECLINED;
  }
--
    anyterm_dir_config_t* config =
      (anyterm_dir_config_t*)ap_get_module_config(r->per_dir_config, &anyterm_module);
    command = expand_command(config->command,r,request);
    //    }
--

module AP_MODULE_DECLARE_DATA anyterm_module = {

  // Normally one uses the macro "STANDARD20_MODULE_STUFF" here, but
--
  -1,
  "anyterm_module",
  NULL,
  NULL,

apachemod/Makefile:
install: FORCE
        $(APXS) -n anyterm_module -i anyterm.la

browser/.htaccess:
<IfModule anyterm_module>

# Use an anyterm_command directive to specify the command to run
--
<Files anyterm-module>
  SetHandler anyterm_module

  # To avoid logging Anyterm requests, which is a good idea since they
--

<IfModule !anyterm_module>
# This file contains a message saying that the module is not loaded:
DirectoryIndex module_not_loaded.html

Then recompile with: make veryclean; make; sudo make install

But the error persist.

I think the file "htaccess" it is not processing. When type localhost/anyterm not index anyterm.html

Offline

#15 2008-02-27 17:20:18

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

> I think the file "htaccess" it is not processing.

The easiest way to check if the .htaccess file is being processed is to put some rubbish inside the <Files anyterm-module> section and see if that triggers an error in the error.log:

<Files anyterm-module>
   gherguoehrguierghrtiourthrt
   .....
</Files>

Have you added "allowoverride all" somewhere?

Offline

#16 2008-02-27 17:32:03

SebaMinguez
Member

Re: Can't locate API module structure `anyterm_module'

I add trash in .htaccess and the only error is:
[Wed Feb 27 15:28:25 2008] [error] [client 192.168.1.250] File does not exist: /srv/www/htdocs/Anyterm/anyterm-module, referer: http://inodoro/Anyterm/anyterm.html

I put in http.conf :
<Directory />
    Options None
    AllowOverride ALL
    Order deny,allow
    Deny from all
</Directory>
# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

Last edited by SebaMinguez (2008-02-27 17:33:38)

Offline

#17 2008-02-27 17:34:03

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

Try adding the trash outside <IfModule anyterm>, if you didn't already do that.

Offline

#18 2008-02-27 17:41:40

SebaMinguez
Member

Re: Can't locate API module structure `anyterm_module'

Sorry, Http.conf have very much include.

In /etc/apache2/default-server.conf put Allowoverride none

Then deactive (is it??) SSL (don't ahve the module) and is OK.

Next step: config anyterm_command

thanks

Offline

#19 2008-03-11 11:15:25

anniyka
Member

Re: Can't locate API module structure `anyterm_module'

Richard wrote:

Very frustrating. I enter the line as it appears in your installation instructions, but YaST (the SUSE installer) overwrites it when I try to start Apache. It changes "LoadModule anyterm" to "LoadModule anyterm_module", then it gives me the following error message:
[...]
I don't know why it changes the line and then complains about its own mistake, and I don't know how to fix it.

Well, always better to read wink I pretty sure this was at the top of the very same file in 2006 too:
/etc/apache2/sysconfig.d/loadmodule.conf:

Code:

#                                                                               
# Files in this directory are created at apache start time by /usr/sbin/rcapache2
# Do not edit them!
#
# as listed in APACHE_MODULES (/etc/sysconfig/apache2)
[...]

So, the first thing, YaST is not changing anything, if at all, it is the startscript. Second:
/etc/sysconfig/apache2:

Code:

[...]
# [It might look silly to not simply edit httpd.conf for the loadModule statements.
# However, since the LoadModule statements might need an absolute path to the modules,
# switching between MPMs can be quite a hassle. It's easier to just give the names here.]
#
[...]

Well, that's only to have a look at it.

I do run into the same error and to follow the discussion I did this to check around the modulenames:

Code:

for i in  /usr/lib64/apache2/mod_*; do strings $i | grep `basename $i .so | sed s/mod_//` | grep -v mod_ | grep module; done

Well, on on SuSE all modules are end with _module so I think it would be a good idea to check this on other distributions

As well this:
man apxs2:

Code:

[...]
       -n modname 
              This explicitly sets the module name for the -i (install) and -g
              (template generation) option. Use this to explicitly specify the
              module  name.  For option -g this is required, for option -i the
              [b]apxs tool tries to determine the name from the source or  (as  a
              fallback) at least by guessing it from the filename.[/b]
[...]

I tried it without the -n but that didn't work, so I had a look at apache.org for documentation and found this:

http://httpd.apache.org/docs/2.2/develo … ules.html:

Code:

[...]
The new structure is a great deal simpler...

module MODULE_VAR_EXPORT [i]module_name[/i]_module =
{
[...]

Please note the italic_nonitalic modulename, it's as this in the documentation.

Also:
http://threebit.net/tutorials/apache2_m … rial1.html

Code:

[...]
/*
 * Declare and populate the module's data structure.  The
 * name of this structure ('tut1_module') is important - it
 * must match the name of the module.  This structure is the
 * only "glue" between the httpd core and the module.
 */
module AP_MODULE_DECLARE_DATA tut1_module =
[...]

Please note also the _module. I am not a Programmer, but could it be that the missing _module is a bug in anyterm?:

Code:

apache.cc:module AP_MODULE_DECLARE_DATA anyterm = {
[...]

greetings, anniyka

Offline

#20 2008-03-11 11:27:52

phil
Administrator

Re: Can't locate API module structure `anyterm_module'

Please note also the _module. I am not a Programmer, but could it be that the missing _module is a bug in anyterm?

It is certainly true that all of the modules supplied with Apache have names that end _module.  But I have not seen anything in any Apache documentation saying the module names *must* end with _module.  On the contrary, I have never written a module whose name ends _module, and this has always worked perfectly for me.  The only situation in which it causes trouble is for SUSE users; no other distribution seems to make the same assumption.

I do, however, plan to change Anyterm to use the name anyterm_module in order to make life easier for SUSE users.  But this is not high on my list of things to do.  If anyone would like to send a tested patch against SVN HEAD then that would make things easier for me.

Phil.

Offline

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson