Cascade Classifier Training - Application: opencv_traincascade

For Cascade Classifier Training , the opencv_traincascade application as mentioned here:

http://docs.opencv.org/master/dc/d88/tutorial_traincascade.html

The source code does not compile as some of the files with the old_ml prefix in the source code make reference to a CvFileStorage data structure. This seems not to be present in version 4.x of OpenCV (Documentation has it listed in version 3.x).

How can I build this application ? (I would like to for version 4.x and 32-bit & 64-bit, dynamic linked & static linked)