Building wine with profile generation

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Ema
Level 2
Level 2
Posts: 19
Joined: Fri Feb 13, 2009 6:58 pm

Building wine with profile generation

Post by Ema »

Hi all,

I'm trying to build wine with the following command:

Code: Select all

./configure CFLAGS="-O2 -fprofile-generate" --prefix=/home/ema/winepf
As I have a lot of these errors:

Code: Select all

gcc -O2 -fprofile-generate -o sfnt2fnt sfnt2fnt.o -L../libs/wine -lwine ../libs/port/libwine_port.a  -lfreetype -lz -Wl,--rpath,\$ORIGIN/../libs/wine
/usr/bin/ld: sfnt2fnt: hidden symbol `__gcov_merge_add' in /usr/lib/gcc/i486-linux-gnu/4.3.2/libgcov.a(_gcov_merge_add.o) is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [sfnt2fnt] Error 1
So I have to start amend the single Makefiles for every subdirectory that doesn't compile.
Has anyone any solution tocompile the full wine with -fprofile-generate flag?

I'd really like to optimize it but...I got a huge amount of these errors...
Cheers,
austin987
Wine Developer
Wine Developer
Posts: 2383
Joined: Fri Feb 22, 2008 8:19 pm

Building wine with profile generation

Post by austin987 »

On Sat, Feb 14, 2009 at 3:32 AM, Ema <[email protected]> wrote:
Hi all,

I'm trying to build wine with the following command:

Code:

./configure CFLAGS="-O2 -fprofile-generate" --prefix=/home/ema/winepf



As I have a lot of these errors:

Code:

gcc -O2 -fprofile-generate -o sfnt2fnt sfnt2fnt.o -L../libs/wine -lwine ../libs/port/libwine_port.a -lfreetype -lz -Wl,--rpath,\$ORIGIN/../libs/wine
/usr/bin/ld: sfnt2fnt: hidden symbol `__gcov_merge_add' in /usr/lib/gcc/i486-linux-gnu/4.3.2/libgcov.a(_gcov_merge_add.o) is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [sfnt2fnt] Error 1
Looking at http://www.gp32x.com/board/index.php?sh ... 8490&st=15,
says make distclean may be needed, as well as an LDFLAG...

make distclean ; CFLAGS="-fprofile-generate"
LDFLAGS="-fprofile-generate" ./configure && make depend && make

works for me, past that point, then fails:
gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__
-D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wwrite-strings -Wtype-limits
-Wpointer-arith -fprofile-generate -o main.o main.c
../../tools/winegcc/winegcc -B../../tools/winebuild -shared
./acledit.spec main.o -o acledit.dll.so -lkernel32
../../libs/port/libwine_port.a -fprofile-generate
main.o: In function `DllMain':
main.c:(.text+0x40): undefined reference to `__gcov_indirect_call_profiler'
main.o: In function `FMExtensionProcW':
main.c:(.text+0x232): undefined reference to `__gcov_indirect_call_profiler'
main.o: In function `global constructors keyed to 65535_0_main.c':
main.c:(.text+0x346): undefined reference to `__gcov_init'
main.o:(.data.rel+0x24): undefined reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(dll_entry.o): In function
`__wine_spec_dll_entry':
dll_entry.c:(.text+0x40): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(dll_entry.o): In function `global
constructors keyed to 65535_0_dll_entry.c':
dll_entry.c:(.text+0x24d): undefined reference to `__gcov_init'
../../dlls/winecrt0/libwinecrt0.a(dll_entry.o):(.data.rel+0x24):
undefined reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(init.o): In function `__wine_spec_init':
init.c:(.text+0x40): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(init.o): In function `__wine_spec_init_ctor':
init.c:(.text+0x104): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(init.o): In function `global
constructors keyed to 65535_0_init.c':
init.c:(.text+0x1c7): undefined reference to `__gcov_init'
../../dlls/winecrt0/libwinecrt0.a(init.o):(.data.rel+0x24): undefined
reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(stub.o): In function
`__wine_spec_unimplemented_stub':
stub.c:(.text+0x40): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(stub.o): In function `global
constructors keyed to 65535_0_stub.c':
stub.c:(.text+0xec): undefined reference to `__gcov_init'
../../dlls/winecrt0/libwinecrt0.a(stub.o):(.data.rel+0x24): undefined
reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(stub.o):(.data.rel+0x30): undefined
reference to `__gcov_merge_single'
../../dlls/winecrt0/libwinecrt0.a(stub.o):(.data.rel+0x3c): undefined
reference to `__gcov_merge_single'
../../dlls/winecrt0/libwinecrt0.a(stub.o):(.data.rel+0x48): undefined
reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(stub.o):(.data.rel+0x54): undefined
reference to `__gcov_merge_ior'
collect2: ld returned 1 exit status
winegcc: gcc failed
make[2]: *** [acledit.dll.so] Error 2
make[2]: Leaving directory `/home/austin/wine-git/dlls/acledit'
make[1]: *** [acledit] Error 2
make[1]: Leaving directory `/home/austin/wine-git/dlls'
make: *** [dlls] Error 2


--
-Austin
dawnzky05
Newbie
Newbie
Posts: 1
Joined: Sun Feb 15, 2009 12:06 am

Post by dawnzky05 »

How was the error? Have you corrected it already? I am interested to build a profile generation too.




---------------------
taste of life
Ema
Level 2
Level 2
Posts: 19
Joined: Fri Feb 13, 2009 6:58 pm

Post by Ema »

I have the following:

Code: Select all

./configure CFLAGS="-O2 -fprofile-generate" LDFLAGS="-fprofile-generate" --prefix=/home/ema/winepf
OK

Code: Select all

make depend
OK

Code: Select all

make -j2
OK - using dual core

Code: Select all

gcc -c -I. -I. -I../../include -I../../include  -D__WINESRC__  -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wtype-limits -Wpointer-arith  -O2 -fprofile-generate  -o main.o main.c
../../tools/winegcc/winegcc  -B../../tools/winebuild -shared ./acledit.spec    main.o       -o acledit.dll.so  -lkernel32  ../../libs/port/libwine_port.a  -fprofile-generate 
main.o: In function `FMExtensionProcW':
main.c:(.text+0x49): undefined reference to `__gcov_indirect_call_profiler'
main.o: In function `DllMain':
main.c:(.text+0x114): undefined reference to `__gcov_indirect_call_profiler'
main.o: In function `global constructors keyed to 65535_0_main.c':
main.c:(.text+0x21c): undefined reference to `__gcov_init'
main.o:(.data.rel+0x24): undefined reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(dll_entry.o): In function `__wine_spec_dll_entry':
dll_entry.c:(.text+0x4e): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(dll_entry.o): In function `global constructors keyed to 65535_0_dll_entry.c':
dll_entry.c:(.text+0x19c): undefined reference to `__gcov_init'
../../dlls/winecrt0/libwinecrt0.a(dll_entry.o):(.data.rel+0x24): undefined reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(init.o): In function `__wine_spec_init':
init.c:(.text+0x40): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(init.o): In function `__wine_spec_init_ctor':
init.c:(.text+0xd0): undefined reference to `__gcov_indirect_call_profiler'
init.c:(.text+0x12c): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(init.o): In function `global constructors keyed to 65535_0_init.c':
init.c:(.text+0x1ac): undefined reference to `__gcov_init'
../../dlls/winecrt0/libwinecrt0.a(init.o):(.data.rel+0x24): undefined reference to `__gcov_merge_add'
../../dlls/winecrt0/libwinecrt0.a(stub.o): In function `__wine_spec_unimplemented_stub':
stub.c:(.text+0x44): undefined reference to `__gcov_indirect_call_profiler'
../../dlls/winecrt0/libwinecrt0.a(stub.o): In function `global constructors keyed to 65535_0_stub.c':
stub.c:(.text+0xbc): undefined reference to `__gcov_init'
../../dlls/winecrt0/libwinecrt0.a(stub.o):(.data.rel+0x24): undefined reference to `__gcov_merge_add'
collect2: ld returned 1 exit status
winegcc: gcc failed
make[2]: *** [acledit.dll.so] Error 2
make[2]: Leaving directory `/home/ema/wine-git/dlls/acledit'
make[1]: *** [acledit/__install__] Error 2
make[1]: Leaving directory `/home/ema/wine-git/dlls'
make: *** [dlls/__install__] Error 2
Failed

Anyone knows why?
Cheers,

edit

I has a fast look and could be that the issue is within winegcc?
Tbh I don't know exactly why wine uses winegcc (should be a wrapper to fake mingw?) to compile instead of gcc/g++ directly, but probably isn't that option not supported in winegcc and isn't passed to the linker?
Ema
Level 2
Level 2
Posts: 19
Joined: Fri Feb 13, 2009 6:58 pm

Post by Ema »

Guys, any news?
Anyone does know how to make it run?

Cheers,
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

Note that oprofile works fine in combination with Wine it doesn't require patching. Sometimes I also used gprof for some more detailed profiling and for that I added the -pg option to the cflags of the wine dlls I wanted to analyze. I don't think you can build all wine parts with such options on.
Ema
Level 2
Level 2
Posts: 19
Joined: Fri Feb 13, 2009 6:58 pm

Post by Ema »

With -fprofile-generate you start using tree and gcc/g++ will optimize analyzing those as well. Oprofile is old technology compared to this one.

Cheers,
Ema
Level 2
Level 2
Posts: 19
Joined: Fri Feb 13, 2009 6:58 pm

Post by Ema »

Thunderbird wrote:Note that oprofile works fine in combination with Wine it doesn't require patching. Sometimes I also used gprof for some more detailed profiling and for that I added the -pg option to the cflags of the wine dlls I wanted to analyze. I don't think you can build all wine parts with such options on.
Should I profile the single DLLs then in your opinion?

Cheers,
Locked