Hi I am trying to optimize python for some specific benchmarks. I am testing the PGO ( FDO ) implementation in python Make file : make profile-opt. 430 # Compile a binary with gcc profile guided optimization. 431 profile-opt: 432 @echo "Building with support for profile generation:" 433 $(MAKE) clean 434 $(MAKE) build_all_generate_profile 435 @echo "Running benchmark to generate profile data:" 436 $(MAKE) profile-removal 437 $(MAKE) run_profile_task 438 @echo "Rebuilding with profile guided optimizations:" 439 $(MAKE) clean 440 $(MAKE) build_all_use_profile 441 442 build_all_generate_profile: 443 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov" 444 445 run_profile_task: 446 : # FIXME: can't run for a cross build 447 ./$(BUILDPYTHON) $(PROFILE_TASK) 448 449 build_all_use_profile: 450 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use" It woks fine if I do not add the --enable-shared flag to the configure 740 Building a shared libpython 741 --------------------------- 742 743 Starting with Python 2.3, the majority of the interpreter can be built 744 into a shared library, which can then be used by the interpreter 745 executable, and by applications embedding Python. To enable this feature, 746 configure with --enable-shared. 747 748 If you enable this feature, the same object files will be used to create 749 a static library. In particular, the static library will contain object 750 files using position-independent code (PIC) on platforms where PIC flags 751 are needed for the shared library. but I got the following error: make run_profile_task make[1]: Entering directory '/builddir/build/BUILD/Python-2.7.10' : # FIXME: can't run for a cross build ./python ./Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck ./python: symbol lookup error: ./python: undefined symbol: __gcov_indirect_call_callee Makefile:456: recipe for target 'run_profile_task' failed make[1]: Leaving directory '/builddir/build/BUILD/Python-2.7.10' make[1]: *** [run_profile_task] Error 127 Makefile:442: recipe for target 'profile-opt' failed make: *** [profile-opt] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.XWTCtn (%build) Bad exit status from /var/tmp/rpm-tmp.XWTCtn (%build) This is due to the lack of gcov symbols for the shared libraries ( as far as I ca see ) . If I remove the --enable-shared option is fine. However is going to he hard to have a deployable python without the .so & .so.& files After a little bit of search I found this issue has been here before: https://gcc.gnu.org/ml/gcc-help/2010-06/msg00011.html http://stackoverflow.com/questions/2961203/is-profile-guided-optimization-possible-with-shared-libraries-in-gcc http://stackoverflow.com/questions/8837744/gcc-profile-guided-optimization-with-shared-library-with-no-control-over-executa But not sure how to deal with this now (This happen in gcc 4 and 5 ) All the help is more than welcome Regards Victor Rodriguez