I'm running into the same issue as #351 and #501 but am having no luck solving it. Any advice?
Commands (Output attached as .txt)
cd C:/Users/iisdr/OneDrive/Documents/Coding Projects/td/
mkdir jnibuild
cd jnibuild
cmake -DTD_ENABLE_JNI=ON -DGPERF_EXECUTABLE:FILEPATH="C:\Program Files\gperf-3.1\src\gperf.exe" -x64 -DCMAKE_TOOLCHAIN_FILE="C:\Users\iisdr\OneDrive\Documents\Coding Projects\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td ..
cmake --build . --target install
cd "C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\example\java"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR="C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\example\java\td\lib\cmake\Td" -DCMAKE_INSTALL_PREFIX:PATH=.. ..
Error
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "FindTd.cmake" in CMAKE_MODULE_PATH this project has asked
CMake to find a package configuration file provided by "Td", but CMake did
not find one.
Could not find a package configuration file provided by "Td" with any of
the following names:
TdConfig.cmake
td-config.cmake
Add the installation prefix of "Td" to CMAKE_PREFIX_PATH or set "Td_DIR" to
a directory containing one of the above files. If "Td" provides a separate
development package or SDK, be sure it has been installed.
You have a problem with gperf:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,
5): error MSB6006: "cmd.exe" exited with code -1073741701. [C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\jnibui
ld\tdutils\generate\tdmime_auto.vcxproj]
Could you try to manually run from the C:/Users/iisdr/OneDrive/Documents/Coding Projects/td/tdutils/generate/ directory command
powershell -ExecutionPolicy ByPass " & 'C:\Program Files\gperf-3.1\src\gperf.exe' -m100 --output-file=auto/mime_type_to_extension.cpp auto/mime_type_to_extension.gperf"
to see exact error message?
Nothing printed to console, or is there a file I need to look at??
If the command works for some time and then exits without error message, then the command is likely right.
I also see no errors in the cmake invocations.
Could you check that file C:/Users/iisdr/OneDrive/Documents/Coding Projects/td/jnibuild/CMakeCache.txt contains line
GPERF_EXECUTABLE:FILEPATH=C:/Program Files/gperf-3.1/src/gperf.exe
If not, you can edit it manually and re-run cmake --build . --target install command.
And if the line is there and is exactly like this, then you can try to add C:/Program Files/gperf-3.1/src/ to PATH environment variable, remove jnibuild folder, launch new console to grab new environment and repeat building from scratch without explicit passing of GPERF_EXECUTABLE variable.
The CMakeCache.txt had the correct line, so I went ahead and removed the file, added "gperf-3.1/src/" to the PATH and removed the line. Same output when running the command.
I made gperf and got this error during the make check.
make[1]: *** [Makefile:143: check-test] Error 1
make[1]: Leaving directory '/cygdrive/c/Program Files/gperf-3.1/tests'
make: *** [Makefile:59: check] Error 2
This is my first use of gperf, and I am not sure if this is an issue or not. make install still seems like it completed correctly and the .exe was made.
Have you tried to delete jnibuild directory and begin compilation from scratch?
The error -1073741701 is 0xC000007B (STATUS_INVALID_IMAGE_FORMAT), which suggest that something is wrong with gperf executable.
If rebuilding wouldn't help, I suggest to install gperf from https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/ and use it instead. By default, it will be installed to C:/Program Files (x86)/GnuWin32/bin/gperf.exe.
Yep, I deleted both jnibuild and example/java/build before re-running Cmake, with /gperf-3.1/src in the PATH instead of gperf.exe in the command. That was both before and after re-running the make clean - > make install for gperf
I must apologize for the delay. I just notice I never commented :/
Thank you for your help so far. Not sure how far I would have gotten elsewise.
So I installed the gperf from Source Forge and progress!!!! It ran successfully, but that is when I noticed I had my x64 tag incorrect ( -x64 vs -A x64) and now I am getting a different error.
Commands Ran
cd C:/Users/iisdr/OneDrive/Documents/Coding Projects/td/
mkdir jnibuild
cd jnibuild
cmake -DTD_ENABLE_JNI=ON -A x64 -DCMAKE_TOOLCHAIN_FILE="C:\Users\iisdr\OneDrive\Documents\Coding Projects\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td ..
cmake --build . --target install
cd "C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\example\java"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR="C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\example\java\td\lib\cmake\Td" -DCMAKE_INSTALL_PREFIX:PATH=.. ..
cmake --build . --target install
pause
Error
CMake Error at CMakeLists.txt:5 (find_package):
Could not find a configuration file for package "Td" that is compatible
with requested version "".
The following configuration files were considered but not accepted:
C:/Users/iisdr/OneDrive/Documents/Coding Projects/td/example/java/td/lib/cmake/Td/TdConfig.cmake, version: 1.3.0 (64bit)
-- Configuring incomplete, errors occurred!
See also "C:/Users/iisdr/OneDrive/Documents/Coding Projects/td/example/java/build/CMakeFiles/CMakeOutput.log".
C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\example\java\build>cmake --build . --target install
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: install.vcxproj
Not sure if this is correct either
base64.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xutility(2903): warning
C4244: '=': conversion from 'const _Ty' to '_Ty', possible loss of data [C:\Users\iisdr\OneDrive\Documents\Coding Proj
ects\td\jnibuild\tdutils\tdutils.vcxproj]
with
[
_Ty=int
]
and
[
_Ty=unsigned char
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xutility(2917): note:
see reference to function template instantiation 'void std::_Fill_unchecked1<_FwdIt,_Ty>(_FwdIt,_FwdIt,const _Ty &,s
td::false_type)' being compiled
with
[
_FwdIt=unsigned char *,
_Ty=int
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xutility(2925): note:
see reference to function template instantiation 'void std::_Fill_unchecked<_Ty*,int>(_FwdIt,_FwdIt,const int &)' be
ing compiled
with
[
_Ty=unsigned char,
_FwdIt=unsigned char *
]
C:\Users\iisdr\OneDrive\Documents\Coding Projects\td\tdutils\td\utils\base64.cpp(138): note: see reference to functio
n template instantiation 'void std::fill<_Ty*,int>(_FwdIt,_FwdIt,const int &)' being compiled
with
[
_Ty=unsigned char,
_FwdIt=unsigned char *
]
The cause of the error is that you have built 64-bit TDLib, so you need to build 64-bit JNI-wrapper and to specify -A x64 also on the second cmake configuration invocation in td\example\java.
One more thing: to build in Release mode with MSVC you need to specify --target Release during build step and using -DCMAKE_BUILD_TYPE=Release during configuration step has no effect for MSVC.
Awesome that worked.
General note to anyone else using windows: I had to copy .libs from \vcpkg\installed\x64-windows\bin into td\example\java\bin .
Thanks again for your help @levlam!!
Most helpful comment
The error -1073741701 is 0xC000007B (STATUS_INVALID_IMAGE_FORMAT), which suggest that something is wrong with gperf executable.
If rebuilding wouldn't help, I suggest to install gperf from https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/ and use it instead. By default, it will be installed to
C:/Program Files (x86)/GnuWin32/bin/gperf.exe.