Bug #18815 libmysql using yassl can't be linked with c program

Submitted: 5 Apr 2006 15:38 Modified: 27 Apr 2006 20:16
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.0.21 OS:Solaris (Solaris)
Assigned to: Magnus Blåudd CPU Architecture:Any

[5 Apr 2006 15:38] Magnus Blåudd
Description:
It's not possible to link with libmysql from a c program if it includes yassl. You will get undefined symbols when linking.

These are for example Crun::pure_error which seems to be a function installed in the vtable of a class with pure virtual functions.

Workaround would be to include libCrun.so in the link.

Other symbols missing are "vector_des" and "vector_con" which might be related to "array delete". There is also the "register_exit_code" function.

How to repeat:
Look at the build status pages:

11629: cd /export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc
11630: CC=cc-5.0 CXX=CC ASFLAGS="-xarch=v8" CFLAGS="-xO3 -Xa -xstrconst -mt -D_FORTEC_ -xarch=v8 -xc99=none" CXXFLAGS="-xO3 -noex -mt -D_FORTEC_ -xarch=v8" LDFLAGS=-xarch=v8 LIBS=-lmtmalloc  perl /export/home/mysqldev/sol10-sparc-a/Do-mysqlclient-test
11631: 
11632: ##############################################################################
11633: #  Running Do-mysqlclient-test
11634: ##############################################################################
11635: 
11636: CC=cc-5.0
11637: CXX=CC
11638: CFLAGS=-I/export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/include -xO3 -mt -D_FORTEC_ -xarch=v8
11639: LIBS=-xarch=v8 -L/export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/lib -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm
11640: 
11641: Running: cc-5.0  -I/export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/include -xO3 -mt -D_FORTEC_ -xarch=v8 test.c -xarch=v8 -L/export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/lib -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm
11642: 
11643: Testing from C to link with all functions in libmysqlclient... Undefined			first referenced
11644:  symbol  			    in file
11645: __1cG__CrunKpure_error6F_v_         /export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/lib/libmysqlclient.a(libtaocrypt_la-asn.o)
11646: __1cG__CrunKvector_des6FpvIIpF1_v_v_ /export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/lib/libmysqlclient.a(libtaocrypt_la-algebra.o)
11647: __1cG__CrunKvector_con6FpvIIpF1_vp2_v_ /export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/lib/libmysqlclient.a(libtaocrypt_la-algebra.o)
11648: __1cG__CrunSregister_exit_code6FpG_v_v_ /export/home/mysqldev/sol10-sparc-a/test/mysql-standard-5.0.20-solaris10-sparc/lib/libmysqlclient.a(yassl_int.o)
11649: ld: fatal: Symbol referencing errors. No output written to a.out
11650: fail

Suggested fix:
For gcc compilers we have defined a __cxa_pure_virtual function and we need to do something similar here.
[6 Apr 2006 12:37] Magnus Blåudd
The pure_error symbol is inserted for classes with pure virtal functions. Ifthe pure part is removed from all classes in a file, the problem will go away(or move to another file...)
[6 Apr 2006 13:10] Magnus Blåudd
The register_exit_code symbol comes from declarations of singletons that are declared as a static const variable of a class.

Example:
yassl_int.hpp
class sslFactory {
   < snip>
private:
    static sslFactory instance_;
}

Later in yassl_int.cpp
Sessions Sessions::instance_; // simple singleton
[6 Apr 2006 13:36] Magnus Blåudd
The vector_des and vector_con calls are generated in the function AbstractEuclideanDomain::Gcd when arrays of objects are created on the stack.

const Integer& AbstractEuclideanDomain::Gcd(const Element &a,
                                            const Element &b) const
{
    Element g[3]={b, a};
    unsigned int i0=0, i1=1, i2=2;

    while (!Equal(g[i1], this->Identity()))
    {
        g[i2] = Mod(g[i0], g[i1]);
        unsigned int t = i0; i0 = i1; i1 = i2; i2 = t;
    }

    return result = g[i0];
}
[12 Apr 2006 9:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4846
[12 Apr 2006 9:54] Magnus Blåudd
Patch has been sent for inclusion in upstream yaSSL.
[18 Apr 2006 10:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/5072

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.