Re: Building GDAL, file format not recognized

Surendrakumar Dandru via gdal-dev <[email protected]>
Newsgroups gmane.comp.gis.gdal.devel
Message-ID <CACUrS0Df4+k+72gM6crByFX2hiZULjhqwWgWXLdEf7Us372JXQ@mail.gmail.com>
The issue you’re encountering is due to passing directory paths instead of
actual library files to CMake for GEOS and CURL. While CMake accepts these
inputs during configuration, the linker (ld) expects specific library files
(such as .so or .a), not directories, hence the “file format not
recognized” error during the build stage.

You have specified:


   -

   GEOS_LIBRARY=/home/mazianos/build/geos-3.14.1/lib
   -

   CURL_LIBRARY_RELEASE=/home/mazianos/build/curl/lib


These should instead point to the actual library files inside those
directories or rather than hardcoding conside using this to let cmake
automatically detect its dependencies.

CMAKE_PREFIX_PATH= "path1;path2"

Thanks,

Surendrakumar

Geowgs84 Geospatial solutions





On Tue, 24 Mar 2026 at 3:55 AM, Even Rouault via gdal-dev <
[email protected]> wrote:

> The various xxx_LIBRARY CMake variables must point to the libXXXX.so file,
> not just the directory where it is.
> Le 23/03/2026 à 23:16, Mazin Marwan via gdal-dev a écrit :
>
> Hello all,
>
> I'm trying to build GDAL with GEOS and Curl among other packages and I'm
> running into an error when trying to run "cmake --build ."
>
> [ 96%] Built target gcore_mdreader
> [ 96%] Linking CXX shared library libgdal.so
> /usr/bin/ld: cannot find /home/mazianos/build/curl/lib: file format not
> recognized
> /usr/bin/ld: cannot find /home/mazianos/build/geos-3.14.1/lib: file format
> not recognized
> /usr/bin/ld: cannot find /home/mazianos/build/geos-3.14.1/lib: file format
> not recognized
> /usr/bin/ld: cannot find /home/mazianos/build/geos-3.14.1/lib: file format
> not recognized
> /usr/bin/ld: cannot find /home/mazianos/build/geos-3.14.1/lib: file format
> not recognized
> collect2: error: ld returned 1 exit status
> gmake[2]: *** [CMakeFiles/GDAL.dir/build.make:2788: libgdal.so.38.3.12.2]
> Error 1
> gmake[1]: *** [CMakeFiles/Makefile2:3352: CMakeFiles/GDAL.dir/all] Error 2
> gmake: *** [Makefile:146: all] Error 2
>
> I'm not sure what's causing this, but I had previously ran
> sudo cmake -DGEOS_INCLUDE_DIR=/home/mazianos/build/geos-3.14.1/include \
> -DGEOS_LIBRARY=/home/mazianos/build/geos-3.14.1/lib \
> -DGDAL_USE_HDF5=ON \
> -DEXPAT_INCLUDE_DIR=/home/mazianos/build/expat/include \
> -DEXPAT_LIBRARY=/home/mazianos/build/expat/lib \
> -DCURL_INCLUDE_DIR=/home/mazianos/build/curl/include \
> -DCURL_LIBRARY_RELEASE=/home/mazianos/build/curl/lib \
> -DCMAKE_BUILD_TYPE=Release ..
> successfully, so it's able to find geos and curl.
>
> Any ideas on what I may have done wrong on the way to this point would be
> appreciated.
>
> _______________________________________________
> gdal-dev mailing [email protected]://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> gdal-dev mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.