cpanel / perl-compiler

cPanel's custom implementation of B::C
https://cpanel.net
Other
8 stars 3 forks source link

Fail to compile a DBD::* module: 'Unable to get DBI state function. DBI not loaded..' #72

Closed atoomic closed 7 years ago

atoomic commented 7 years ago

This can be reproduced by compiling DBD::SQLite.

> perlcc -S -e -r 'use DBD::SQLite (); print qq[ok\n]';
Unable to get DBI state function. DBI not loaded..

This is failing in DBD::SQLite::bootstrap as DBI boot did not occurred... the DBI state function '_dbi_state_lval' is defined at BOOT time

     (void) newXS("DBI::_dbi_state_lval", (XSUBADDR_t)_dbi_state_lval, __FILE__);

We can clearly see this in the .c file, DBI should be first... alphabetical order is not good enough here

> grep -A10 dl_init a.out.c
...
Unable to get DBI state function. DBI not loaded..

static void dl_init(pTHX)
{

    dTARG;
    PERL_UNUSED_ARG(targ);
    ENTER;
    SAVETMPS;

    do_bootstrap( "B", 1, "B::bootstrap", &boot_B );
    do_bootstrap( "DBD::SQLite", 11, "DBD::SQLite::bootstrap", &boot_DBD__SQLite );
    do_bootstrap( "DBI", 3, "DBI::bootstrap", &boot_DBI );
....

We can force DBI to be first

atoomic commented 7 years ago

fixed by commit 9723141