This is the mail archive of the
mailing list for the GCC project.
Using profile guided optimization in shared library error
- From: Victor Rodriguez <vm dot rod25 at gmail dot com>
- To: gcc-help <gcc-help at gcc dot gnu dot org>, gcc at gcc dot gnu dot org
- Cc: alecsandru dot patrascu at intel dot com
- Date: Fri, 28 Aug 2015 08:25:48 -0500
- Subject: Using profile guided optimization in shared library error
- Authentication-results: sourceware.org; auth=none
I am trying to optimize python for some specific benchmarks. I am
testing the PGO ( FDO ) implementation in python Make file : make
430 # Compile a binary with gcc profile guided optimization.
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
443 $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
446 : # FIXME: can't run for a cross build
447 ./$(BUILDPYTHON) $(PROFILE_TASK)
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
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.
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: 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:
Makefile:456: recipe for target 'run_profile_task' failed
make: Leaving directory '/builddir/build/BUILD/Python-2.7.10'
make: *** [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:
But not sure how to deal with this now
(This happen in gcc 4 and 5 )
All the help is more than welcome