Bug 46685 - Problem linking g++ compiled file with cracklib library.
Problem linking g++ compiled file with cracklib library.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: cracklib (Show other bugs)
7.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-29 15:22 EDT by Konstantin Reznitsky
Modified: 2007-04-18 12:34 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-08 08:47:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Konstantin Reznitsky 2001-06-29 15:22:43 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
When compiling a c++ (not c) file with gcc, linker reports an error
"undefined reference to `FascistCheck(char *, char *)' ". With .c files
everything works as it should.

How reproducible:
Always

Steps to Reproduce:
1. Create a simple c++ file (test.cpp)

#include <stdio.h>
#include <crack.h>

main()
{
        printf("%s",FascistCheck("12345","/usr/share/dict/cracklib_dict"));
}

2. Try to compile it as:
gcc -o test  ./test.cpp -lcrack 

3.Get an error - something like this:
/tmp/cc02lWnO.o: In function `main':
/tmp/cc02lWnO.o(.text+0x1e): undefined reference to `FascistCheck(char *,
char *)'
collect2: ld returned 1 exit status
#
4. Rename file from test.cpp into test.c, compile and run it - everything
works.

Actual Results:  in case of c++ file:
/tmp/cc02lWnO.o: In function `main':
/tmp/cc02lWnO.o(.text+0x1e): undefined reference to `FascistCheck(char *,
char *)'
collect2: ld returned 1 exit status

in case of c file:
#it is too short   - (bad password)

Expected Results:  I excect it to work the way the c file works.

Additional info:
Comment 1 Jakub Jelinek 2001-06-29 15:44:10 EDT
crack.h does not surround the prototype with
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
Reassigning.
Comment 2 Nalin Dahyabhai 2001-08-03 18:40:12 EDT
Fixing in cracklib-2.7-12, which will appear in the next Raw Hide refresh.  Thanks!
Comment 3 Miloslav Trmac 2004-03-08 08:47:09 EST
Fix confirmed in cracklib-2.7-23.

Note You need to log in before you can comment on or make changes to this bug.