Bug 46685 - Problem linking g++ compiled file with cracklib library.
Summary: Problem linking g++ compiled file with cracklib library.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: cracklib
Version: 7.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-06-29 19:22 UTC by Konstantin Reznitsky
Modified: 2007-04-18 16:34 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-03-08 13:47:09 UTC
Embargoed:


Attachments (Terms of Use)

Description Konstantin Reznitsky 2001-06-29 19:22:43 UTC
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 19:44:10 UTC
crack.h does not surround the prototype with
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
Reassigning.

Comment 2 Nalin Dahyabhai 2001-08-03 22:40:12 UTC
Fixing in cracklib-2.7-12, which will appear in the next Raw Hide refresh.  Thanks!

Comment 3 Miloslav Trmac 2004-03-08 13:47:09 UTC
Fix confirmed in cracklib-2.7-23.


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