logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: mod_perl problem
Author
roblassche



Joined: 10 Apr 2013
Posts: 3
Location: Netherlands, IJsselstein

PostPosted: Tue 23 Apr '13 1:28    Post subject: mod_perl problem Reply with quote

I use MinGW, Visual C 10 express and MS SDK.
I compiled Perl and Apache (with apr) from source, it works.
The binary mod_perl, downloaded from apachelounge works with MY compiled version of Perl and Apache.

I also want to compile mod_perl from sources, but fails.
This is the error during linking:
icrosoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

mod_perl.lo:mod_perl.c:(.text+0x1a): undefined reference to `_imp__apr_dynamic_fn_register'
mod_perl.lo:mod_perl.c:(.text+0x32): undefined reference to `_imp__ap_server_config_defines'
mod_perl.lo:mod_perl.c:(.text+0x3d): undefined reference to `_imp__apr_array_push@4'
mod_perl.lo:mod_perl.c:(.text+0x51): undefined reference to `_imp__apr_pstrdup@8'
mod_perl.lo:mod_perl.c:(.text+0x7b): undefined reference to `_imp__ap_hook_pre_config@16'
mod_perl.lo:mod_perl.c:(.text+0xa3): undefined reference to `_imp__ap_hook_open_logs@16'
mod_perl.lo:mod_perl.c:(.text+0xcb): undefined reference to `_imp__ap_hook_post_config@16'
mod_perl.lo:mod_perl.c:(.text+0xf3): undefined reference to `_imp__ap_hook_handler@16'
mod_perl.lo:mod_perl.c:(.text+0x141): undefined reference to `_imp__ap_hook_insert_filter@16'
mod_perl.lo:mod_perl.c:(.text+0x18f): undefined reference to `_imp__ap_register_output_filter@16'
mod_perl.lo:mod_perl.c:(.text+0x1b9): undefined reference to `_imp__ap_register_input_filter@16'
mod_perl.lo:mod_perl.c:(.text+0x22b): undefined reference to `_imp__ap_hook_pre_connection@16'
mod_perl.lo:mod_perl.c:(.text+0x253): undefined reference to `_imp__ap_hook_create_request@16'
mod_perl.lo:mod_perl.c:(.text+0x27b): undefined reference to `_imp__ap_hook_post_read_request@16'
mod_perl.lo:mod_perl.c:(.text+0x2a3): undefined reference to `_imp__ap_hook_header_parser@16'
mod_perl.lo:mod_perl.c:(.text+0x2cb): undefined reference to `_imp__ap_hook_child_init@16'
mod_perl.lo:mod_perl.c:(.text+0x2ed): undefined reference to `_imp__apr_pool_cleanup_null'
mod_perl.lo:mod_perl.c:(.text+0x30a): undefined reference to `_imp__apr_pool_cleanup_register@16'
mod_perl.lo:mod_perl.c:(.text+0x36c): undefined reference to `_imp__apr_pool_clear@4'
mod_perl.lo:mod_perl.c:(.text+0x679): undefined reference to `_imp__ap_add_version_component@8'
mod_perl.lo:mod_perl.c:(.text+0x914): undefined reference to `_imp__ap_server_root'
mod_perl.lo:mod_perl.c:(.text+0x96f): undefined reference to `_imp__apr_filepath_merge@20'
mod_perl.lo:mod_perl.c:(.text+0x9bd): undefined reference to `_imp__apr_stat@16'
mod_perl.lo:mod_perl.c:(.text+0xc5d): undefined reference to `_imp__apr_pool_create_ex@16'
mod_perl.lo:mod_perl.c:(.text+0xc78): undefined reference to `_imp__apr_pool_tag@8'
mod_perl.lo:mod_perl.c:(.text+0xcf6): undefined reference to `_imp__apr_pool_cleanup_null'
mod_perl.lo:mod_perl.c:(.text+0xd18): undefined reference to `_imp__apr_pool_cleanup_register@16'
mod_perl.lo:mod_perl.c:(.text+0xd56): undefined reference to `_imp__ap_mpm_query@8'
mod_perl.lo:mod_perl.c:(.text+0xe5f): undefined reference to `_imp__apr_palloc@8'
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: mod_perl.lo: bad reloc address 0xc in section `.data'
collect2.exe: fout: ld gaf exit-status 1 terug
dmake: Error code 129, while making 'mod_perl.so'
NMAKE : fatal error U1077: 'cd' : return code '0xff'
Stop.

I grepped for some of the undefined reference and only found something in the .h file:
./httpd-2.2.24/srclib/apr/include/apr_file_info.h
/** Cause apr_filepath_merge to fail if addpath is above rootpath
/** Cause apr_filepath_merge to fail if addpath is above rootpath,
/** Fail apr_filepath_merge if the merged path is relative */
/** Fail apr_filepath_merge if the merged path is absolute */
APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
./httpd-2.2.24/srclib/apr/include/arch/win32/apr_arch_file_io.h
* apr_filepath_root or apr_filepath_merge, this fn determines
/* The apr_filepath_merge wants to canonicalize the cwd to the

***
Do you have a clue what is wrong?
Back to top
roblassche



Joined: 10 Apr 2013
Posts: 3
Location: Netherlands, IJsselstein

PostPosted: Wed 24 Apr '13 1:01    Post subject: mod_perl and different compilers Reply with quote

I solved the LINK errors.
Perl was compiled with MinGW and Apache with MS VC10.
I could NOT find in the sources something with _imp__.
I think this is caused by the MinGW compiler.
Anyway, I compiled Perl with MS VC10 and then compile mod_perl from source. The link errors are GONE and mod_perl.so is created.

I will test mod_perl later on, and document the steps involved in compiling and linking.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 24 Apr '13 12:12    Post subject: Reply with quote

_imp__ means imported function ... verses an exported function. The actual function name is what is after the _imp__.

_imp__apr_dynamic_fn_register
Back to top
neoanantha



Joined: 09 Feb 2024
Posts: 10
Location: IN, BGL

PostPosted: Thu 26 Dec '24 18:43    Post subject: Re: mod_perl and different compilers Reply with quote

roblassche wrote:
I solved the LINK errors.
Perl was compiled with MinGW and Apache with MS VC10.
I could NOT find in the sources something with _imp__.
I think this is caused by the MinGW compiler.
Anyway, I compiled Perl with MS VC10 and then compile mod_perl from source. The link errors are GONE and mod_perl.so is created.

I will test mod_perl later on, and document the steps involved in compiling and linking.


I'm facing exactly same problem with following environment

Strawberry Perl Portable binary 5.32.1.1 - 32bit
Apache httpd 2.4.57/58/62 - built 32 bit
MSVC 2022 community edition with latest build tools sdk for vc++ within the distribution

When I'm trying to build mod_perl 2.0.13 32bit from source, I'm getting exactly same error

I'm not sure how to build it from VC 2022 since there's not CMakeList available for mod_perl 2.0.13

I know it's been more than a decade but we need to support a very old legacy application which is tightly coupled with Apache HTTPd/mod_perl combo

I tried linking various *apr* lib files in C:\Apache24\lib in mod_perl\src\perl\modules\mod_perl\Makefile

Tried adding additional libs/includes to MODPERL_LDDLFLAGS and various other similar env vars into having either inc or lib in their names

This has kept him fully blocked since past couple of days

Hence requesting you to let know the steps you took to come out of the reported issue in your OP

@tangent @glsmith any pointers from you people would be extremely welcome
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 358
Location: UK

PostPosted: Sat 28 Dec '24 0:47    Post subject: Reply with quote

I have spent several hours looking into this issue on my build platform with no success, ending up with similar error messages to those already reported above, relating to missing import library references.

However, what I have noticed is differing number of underscores around the import references, depending on whether the build is 32 or 64 bits.

The above post concludes:
Code:
(.text+0x1fc): more undefined references to `_imp__apr_pstrcat' follow

whereas my builds (both 32 and 64 bit) fail with the following:
Code:
(.text+0x176): more undefined references to `__imp_apr_pstrcat' follow

i.e __imp_ vs _imp__

I know the Strawberry Perl (5.32.1.1) is built with (and bundles) GCC tools, whereas my Apache build is based on the latest MSVC, so there will be any number of Posix vs MS compiler issues to contend with (accepting recompiling Strawberry Perl with MSVC is not a viable option).

However, when I look at the public import symbols in my Apache builds, I find these entries available in libapr-1.lib:

Apache 32 bit
Code:
C:\>dumpbin /linkermember c:\apache24\lib\libapr-1.lib | grep _imp[_]*apr_pstrcat
    1A562 __imp__apr_pstrcat
    1A5CC __imp__apr_pstrcatv@16
      185 __imp__apr_pstrcat
      186 __imp__apr_pstrcatv@16

Apache 64 bit
Code:
C:\>dumpbin /linkermember c:\apache24\lib\libapr-1.lib | grep _imp[_]*apr_pstrcat
    18310 __imp_apr_pstrcat
    1837A __imp_apr_pstrcatv
      185 __imp_apr_pstrcat
      186 __imp_apr_pstrcatv

and even though the public symbols match, my 64-bit build won't link.

The mod_perl Makefile.PL process is a complex piece of coding, and does include libapr-1.lib in the link process, but I can't find anything that would help with these anomolies.

Do we have a C/C++ compiler/link expert who could help explain what is going on here, and how to resolve these mismatched symbol references between GCC/MS and 32/64 bit builds?
Back to top
neoanantha



Joined: 09 Feb 2024
Posts: 10
Location: IN, BGL

PostPosted: Sun 29 Dec '24 21:22    Post subject: Reply with quote

Appreciate in-depth hands-on analysis @tangent

I took time to respond here since I had used


    Strawberry Perl 5.32.1.1 (32bit) portable binary - which is compiled with GCC as already mentioned
    Apache 2.4.58 compiled 32bit based on legendary thread 8609 using latest MSVC 2022 Community edition v143 build tools
    Mod_perl 2.0.13 was again being attempted through same MSVC settings - 32bit


Combined with your analysis and above combination it was invariably bound to fail due to compiler mismatch between strawberry perl and Apache/mod_perl

Hence went back to do everything from scratch eventhough I wanted 32bit... thought let me align everything to 64bit with full control on Perl as well

This time went with this stack:


    Perl 5.40.0 - compile from source - 64bit - msvc v143
    Apache24 2.4.58 - compile from source - 64bit - msvc v143 - refer thread 8609
    mod_perl 2.0.13 - compile from source - 64bit - msvc v143


With above stack and x64 arch all of them were happy and each one of them got compiled and installed successfully
With Perl and Apache built on x64 using msvc... mod_perl was also happy and got built without any complaints

Will try to tweak/fix my ancient app to align to x64 arch wherever necessary

Thought let me add this here for continuity as inadvertently this issue will surely be encountered my any other person whose taken above path

Finally for those who might face issue with XML::Parser later with with cpan or cpanm install

Code:

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' (or
'libexpat1-dev') package with your OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

No 'Makefile' created  TODDR/XML-Parser-2.47.tar.gz
  c:\perl\bin\perl.exe Makefile.PL -- NOT OK


Resolution would be from the monks:
https://www.perlmonks.org/?node_id=1066610

Full post
https://www.perlmonks.org/?node_id=599727

Thanks much @tangent
Back to top


Reply to topic   Topic: mod_perl problem View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads