Unable to build gdal in x64

I am trying to build GDAL (1.9.2) on x64.

In the instructions, I see:

# Uncomment the following if you are building for 64-bit windows # (x64). You'll need to have PATH, INCLUDE and LIB set up for 64-bit # compiles. !IF "$(PLATFORM)" == "x64" WIN64=YES !ENDIF 

And then below

 # Under win64, symbols for function names lack the underscore prefix # present on win32. Also the STDCALL calling convention is not used. !IFDEF WIN64 !UNDEF STDCALL !ELSE SYM_PREFIX=_ !ENDIF 

Cannot find PATH, INCLUDE and LIB for x64 or anything else I have to do ...

I can build in Win32.

On x64, I get linker errors:

 LINK : error LNK2001: unresolved external symbol _OGRFeatureStylePuller LINK : error LNK2001: unresolved external symbol _OSRValidate ... gdal19.dll : fatal error LNK1120: 74 unresolved externals NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x460' 

I put (for assembly in Win32)

 !IFNDEF PLATFORM PLATFORM=WIN32 !ENDIF 

Changed to

 !IFNDEF PLATFORM PLATFORM=x64 !ENDIF 

(build in x64) - And it worked. But only if I build from within Visual Studio.

I would like to be able to use the bat file (and build the alll platform / configuration) The above - while it builds VS, it will not build from the command line (with the commands:

 start /b /wait nmake -f makefile.vc clean start /b /wait nmake.exe /f makefile.vc PLATFORM=x64 start /b /wait nmake.exe /f makefile.vc devinstall PLATFORM=x64 

The same thing happens in Win32 ...

I can’t understand what’s wrong ...

+4
source share
4 answers

To build using nmake using the command line, I had to run a command from a shell that has the appropriate variables set to build for 64 bits.

This is what I did to configure the 64-bit build environment:

call "C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ VC \ vcvarsall.bat" amd64

+3
source

I managed to create an x64 version of GDAL in Visual Studio 2012 using the steps from http://dominoc925.blogspot.ru/2013/03/build-64-bit-gdal-for-windows.html :

  • Download gdal-1.9.2.tar.gz (or another version of the sources) from http://download.osgeo.org/gdal/
  • Unzip to any directory, for example. C:\tmp\gdal-1.9.2\

    If you tried to create GDAL earlier (for example, x86), make sure that the build directory ( C:\warmerda\bld\ ) and the source directory are clean from the previous build attempt. If you are not sure, try unpacking the sources into a new directory.

  • Start VS2012 x64 Native Tools Command Prompt : Start → All Programs → Microsoft Visual Studio 2012 → Visual Studio Tools → Open VS2012 x64 Native Tools Command Prompt

    Or run %comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 ).

  • Change the directory to the directory with the unpacked GDAL sources:

     C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>cd /DC:\tmp\gdal-1.9.2 D:\trn4\gdal-1.9.2> 
  • GDAL assembly with development files:

     nmake /f makefile.vc MSVC_VER=1700 WIN64=YES nmake /f makefile.vc MSVC_VER=1700 WIN64=YES install nmake /f makefile.vc MSVC_VER=1700 WIN64=YES devinstall 

You can get the MSVC_VER number from here . GDAL will be built and installed on C:\warmerda\bld\ .

+10
source

First, you must somehow explain to the readers of this topic that during the 6 corrections you made, the focus of your question has changed more than once, as you can see from the history of changes

In any case: Now it's just a problem working with the vs ide assembly; try exporting makefile from VS

EXPORT! Don't just open the orginal makefile.vc package in an editor window!

save it under a name other than the package "makefile.vc" and use it in your batch.

+3
source

"I can build in Win32."

Were you created for Win32 before you tried Win64?

If yes, then pls visit http://trac.osgeo.org/gdal/ticket/4636 , at the bottom of the answer list:

Just to notice that someone else has a problem .. I will try to look more into this when I can .. but at the same time, a clean build is not really doing a “clean”, so make sure you manually deleted your files if you are doing a 32-bit build before your 64-bit build.

You can also try just extracting the source again in another directory to have a clean tree and try to build there for Win64.

+1
source

Source: https://habr.com/ru/post/1480524/


All Articles