Open flaviu22 opened 4 years ago
https://github.com/cgsecurity/testdisk_documentation/blob/master/compilation_env.rst have a detailed listed of package for various Linux distribution but not for cygwin. autoconf, autogen, automake are required...
Have not been able to build for Windows but here are the steps I took and where I stopped. With the cygwin installer you need to install: autoconf, autogen, make, automake, jpeg
Then install mingw and add it to the PATH on the cygwin terminal:
export PATH=$PATH:"/cygdrive/K/my_random_tools/mingw64/bin"
And then run:
autoreconf --install -W all -I config
Then:
./configure
And this is where I get the following problem (it can't find curses / wcurses library, despite it being installed with cygwin)
$ ./configure
checking build system type... x86_64-pc-cygwin
checking host system type... x86_64-pc-cygwin
checking target system type... x86_64-pc-cygwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether sleep supports fractional seconds... yes
checking filesystem timestamp resolution... 0.01
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking xargs -n works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking dependency style of g++... gcc3
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for windres... /cygdrive/K/Descargas/mingw64/bin/windres
checking for gcc option to enable large file support... -D_FILE_OFFSET_BITS=64
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for sys/wait.h that is POSIX.1 compatible... no
checking for byteswap.h... no
checking for curses.h... no
checking for cygwin/fs.h... no
checking for cygwin/version.h... no
checking for dal/file_dal.h... no
checking for dal/file.h... no
checking for ddk/ntddstor.h... no
checking for dirent.h... yes
checking for endian.h... no
checking for errno.h... yes
checking for fcntl.h... yes
checking for features.h... no
checking for giconv.h... no
checking for glob.h... no
checking for iconv.h... yes
checking for io.h... yes
checking for libgen.h... yes
checking for limits.h... yes
checking for linux/fs.h... no
checking for linux/hdreg.h... no
checking for linux/types.h... no
checking for locale.h... yes
checking for machine/endian.h... no
checking for malloc.h... yes
checking for ncurses.h... no
checking for ncurses/curses.h... no
checking for ncurses/ncurses.h... no
checking for ncursesw/curses.h... no
checking for ncursesw/ncurses.h... no
checking for ntfs/version.h... no
checking for pwd.h... no
checking for scsi/scsi.h... no
checking for scsi/scsi_ioctl.h... no
checking for scsi/sg.h... no
checking for setjmp.h... yes
checking for signal.h... yes
checking for stdarg.h... yes
checking for sys/cygwin.h... no
checking for sys/disk.h... no
checking for sys/disklabel.h... no
checking for sys/dkio.h... no
checking for sys/endian.h... no
checking for sys/ioctl.h... no
checking for sys/param.h... yes
checking for sys/select.h... no
checking for sys/time.h... yes
checking for sys/utsname.h... no
checking for sys/vtoc.h... no
checking for time.h... yes
checking for utime.h... yes
checking for w32api/ddk/ntdddisk.h... no
checking for windef.h... yes
checking for windows.h... yes
checking for zlib.h... yes
checking iconv support... yes, in libc
checking for sys/mount.h... no
checking for winbase.h... yes
checking for winioctl.h... yes
checking for w32api/winioctl.h... no
checking for ext2fs/ext2_fs.h... no
checking for ext2fs/ext2fs.h... no
configure: WARNING: Disable use of ext2fs library
checking for off64_t... yes
checking for libewf.h... no
configure: WARNING: Disable use of ewf library
checking for jpeglib.h... no
configure: WARNING: Disable use of jpeg library
checking for ntfs/attrib.h... no
configure: WARNING: Disable use of ntfs library
checking for ntfs/volume.h... no
configure: WARNING: Disable use of ntfs library
checking for ntfs-3g/attrib.h... no
configure: WARNING: Disable use of ntfs3g library
checking for ntfs-3g/volume.h... no
configure: WARNING: Disable use of ntfs3g library
checking for an ANSI C-conforming const... yes
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking for struct stat.st_blocks... no
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct stat.st_blksize... no
checking for struct stat.st_rdev... yes
checking for dal_t.block_size... no
checking for dal_t.error... no
checking for dal_t.entity... no
checking for dal_t.name... no
checking for struct dal_ops.dev... no
checking for struct struct_io_manager.set_option... no
checking for struct struct_io_manager.read_blk64... no
checking for struct struct_io_manager.write_blk64... no
checking for struct tm.tm_gmtoff... no
checking for initscr in -lncursesw... no
checking for initscr in -lncurses... no
checking for initscr in -lpdcurses... no
checking for initscr in -lcurses... no
configure: error: At least one of ncursesw/ncurses/pdcurses/curses library must be present
:(
Also, there doesn't seem to be an option in the cygwin repos to install the NTFS libs (ntfs3g) which I guess is an important addon for TestDisk
I was able to get past the configure step by doing:
./configure --without-ncurses
Since there isn't an easy way to make autoconf detect the cygwin ncurses install
With this I can make
it into the actual build stage which fails at:
make[3]: Entering directory '/cygdrive/k/build/testdisk/man'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/cygdrive/k/build/testdisk/man'
make[2]: Leaving directory '/cygdrive/k/build/testdisk/man'
Making all in src
make[2]: Entering directory '/cygdrive/k/build/testdisk/src'
CC adv.o
adv.c: In function 'adv_menu_image_selected':
adv.c:381:13: error: passing argument 1 of 'td_getcwd' from incompatible pointer type [-Wincompatible-pointer-types]
381 | td_getcwd(&dst_path, sizeof(dst_path));
| ^~~~~~~~~
| |
| char (*)[4096]
In file included from adv.c:62:
askloc.h:38:23: note: expected 'char *' but argument is of type 'char (*)[4096]'
38 | char *td_getcwd(char *buf, unsigned long size);
| ~~~~~~^~~
adv.c:365:88: warning: unused parameter 'current_cmd' [-Wunused-parameter]
365 | static void adv_menu_image_selected(disk_t *disk, const partition_t *partition, char **current_cmd)
| ~~~~~~~^~~~~~~~~~~
adv.c: In function 'interface_adv':
adv.c:456:7: warning: variable 'rewrite' set but not used [-Wunused-but-set-variable]
456 | int rewrite=1;
| ^~~~~~~
adv.c: At top level:
adv.c:120:12: warning: 'is_exfat' defined but not used [-Wunused-function]
120 | static int is_exfat(const partition_t *partition)
| ^~~~~~~~
make[2]: *** [Makefile:2237: adv.o] Error 1
make[2]: Leaving directory '/cygdrive/k/build/testdisk/src'
make[1]: *** [Makefile:455: all-recursive] Error 1
make[1]: Leaving directory '/cygdrive/k/build/testdisk'
make: *** [Makefile:394: all] Error 2
My compiler version on cygwin are:
$ gcc -v
Using built-in specs.
COLLECT_GCC=K:\Descargas\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=K:/Descargas/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/14.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-14.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/buildroot/x86_64-1410-posix-seh-msvcrt-rt_v12-rev0/mingw64 --enable-host-shared --disable-multilib --en
able-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesy
stem-ts=yes --disable-libssp --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --
with-system-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86_64-w64-mingw32-stat
ic --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-Builds project' --with-bugurl=https://github.com/niXman/mingw-builds LD_FOR_TARGET=/c/buildroot/x86_64-1410-posix-seh-msvcrt-rt_v12-rev0/mingw64/bin/ld.exe --with-boot-ldflags='-pipe -fno-ident -L/c/buildroot/x8
6_64-1410-posix-seh-msvcrt-rt_v12-rev0/mingw64/opt/lib -L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/x86_64-w64-mingw32-static/lib -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.1.0 (x86_64-posix-seh-rev0, Built by MinGW-Builds project)
Currently trying to see if it's just enough to pass -Wincompatible-pointer-types
to the configure script file, but doesn't look straightforward
@pedro-javierf Thanks for the PR. Do not forget to install libncurses-devel. Do you find the ncurses.h files installed by cygwin ?
@cgsecurity I am struggling with it still. I have installed libncurses-devel as well as some of the others
I haven't found the ncurses.h files installed by cygwin no, however
now, I'm passing --with-ncurses-includes=/usr/lib
to ./configure, and these are the contents of /usr/lib directory:
$ ls /usr/lib/*curses*
/usr/lib/libcurses.a /usr/lib/libcurses.dll.a /usr/lib/libncurses++.a /usr/lib/libncurses++.dll.a /usr/lib/libncurses++w.a /usr/lib/libncurses++w.dll.a /usr/lib/libncurses.a /usr/lib/libncurses.dll.a /usr/lib/libncursesw.a /usr/lib/libncursesw.dll.a
Which seems to suppress errors in the configure step, as now I see:
checking for machine/endian.h... yes
checking for malloc.h... yes
checking for ncurses.h... yes
checking for ncurses/curses.h... yes
checking for ncurses/ncurses.h... yes
checking for ncursesw/curses.h... yes
checking for ncursesw/ncurses.h... yes
checking for ntfs/version.h... no
So the configure script is definitely finding the libraries and .h headers.
However, I get missing symbols during compilation. All the ncurses symbols are missing.
Oddly, gcc/g++ seems to be finding the libraries (i.e.: running gcc -lncurses
).
Any idea of what could be happening? Thank you!!
change a different version of testdisk,then I compile success. 7.1 or 7.0 try it.
I have read and applied the test disk documentation for compiling for windows:
I have installed cygwin for windows, successfully.
3.3.2 Compilation from git repository git clone https://git.cgsecurity.org/testdisk.git cd testdisk mkdir config autoreconf --install -W all -I config <---- error:
Obviously, I have to install something else, but what ? I don't find in the pdf documentation anything else to install in order to compile it ...