This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using profile guided optimization in shared library error


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.
 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
 442 build_all_generate_profile:
 443     $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
 445 run_profile_task:
 446     : # FIXME: can't run for a cross build
 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 ---------------------------
 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 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/ -n 2 --with-gc --with-syscheck
./python: symbol lookup error: ./python: undefined symbol:
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:

But not sure how to deal with this now

(This happen in gcc 4 and 5 )

All the help is more than welcome


Victor Rodriguez

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]