In openGl matrices are transposed in memory. So transpose the matrix is OK. But you code doesn't look correct.

So you are in OpenGl. OpenGl uses right handed coordinate system. And for RH is lookat function defined like this:

    zaxis = normal(cameraPosition - cameraTarget)
    xaxis = normal(cross(cameraUpVector, zaxis))
    yaxis = cross(zaxis, xaxis)
    
     xaxis.x           yaxis.x           zaxis.x          0
     xaxis.y           yaxis.y           zaxis.y          0
     xaxis.z           yaxis.z           zaxis.z          0
    -dot(xaxis, cameraPosition)  -dot(yaxis, cameraPosition)  -dot(zaxis, cameraPosition)  1

Especialy take care about `zaxis = normal(cameraPosition - cameraTarget)` because it is the only difference between RH and LH system. 

**Save it transposed and that's it**