2

What I really wanted is to build GDal, but that requires PROJ, which requires SQLite3. None of these are particularly user friendly when it comes to building. After 4 hours, I'm stuck. What I did so far:

  • download PROJ source
  • Download SQLite sqlite-amalgamation-3290000.zip source
  • Download sqlite-dll-win64-x64-3290000.zip .exe and .dll
  • In PROJ directory mkdir build and cd build
  • Run CMAKE with preset paths to SQLite:

    cmake -DSQLITE3_INCLUDE_DIR=D:\sqlite3\src -DSQLITE3_LIBRARY=D:\sqlite3\bin\sqlite3.dll ..
    
  • Then run build: cmake --build .
  • Compilation suceeds but link fails

The error:

  Building Custom Rule D:/proj-6.1.1/test/unit/CMakeLists.txt
  main.cpp
  proj_errno_string_test.cpp
  Generating Code...
D:\sqlite3\bin\sqlite3.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x360 [
D:\proj-6.1.1\build\test\unit\proj_errno_string_test.vcxproj]

I don't know what the problem is. Maybe the .dll is not compatible? Maybe it should be .lib? None of that is documented in PROJ.

Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
  • `-DSQLITE3_LIBRARY=D:\sqlite3\bin\sqlite3.dll` shouldn't that be a `.lib` file (possibly an import library). You don't link `dlls` – drescherjm Aug 22 '19 at 14:52
  • @drescherjm That's one theory, but then in the compilation instructions they set it to `sqlite3.so`, which I thought is shared library on Linux. Anyway, I don't know where to get `sqlite3.lib`. – Tomáš Zato Aug 22 '19 at 14:56
  • 1
    https://stackoverflow.com/questions/23718146/creating-an-sqlite3-lib-file-using-sqlite3-in-visual-studios I think the comment here: https://stackoverflow.com/questions/23718146/creating-an-sqlite3-lib-file-using-sqlite3-in-visual-studios#comment48229487_23718146 is helpful – drescherjm Aug 22 '19 at 15:02
  • 1
    There is also a port for proj4 in vcpkg. https://github.com/microsoft/vcpkg/tree/master/ports/proj4 – drescherjm Aug 22 '19 at 15:13
  • @drescherjm Thanks a lot, I will check it out as soon as I get home! – Tomáš Zato Aug 22 '19 at 15:37

1 Answers1

1

I hit this too -- the PROJ docs are showing Linux info in the Windows section!

From the directory with sqlite3.dll and sqlite3.def in the appropriate MSVC console run:

lib /def:sqlite3.def

to generate the import library and give that to cmake as the SQLITE3_LIBRARY define.

fjorder
  • 21
  • 2