[openssl-users] crypto/objects/o_names.c problem with Solaris 10 and strict Oracle Studio 12.6 c99

Dennis Clarke dclarke at blastwave.org
Fri Jan 18 04:56:23 UTC 2019

On 1/17/19 8:25 PM, Michael Wojcik wrote:
>> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf Of
>> Dennis Clarke
>> Sent: Thursday, January 17, 2019 18:23
>> "crypto/objects/o_names.c", line 114: error: undefined symbol: strcasecmp
>> "crypto/objects/o_names.c", line 114: warning: improper pointer/integer
>> combination: op "="
>> "crypto/objects/o_names.c", line 151: warning: implicit function
>> declaration: strcasecmp
> Note the issue here is an undefined symbol, which consequently has an implicit definition as an int with external linkage and static duration. So we're talking about a header problem, not a library problem.
>> So would love to hear someones thoughts on why strcasecmp suddenly went
>> missing?
> Well...
> strcasecmp is a heresy. 

Love it.

I knew something like this was in the air and I could smell it :-)

> But of course the declaration of strcasecmp in strings.h is itself ifdeffed. 
To get it, _XPG4_2 must be defined, and __EXTENSIONS__ must NOT be defined.

Full moon black cat ifdeffery crud here we go.

> My guess is you're falling foul of one of those two conditions, when you compile in strict mode.
> The simplest fix would be to whack a declaration of strcasecmp into the source file itself

Yeah .. that's icky.

> but that's inelegant and hard to maintain - presumably you'd rather do something through the OpenSSL configure process. As for that, well... the only thing that comes to mind is something like:
> 1. Add -Dstrcasecmp=cmpstrci to the compiler flags
> 2. Add -lcmpstrci to the link flags
> 3. Create a little libcmpstrci.a (no need for it to be a shared object) with a case-insensitive string comparison function named cmpstrci. It can use strcasecmp if it must, or you can implement your own.
> Or the problem might be something else, of course, but the fact that strings.h does appear in the output but strcasecmp isn't declared does suggest the conditional-compilation in strings.h is to blame.

Thank you for the great reply where clearly you have seen ifdeffery
nonsense bite you.  I get caught between a rock and a hrd place here
every time because if I try to go with just ordinary cc and just some
transition loosey goosey not-really-compliant or strict CFLAGS then I
arrive in a different ugly place :

${LDCMD:-/opt/developerstudio12.6/bin/cc} -m64 -xarch=sparc -g -Xa 
-errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff 
-xmemalign=8s -xnolibmil -xcode=pic32 -xregs=no%appl -xlibmieee -mc 
-ftrap=%none -xbuiltin=%none -xunroll=1 -xstrconst -Xa -m64 -xarch=sparc 
-g -Xa -errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff 
-xmemalign=8s -xnolibmil -xcode=pic32 -xregs=no%appl -xlibmieee -mc 
-ftrap=%none -xbuiltin=%none -xunroll=1 -L. -mt  \
         -o test/rsa_complex test/rsa_complex.o \
          -lsocket -lnsl -ldl -lrt -lpthread
Undefined                       first referenced
  symbol                             in file
OPENSSL_sk_pop_free                 test/rsa_complex.o
OPENSSL_sk_dup                      test/rsa_complex.o
OPENSSL_sk_pop                      test/rsa_complex.o
OPENSSL_sk_num                      test/rsa_complex.o
OPENSSL_sk_new                      test/rsa_complex.o
OPENSSL_sk_set                      test/rsa_complex.o
OPENSSL_sk_free                     test/rsa_complex.o
OPENSSL_sk_find                     test/rsa_complex.o
OPENSSL_sk_push                     test/rsa_complex.o
OPENSSL_sk_sort                     test/rsa_complex.o
OPENSSL_sk_zero                     test/rsa_complex.o
OPENSSL_sk_is_sorted                test/rsa_complex.o
OPENSSL_sk_shift                    test/rsa_complex.o
OPENSSL_sk_value                    test/rsa_complex.o
OPENSSL_sk_delete_ptr               test/rsa_complex.o
OPENSSL_sk_unshift                  test/rsa_complex.o
OPENSSL_sk_new_null                 test/rsa_complex.o
OPENSSL_sk_set_cmp_func             test/rsa_complex.o
OPENSSL_sk_reserve                  test/rsa_complex.o
OPENSSL_sk_new_reserve              test/rsa_complex.o
OPENSSL_sk_delete                   test/rsa_complex.o
OPENSSL_sk_insert                   test/rsa_complex.o
OPENSSL_sk_deep_copy                test/rsa_complex.o
OPENSSL_sk_find_ex                  test/rsa_complex.o
ld: fatal: symbol referencing errors. No output written to test/rsa_complex
gmake[1]: *** [Makefile:3561: test/rsa_complex] Error 2
gmake[1]: Leaving directory 
gmake: *** [Makefile:169: all] Error 2

Looks like getting a debug non-optimized library will be a major pain.


More information about the openssl-users mailing list