mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Stefan Kratochwil" <stefankratochwil@inovel.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] Fixed broken httpd build (undefined reference to crypt_r)
Date: Thu, 9 Jul 2015 09:35:40 +0000	[thread overview]
Message-ID: <00050B79.559E5C8B@mail.ino.local> (raw)

Hi,

I fixed a problem regarding the httpd build. Without this fix, the build crashes during linking several binaries from the <httpd-basedir>/support subdir, including htdigest etc. The error message was 'undefined reference to crypt_r'.

This has been introduced by a changed behaviour in newer gcc versions, which by default set the linker option -Wl--as-needed. This results in WEAK symbol references not being resolved properly in certain situations. Linking against libcrypt turned out to be a main trigger for this problem.

The solution is to add -Wl--no-as-needed to ALL_LDFLAGS:


commit 8ecb56b24b57a0b2aca1470f48f60a34f518beaf
Author: Stefan Kratochwil <stefankratochwil@inovel.de>
Date:   Wed Jul 8 16:02:23 2015 +0200

    Fixed undefined reference to crypt_r.

    Newer gcc versions used the linker option -Wl--no-as-needed by default.
    This behaviour was changed in newer versions, which default to
    -Wl--as-needed.

    This leads to WEAK symbols not being resolved properly, which itself
    leads to linking errors, especially if libcrypt is involved.

    This patch restores the original behaviour by adding the linker option
    -Wl--no-as-needed to ALL_LDFLAGS.

diff --git a/patches/httpd-2.0.64/0005-fix-undefined-reference-to-crypt_r-by-no-as-needed.patch b/patches/httpd-2.0.64/0005-fix-undefined-reference-to-crypt_r-by-no-as-needed.patch
new file mode 100755
index 0000000..e80637f
--- /dev/null
+++ b/patches/httpd-2.0.64/0005-fix-undefined-reference-to-crypt_r-by-no-as-needed.patch
                
+Index: httpd-2.0.64/build/rules.mk.in
+===================================================================
+--- httpd-2.0.64.orig/build/rules.mk.in    2006-07-12 09:40:55.000000000 +0200
++++ httpd-2.0.64/build/rules.mk.in 2015-07-08 11:16:05.521218188 +0200
+                 
+ ALL_CFLAGS   = $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS)
+ ALL_CPPFLAGS = $(DEFS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS)
+ ALL_CXXFLAGS = $(EXTRA_CXXFLAGS) $(NOTEST_CXXFLAGS) $(CXXFLAGS)
+-ALL_LDFLAGS  = $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
++ALL_LDFLAGS  = -Wl,--no-as-needed $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
+ ALL_LIBS     = $(EXTRA_LIBS) $(NOTEST_LIBS) $(LIBS)
+ ALL_INCLUDES = $(INCLUDES) $(EXTRA_INCLUDES)
+ 
diff --git a/patches/httpd-2.0.64/series b/patches/httpd-2.0.64/series
index ff12a99..ff03f1f 100644
--- a/patches/httpd-2.0.64/series
+++ b/patches/httpd-2.0.64/series
               
 0003-HACK-support-apxs-don-t-execute-httpd.patch
 0004-HACK-support-apxs-don-t-try-to-modify-the-config-fil.patch
 # 160b9c105b4f55538cd0ce5c82eda8fd  - git-ptx-patches magic
+0005-fix-undefined-reference-to-crypt_r-by-no-as-needed.patch

I have no idea since when this problem occurs, but I recall a posting her on the mailinglist from a few years ago, stating that the build worked with OSELAS.Toolchain() 2012.xx.yy, but got broken with a later version.


Note: this problem also occurs in lighthttpd, and possibly in several other packages! I do not have a patch for lighthttpd and also didn't look for other affected packages.


I would be happy about a few comments.

 
Mit freundlichen Grüßen / with best regards


stefan kratochwil  
future master of software engineering

inovel elektronik gmbh 
inovel systeme AG 
gebhardstr. 7 
88046 friedrichshafen
 
phone  +49 7541 39900-0
fax      +49 7541 39900-99
mail     stefankratochwil@inovel.de
web    www.inovel.de
 



inovel elektronik gmbh
general manager: axel dittus, robert steinhauser
hrb 632191 amtsgericht ulm; VAT Reg. No.: DE811926597
 
inovel systeme AG
board of management: markus spinnenhirn (chairman), axel dittus, robert steinhauser
chairman of the supervisory board: joachim zodel
registered office: friedrichshafen; hrb 728443 amtsgericht ulm; VAT Reg. No.: DE814611877



This email (including any attachments) may contain confidential and/or privileged information or information otherwise 
protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this 
message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this 
message and any attachments from your system. inovel disclaims any and all liability if this email transmission was virus 
corrupted, altered or falsified.



-- 
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2015-07-09  7:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  9:35 Stefan Kratochwil [this message]
2015-07-09 11:03 ` Juergen Borleis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00050B79.559E5C8B@mail.ino.local \
    --to=stefankratochwil@inovel.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox