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 DE824FE0 for ; Thu, 21 Jun 2012 20:13:23 +0000 (UTC) Received: (qmail 71946 invoked by uid 500); 21 Jun 2012 20:13:23 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 71920 invoked by uid 500); 21 Jun 2012 20:13:23 -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 71908 invoked by uid 99); 21 Jun 2012 20:13:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jun 2012 20:13:23 +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; Thu, 21 Jun 2012 20:13:16 +0000 Received: by dadn2 with SMTP id n2so1647525dad.18 for ; Thu, 21 Jun 2012 13:12:55 -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:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=++gIXvtA5mPfDuWVPPqren+qoXqKpwurzAvbLMXut3s=; b=LlmgmkyEqSUFJHWIveuitXYXgJA+p8TwUp4L42rBeWQEZ2pbj/wduGSuL/lNTU9Aax m4AhoevPsLl1JfGutPzeNb4NlV8I5P4JAIwSemWNevKVCrknpr9WVaH2FJ0yobKoXiY8 xH7H9U87v2wtC/6gOPZjV3Lg+Gxkhz082ewgIboSYyzzwtuKLmbF46sO39UWGdVl6kJS EQulLtDGZI1a16F5gsCpYJkM8JzzYGTPZlXzcHJenTi6TG8IjG1dpvLfbWDSnzbMIA2z y0gRyRi2zjFLjuxyV+mqKBQmfzKog2qc3p2ZXMf3kJgyfckdJ+Tp68ZEJy29GephFxyy Vr/Q== Received: by 10.68.226.65 with SMTP id rq1mr2468492pbc.25.1340309574871; Thu, 21 Jun 2012 13:12:54 -0700 (PDT) Received: from [192.168.1.148] (cottonwoodheights.silverhawk.net. [63.226.93.31]) by mx.google.com with ESMTPS id vp4sm36572953pbc.61.2012.06.21.13.12.52 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 13:12:53 -0700 (PDT) Sender: Joe Lewis Message-ID: <4FE3803E.7060600@joe-lewis.com> Date: Thu, 21 Jun 2012 14:12:46 -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: modules-dev@httpd.apache.org Subject: Re: How to compiling/link/use Apache module that uses shared library? References: <20120621154033.W5OQE.184568.imail@eastrmwml205> In-Reply-To: <20120621154033.W5OQE.184568.imail@eastrmwml205> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQk5J2RsDpMKjZOVDyLKdxdi5UFVvQzqKMiepSHVNcPURS02zsc0uJsq8ewAGVzSscLz9J3/ On 6/21/12 1:40 PM, ohaya@cox.net wrote: > ---- ohaya@cox.net wrote: >> ---- Sorin Manolache wrote: >>> On 2012-06-21 19:47, ohaya@cox.net wrote: >>> >>>> I've tried using "-l" pointing directly to the .so, libobaccess.so, but when I do that, it says it can't find the .so: >>>> >>>> [root@apachemodule build-mod_headers]# ./compile-mod-headers.sh >>>> /apps/httpd2222/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/apps/httpd2222/include -I/apps/httpd2222/include -I/apps/httpd2222/include -c -o mod_headers.lo mod_headers.c&& touch mod_headers.slo >>>> /apps/httpd2222/build/libtool --silent --mode=link gcc -o mod_headers.la -l/apps/netpoint/AccessServerSDK/oblix/lib/libobaccess.so -rpath /apps/httpd2222/modules -module -avoid-version mod_headers.lo >>>> /usr/bin/ld: cannot find -l/apps/netpoint/AccessServerSDK/oblix/lib/libobaccess.so >>>> collect2: ld returned 1 exit status >>>> apxs:Error: Command failed with rc=65536 >>> Try -lobaccess >>> >>> S >> >> Sorin, >> >> I was able to get Apache to start, kind of, using the apxs I posted, but adding LoadFile directives to the Apache httpd.conf, to load libobaccess.so. >> >> Now, when I run "apachectl -t", it says "OK", but when I try to actually start Apache, I get a segfault (see below). The thing is, I have a bunch of printfs in almost every function in mod_headers.c, so I could see what functions are being called, and it looks like the segfault is occurring even before it gets to any of the code parts that I've tweaked (vs. original mod_headers.c): >> >> >> [root@apachemodule build-mod_headers]# /apps/httpd2222/bin/apachectl -k start -X >> mod_headers-jl V0.09 - start calling OAM API >> In register_hooks >> In create_headers_dir_config >> In create_headers_dir_config >> In header_cmd >> In header_inout_cmd >> In parse_format_tag >> In parse_misc_string >> In create_headers_dir_config >> In header_cmd >> In header_inout_cmd >> In parse_format_tag >> In parse_misc_string >> In header_post_config >> >> I tried running strace, and got (the ending of the strace): >> >> >> In register_hooks >> In create_headers_dir_config >> In create_headers_dir_config >> In header_cmd >> In header_inout_cmd >> In parse_format_tag >> In parse_misc_string >> In create_headers_dir_config >> In header_cmd >> In header_inout_cmd >> In parse_format_tag >> In parse_misc_string >> In header_post_config >> rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 >> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 >> rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 >> rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 >> rt_sigaction(SIGINT, {0x432cc0, [], SA_RESTORER, 0x351432e300}, {SIG_DFL}, 8) = 0 >> wait4(-1, [{WIFSIGNALED(s)&& WTERMSIG(s) == SIGSEGV}], 0, NULL) = 11711 >> fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0 >> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a983bf000 >> open("/usr/share/locale/locale.alias", O_RDONLY) = 3 >> fstat(3, {st_mode=S_IFREG|0644, st_size=2528, ...}) = 0 >> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a983c0000 >> read(3, "# Locale name alias data base.\n#"..., 4096) = 2528 >> read(3, "", 4096) = 0 >> close(3) = 0 >> munmap(0x2a983c0000, 4096) = 0 >> open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) >> open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) >> open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) >> open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) >> open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) >> open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) >> write(2, "/apps/httpd2222/bin/apachectl: l"..., 83/apps/httpd2222/bin/apachectl: line 78: 11711 Segmentation fault $HTTPD $ARGV >> ) = 83 >> rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 >> --- SIGCHLD (Child exited) @ 0 (0) --- >> wait4(-1, 0x7fbfffed64, WNOHANG, NULL) = -1 ECHILD (No child processes) >> rt_sigreturn(0xffffffffffffffff) = 0 >> rt_sigaction(SIGINT, {SIG_DFL}, {0x432cc0, [], SA_RESTORER, 0x351432e300}, 8) = 0 >> rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 >> read(255, "\nexit $ERROR\n\n", 3420) = 14 >> rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 >> rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 >> exit_group(139) = ? >> >> >> I'll try to do the apxs with -lobccess and post back... >> >> Jim > > Hi, > > It looks like just including the .so in the apxs command is enough to cause the segfault, even if I remove all references to the functions in the .so from my module code. > > Is there something else I need to do when using my module that uses "external" .so files? > > Jim You may need to ensure the .so is in your ldconfig paths. If you do an "ldconfig -p" and grep for your module, it should show up. Additionally, on your compile, split your -l/-L into two parts : -L/apps/netpoint/AccessServerSDK/oblix/lib/ -llibobaccess See if that behaves any differently. Joe -- http://www.silverhawk.net/