2011/4/4 Kai Tietz <ktiet...@googlemail.com>:
> Put reply back to list
>
> 2011/4/4 Kai Tietz <ktiet...@googlemail.com>:
>> Your issue is that you don't specify on linking the -pg option.
>>
>> Regards,
>> Kai
>>
>> 2011/4/4 Alen Skondro <askon...@gmail.com>:
>>> On Mon, Apr 4, 2011 at 9:31 PM, Kai Tietz <ktiet...@googlemail.com> wrote:
>>>> 2011/4/4 Alen Skondro <askon...@gmail.com>:
>>>>> Hello, I've built my own gcc toolchain (4.6.1) targeting
>>>>> i686-w64-mingw32 and so far everything worked fine until I decided to
>>>>> use the profile functionality.
>>>>>
>>>>> When compiling with -p -pg, linker reports undefined references to 
>>>>> _monstartup.
>>>>> I looked in ming64 CRT and found out that  _monstartup is defined in
>>>>> gcrt0.c but never gets included in libgmon.a, as defined in
>>>>> Makefile.am.
>>>>> But for some reason gcc is eagerly looking for it.
>>>>>
>>>>> Is this a misunderstanding between gcc and mingw64 or something else?
>>>>>
>>>>> BTW I'm using mingw64 svn4105.
>>>>>
>>>>> best regards,
>>>>> Alen
>>>>
>>>> Hmm, curious about this. I just test i686-w64-mingw32 and
>>>> x86_64-w64-mingw32 toolchain with -p -pg and I get no link failure and
>>>> things are working as expected.
>>>> Could you provide me your command-line options, and are you using
>>>> trunk crt, or the 1.0 branch one?
>>>>
>>>> Regards,
>>>> Kai
>>>>
>>>
>>> I use the trunk crt (I never set-up branches so I guess I use the
>>> latest trunk)  - correct me if I'm wrong.
>>>
>>> Do you mean command options configuring mingw64 crt or command options
>>> used to compile my own application?
>>>
>>> For my application I use:
>>> =====================
>>>
>>> g++  -O0 -g3 -p -pg -pedantic -Wall -c -fmessage-length=0 -std=c++0x
>>> -fpermissive -o src\Object.o ..\src\Object.cpp
>>>
>>> mingw64 is configured as:
>>> =====================
>>>
>>> ../mingw64/configure --prefix=/mingw-native --host=i686-w64-mingw32
>>>
>>> gcc is configured as:
>>> =====================
>>>
>>> Using built-in specs.
>>> COLLECT_GCC=gcc
>>> COLLECT_LTO_WRAPPER=g:/dev-tools/mingw-native/bin/../libexec/gcc/i686-w64-mingw32/4.6.1/lto-wrapper.exe
>>> Target: i686-w64-mingw32
>>> Configured with: ../gcc/configure --target=i686-w64-mingw32
>>> --enable-languages=c,c++ --disable-nls --with-dwarf2
>>> --prefix=/mingw-native --dis
>>> able-multilib --host=i686-w64-mingw32 --with-gmp=/mingw-native
>>> --with-sysroot=/mingw-native --enable-libgomp
>>> Thread model: win32
>>> gcc version 4.6.1 20110404 (prerelease) (GCC)
>>>
>>> g++ linker error message:
>>> =====================
>>>
>>> g++ -LG:\DEV-TOOLS\boost_1_46_1\stage\lib
>>> -LG:\DEV-TOOLS\mingw-native\lib -Wl,--allow-multiple-definition -v -o
>>> test src\transform.o src\testlink.o src\tempobj.o src\network.o
>>> src\nested.o src\myPair.o src\main1.o src\glmain.o src\Object.o
>>> -lwsock32 -lboost_system-mgw46-mt-1_46_1
>>> -lboost_thread-mgw46-mt-1_46_1 -lglut -lglu32 -lopengl32 -lgmon
>>> Using built-in specs.
>>> COLLECT_GCC=g++
>>> COLLECT_LTO_WRAPPER=g:/dev-tools/mingw-native/bin/../libexec/gcc/i686-w64-mingw32/4.6.1/lto-wrapper.exe
>>> Target: i686-w64-mingw32
>>> Configured with: ../gcc/configure --target=i686-w64-mingw32
>>> --enable-languages=c,c++ --disable-nls --with-dwarf2
>>> --prefix=/mingw-native --disable-multilib --host=i686-w64-mingw32
>>> --with-gmp=/mingw-native --with-sysroot=/mingw-native --enable-libgomp
>>> Thread model: win32
>>> gcc version 4.6.1 20110404 (prerelease) (GCC)
>>> COMPILER_PATH=g:/dev-tools/mingw-native/bin/../libexec/gcc/i686-w64-mingw32/4.6.1/;g:/dev-tools/mingw-native/bin/../libexec/gcc/;g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../i686-w64-mingw32/bin/
>>> LIBRARY_PATH=g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/;g:/dev-tools/mingw-native/bin/../lib/gcc/;g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../i686-w64-mingw32/lib/../lib/;g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../lib/;g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../i686-w64-mingw32/lib/;g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../
>>> COLLECT_GCC_OPTIONS='-LG:\DEV-TOOLS\boost_1_46_1\stage\lib'
>>> '-LG:\DEV-TOOLS\mingw-native\lib' '-v' '-o' 'test.exe'
>>> '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
>>>  g:/dev-tools/mingw-native/bin/../libexec/gcc/i686-w64-mingw32/4.6.1/collect2.exe
>>> --sysroot=g:\dev-tools\mingw-native\bin\../../mingw-native -m i386pe
>>> -Bdynamic -o test.exe
>>> g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../i686-w64-mingw32/lib/../lib/crt2.o
>>> g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/crtbegin.o
>>> -LG:\DEV-TOOLS\boost_1_46_1\stage\lib -LG:\DEV-TOOLS\mingw-native\lib
>>> -Lg:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1
>>> -Lg:/dev-tools/mingw-native/bin/../lib/gcc
>>> -Lg:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../i686-w64-mingw32/lib/../lib
>>> -Lg:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../lib
>>> -Lg:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../../../i686-w64-mingw32/lib
>>> -Lg:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/../../..
>>> --allow-multiple-definition src\transform.o src\testlink.o
>>> src\tempobj.o src\network.o src\nested.o src\myPair.o src\main1.o
>>> src\glmain.o src\Object.o -lwsock32 -lboost_system-mgw46-mt-1_46_1
>>> -lboost_thread-mgw46-mt-1_46_1 -lglut -lglu32 -lopengl32 -lgmon
>>> -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt
>>> -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc
>>> -lmoldname -lmingwex -lmsvcrt
>>> g:/dev-tools/mingw-native/bin/../lib/gcc/i686-w64-mingw32/4.6.1/crtend.o
>>> src\main1.o: In function `main':
>>> G:\JAVA\WRKSPC_INDIGO_W32\test\Debug/../src/main1.cc:85: undefined
>>> reference to `_monstartup'
>>> collect2: ld returned 1 exit status
>>>
>>>
>>> regards,
>>> Alen
>>>

An other thing. You don't need to specify -lgmon. Just use -pg option.
It takes care that gcrt2,o gets linked, too.

Kai

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to