When you specify the flag X509_V_FLAG_CRL_CHECK for the cert verification, then you will need to have a valid corresponding CRL for the last cert in the cert chain. And if you specify the flag X509_V_FLAG_CRL_CHECK then you will need to have corresponding CRLs for all the certs available in the chain. So, I am guessing you are missing to load corresponding CRLs for your cert before performing the verification and that's why you get the error "X509_V_ERR_UNABLE_TO_GET_CRL".
