Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF54B9F28 for ; Fri, 22 Jun 2012 00:55:49 +0000 (UTC) Received: (qmail 19796 invoked by uid 500); 22 Jun 2012 00:55:49 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 19757 invoked by uid 500); 22 Jun 2012 00:55:49 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 19749 invoked by uid 99); 22 Jun 2012 00:55:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jun 2012 00:55:49 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jlewis@silverhawk.net designates 209.85.210.45 as permitted sender) Received: from [209.85.210.45] (HELO mail-pz0-f45.google.com) (209.85.210.45) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jun 2012 00:55:41 +0000 Received: by dadn2 with SMTP id n2so1925448dad.18 for ; Thu, 21 Jun 2012 17:55:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=ZQLTPIfnuiCfN/9nABgREtaPsV6R1md+LrraZAWWvQk=; b=o4BfxxUQFbNDwklEAF9ZGWTx+98lmUCAtlf3abWX/RI33MXDOpJJeq9K3dPYdyJYUQ gAG/m095XWmH7vJn5YEtA881bh/4ipAx3wymNzgel0rZD/rokwz2fpk9MeWFs/FKCL5o R4pdDL/ReoP6HvGn6kisNX0KtIUP2oMqadIMqBXFzvbGPwQ3i7UEWmNAYixKHGXy1ajD fY/6JJiEp9Y881PXeuiOlhtTVixy0Rr5ynvbC7cYeAKKK7TgznnUvBgnPbgCLhY09Ln4 Iy0eD5/lXNxMq0TSzCV6OArE/lhwXDuy/9O2SKg7T22smVmhs7TGSRmpZatq7dWGEStF kNMA== Received: by 10.68.233.39 with SMTP id tt7mr3882705pbc.124.1340326520244; Thu, 21 Jun 2012 17:55:20 -0700 (PDT) Received: from [192.168.1.148] (cottonwoodheights.silverhawk.net. [63.226.93.31]) by mx.google.com with ESMTPS id sk5sm8955201pbc.7.2012.06.21.17.55.18 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 17:55:19 -0700 (PDT) Sender: Joe Lewis Message-ID: <4FE3C275.5000909@joe-lewis.com> Date: Thu, 21 Jun 2012 18:55:17 -0600 From: Joe Lewis User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: ohaya@cox.net CC: modules-dev@httpd.apache.org Subject: Re: UNSOLVED was Re: SOLVED was Re: How to compiling/link/use Apache module that uses shared library? References: <20120621204651.G14SS.187638.imail@eastrmwml214> In-Reply-To: <20120621204651.G14SS.187638.imail@eastrmwml214> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmB6bu5SIsnfQdA9zRCWEfQFsqNINZ+JNg11MgbcyeuNle2NsSVrP9HerMsF7xmwmw5Frgi On 6/21/12 6:46 PM, ohaya@cox.net wrote: > ---- Joe Lewis wrote: >> On 6/21/12 5:49 PM, ohaya@cox.net wrote: >>> ---- ohaya@cox.net wrote: >>>> ---- Sorin Manolache wrote: >>>>> And I forgot to say: run gdb in some sort of environment where you see >>>>> your current source code line and a couple of surrounding lines. You >>>>> could achieve this with the "list" command, but I prefer running gdb in >>>>> emacs and let emacs do the nice listing of source code in a different panel. >>>>> >>>>> S >>>> Here's the function from my source. It's the original from mod_headers.c, plus my printf: >>>> >>>> >>>> static int header_post_config(apr_pool_t *pconf, apr_pool_t *plog, >>>> apr_pool_t *ptemp, server_rec *s) >>>> { >>>> printf("In header_post_config\n"); >>>> header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); >>>> return OK; >>>> } >>>> >>>> Jim >>> Hi, >>> >>> I was able to get the segfault to go away. Here's what I had to do: >>> >>> - Created /etc/ld.so.conf.d/my.conf, and added the directory where my libobaccess.so was >>> - Run 'ldconfig' to activate. >>> - In the apxs command, DON'T include the -L and -l arguments >>> >>> After that, Apache appears to start ok, without segfault :)!! >>> >>> Thanks for all of the great help, esp. the suggestion about checking "ldconfig -p". I still don't understand why, but I'm just glad that I can get past this piece so now I can debug my module :)... >>> >>> Later, >>> Jim >> I'm just glad this list is as good as it is! >> >> FYI, the ldconfig is the dynamic linker control, and those >> /etc/ld.so.conf.d files provide additional search directories for the >> linker to check in when loading a library. >> >> Joe >> -- >> http://www.silverhawk.net/ > > Hi, > > Sorry to report, but my earlier report was a "false positive" :)... > > I forgot that the mod_headers.c that I was doing the earlier testing with had all references to the libobaccess.so removed :(!! > > So, I'm still stuck with basically the same problem, now, working with my "full" code, with the calls in it: > > - If I compile with -L and -l, Apache segfaults when it starts > > - If I compile without -L and -l, then I get "undefined symbol" errors when I try to start Apache, e.g.: > > [root@apachemodule build-mod_headers]# /apps/httpd2222/bin/apachectl -k start -X > httpd: Syntax error on line 84 of /apps/httpd2222/conf/httpd.conf: Cannot load /apps/httpd2222/modules/mod_headers.so into server: /apps/httpd2222/modules/mod_headers.so: undefined symbol: ObResource_isProtected > > That "ObResource_isProtected" should be a symbol in libobaccess.so, and in fact, if I do "nm --dynamic", I get: > > [root@apachemodule build-mod_headers]# nm --dynamic /apps/netpoint/lib64/libobaccess.so | grep "ObResource_isProtected" > 00000000000a6d80 T ObResource_isProtected > [root@apachemodule build-mod_headers]# > > > I'm *assuming* that the reason for the "undefined symbol" error is that libobaccess.so is actually not being loaded, but then when I try to load libobaccess.so, either via -L and -l in the apxs, or using LoadFile in httpd.conf, I get the segfault (same gdb info, BTW). > > Catch-22? > > Sorry for the false alarm :(!! > > Jim > > Not a catch-22. The -L and -l specify linker options when assembling the code. The ldconfig is a run-time thing. If you are getting the stderr messages, you are making it all the way into your library. I'd suggest commenting out the following line and see if you get farther : header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); That should tell you if the problem is the ssl_var_lookup. Joe -- http://www.silverhawk.net/