EXPORT LDFLAGS=-pg
./configure debugflags=”-pg -g” # note — might need to for sure not –enable-shared
make
edit Makefile, add -pg to LDFLAGS, possibly to the lines around it, too
make
make install
EXPORT LDFLAGS=-pg
./configure debugflags=”-pg -g” # note — might need to for sure not –enable-shared
make
edit Makefile, add -pg to LDFLAGS, possibly to the lines around it, too
make
make install
on mingw by default you’ll get
sh-3.1$ make
gcc -shared -Wl,–enable-auto-image-base,–enable-auto-import -Wl,–out-implib=libmsvcrt-ruby191.dll.a msvcrt-ruby191.def dln.o encoding.o prelude.o array.o bignum.o class.o compar.o complex.o dir.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o version.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o langinfo.o fileblocks.o crypt.o lgamma_r.o strlcpy.o strlcat.o win32.o dmyext.o msvcrt-ruby191.res.o -lshell32 -lws2_32 -o msvcrt-ruby191.dll
Creating library file: libmsvcrt-ruby191.dll.a
dln.o: In function `fprintf’:
C:/installs/build_env/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdio.h:243: undefined reference to `mcount’
dln.o: In function `sprintf’:
C:/installs/build_env/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/stdio.h:263: undefined reference to `mcount’
dln.o: In function `dln_load’:
C:/dev/ruby/downloads/ruby_trunk/dln.c:1206: undefined reference to `mcount’
dln.o: In function `dln_find_1′:
C:/dev/ruby/downloads/ruby_trunk/dln.c:1521: undefined reference to `mcount’
dln.o: In function `dln_find_file_r’:
C:/dev/ruby/downloads/ruby_trunk/dln.c:1499: undefined reference to `mcount’
dln.o:C:/dev/ruby/downloads/ruby_trunk/dln.c:1514: more undefined references to `mcount’ follow
collect2: ld returned 1 exit status
make: *** [msvcrt-ruby191.dll] Error 1
which means “you need to link with -pg, too!” (LDFLAGS and all its siblings, within Makefile)
ref:
http://lists-archives.org/mingw-users/01285-profiling-trouble-_monstartup-undefined.html
may want/need to edit Makefile and adding -pg to makefile, enc.mk
gcc -shared -o .ext/i386-mingw32/enc/encdb.so enc/encdb.o -L. -L. -L. -Wl,–enable-auto-image-base,–enable-auto-import -lmsvcrt-ruby191 -lshell32 -lws2_32
enc/encdb.o: In function `Init_encdb’:
C:/dev/ruby/downloads/ruby_trunk/./enc/encdb.c:23: undefined reference to `mcount’
collect2: ld returned 1 exit status
make[1]: *** [.ext/i386-mingw32/enc/encdb.so] Error 1
meant “add -pg next to -lws2_32 in enc.mk”
http://github.com/hogelog/ruby-1.9.1-p0/tree/ee0f53e2559af9b564176f000ec4cd35e01ec06a/sample/_gprof_out
http://www.igvita.com/2009/06/13/profiling-ruby-with-googles-perftools/
note: to see any outputs you’ll want to analyze like
C:> gprof msvcrt-ruby191.dll gmon.out