gperftools / gperftools

Main gperftools repository
BSD 3-Clause "New" or "Revised" License
8.42k stars 1.5k forks source link

../src/windows/config.h:12:10: fatal error: ../config.h: No such file or directory #1039

Open h0tc0d3 opened 6 years ago

h0tc0d3 commented 6 years ago

I use Arch linux and mingw-w64-gcc toolchain(https://aur.archlinux.org/packages/mingw-w64-gcc/). configure script use mingw-w64-configure (https://aur.archlinux.org/packages/mingw-w64-configure)

tar zxf gperftools-2.7.tar.gz cd gperftools-2.7 mkdir build cd build i686-w64-mingw32-configure --with-tcmalloc-pagesize=32 --disable-shared make

../src/malloc_extension.cc:261:12: warning: too many arguments for format [-Wformat-extra-args]
mv -f src/.deps/libtcmalloc_minimal_internal_la-malloc_extension.Tpo src/.deps/libtcmalloc_minimal_internal_la-malloc_extension.Plo
depbase=`echo src/windows/port.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CXX   --mode=compile i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I.. -I./src  -I../src -DNO_TCMALLOC_SAMPLES  -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -mmmx -fno-omit-frame-pointer -Wno-unused-result -fsized-deallocation -faligned-new   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/windows/port.lo -MD -MP -MF $depbase.Tpo -c -o src/windows/port.lo ../src/windows/port.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I.. -I./src -I../src -DNO_TCMALLOC_SAMPLES -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -mmmx -fno-omit-frame-pointer -Wno-unused-result -fsized-deallocation -faligned-new -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -MT src/windows/port.lo -MD -MP -MF src/windows/.deps/port.Tpo -c ../src/windows/port.cc -o src/windows/port.o
depbase=`echo src/windows/system-alloc.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CXX   --mode=compile i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I.. -I./src  -I../src -DNO_TCMALLOC_SAMPLES  -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -mmmx -fno-omit-frame-pointer -Wno-unused-result -fsized-deallocation -faligned-new   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/windows/system-alloc.lo -MD -MP -MF $depbase.Tpo -c -o src/windows/system-alloc.lo ../src/windows/system-alloc.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I.. -I./src -I../src -DNO_TCMALLOC_SAMPLES -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -mmmx -fno-omit-frame-pointer -Wno-unused-result -fsized-deallocation -faligned-new -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -MT src/windows/system-alloc.lo -MD -MP -MF src/windows/.deps/system-alloc.Tpo -c ../src/windows/system-alloc.cc -o src/windows/system-alloc.o
depbase=`echo src/windows/ia32_modrm_map.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CXX   --mode=compile i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I.. -I./src  -I../src -DNO_TCMALLOC_SAMPLES  -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -mmmx -fno-omit-frame-pointer -Wno-unused-result -fsized-deallocation -faligned-new   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/windows/ia32_modrm_map.lo -MD -MP -MF $depbase.Tpo -c -o src/windows/ia32_modrm_map.lo ../src/windows/ia32_modrm_map.cc &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I.. -I./src -I../src -DNO_TCMALLOC_SAMPLES -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc -fno-builtin-pvalloc -mmmx -fno-omit-frame-pointer -Wno-unused-result -fsized-deallocation -faligned-new -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -MT src/windows/ia32_modrm_map.lo -MD -MP -MF src/windows/.deps/ia32_modrm_map.Tpo -c ../src/windows/ia32_modrm_map.cc -o src/windows/ia32_modrm_map.o
In file included from ../src/windows/mini_disassembler.h:40,
                 from ../src/windows/ia32_modrm_map.cc:38:
../src/windows/config.h:12:10: fatal error: ../config.h: No such file or directory
 #include "../config.h"
          ^~~~~~~~~~~~~
compilation terminated.
h0tc0d3 commented 6 years ago

Compiled. tar zxf gperftools-2.7.tar.gz cd gperftools-2.7 mkdir build cd build i686-w64-mingw32-configure --with-tcmalloc-pagesize=32 --disable-shared cp src/config.h ../src/config.h make

But have another error

/usr/lib/gcc/i686-w64-mingw32/8.2.0/../../../../i686-w64-mingw32/bin/ld: CMakeFiles/QuikLua.dir/DllMain.cpp.o:DllMain.cpp:(.text$DllMain+0x0): multiple definition of `DllMain@12'; /usr/i686-w64-mingw32/lib/libtcmalloc_minimal.a(port.o):gperftools-2.7/build/../src/windows/port.cc:165: first defined here
collect2: error: ld returned 1 exit status
alk commented 6 years ago

Thanks. The issue seems to be building in different directory than source directory. Can you please test more traditional setup on your box ? My debian sid builds mingw target just fine in source directory and fails for same problem when I do build directory just like you.

alk commented 6 years ago

I know it is breaking the rules, but the following patch fixes it for my box:

diff --git a/src/windows/config.h b/src/windows/config.h
index e860bc3..bb5c36e 100644
--- a/src/windows/config.h
+++ b/src/windows/config.h
@@ -9,7 +9,7 @@
    unix config.h but also runs code in the windows directory.
    */
 #ifdef __MINGW32__
-#include "../config.h"
+#include <config.h>
 #define GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_
 #endif