An optimization approach is presented for generating linkage mechanisms consisting of frame members with arbitrarily inclined hinges. A second-order cone programming (SOCP) problem is solved to obtain the locations and directions of hinges of an infinitesimal mechanism. It is shown that the primal and dual SOCP problems correspond to the plastic limit analysis problems based on the lower-bound and upper-bound theorems, respectively, with quadratic yield functions. Constraints on displacement components are added to the dual problem, if a desirable deformation is not obtained. A finite mechanism is generated by carrying out geometrically nonlinear analysis and, if necessary, adding hinges and removing members. Effectiveness of the proposed method is demonstrated through examples of two- and three-dimensional mechanisms.