The HARP Collaboration has presented measurements of the double-differential pi(+/-) production cross section in the range of momentum 100 MeV/c <= p <= 800 MeV/c and angle 0.35 rad <=theta <= 2.15 rad with proton beams hitting thin nuclear targets. In many applications the extrapolation to long targets is necessary. In this article the analysis of data taken with long (one interaction length) solid cylindrical targets made of carbon, tantalum, and lead is presented. The data were taken with the large-acceptance HARP detector in the T9 beam line of the CERN proton synchrotron. The secondary pions were produced by beams of protons with momenta of 5, 8, and 12GeV/c. The tracking and identification of the produced particles were performed using a small-radius cylindrical time projection chamber placed inside a solenoidal magnet. Incident protons were identified by an elaborate system of beam detectors. Results are obtained for the double-differential yields per target nucleon d(2)sigma/dpd theta. The measurements are compared with predictions of the MARS and GEANT4 Monte Carlo simulations.