gdal icon indicating copy to clipboard operation
gdal copied to clipboard

OSX 11.4 build from master: failing to link with "Undefined symbols" from GIFDataset

Open direvus opened this issue 3 years ago • 4 comments

Expected behavior and actual behavior.

I am attempting to build gdal from a local clone of the github repo, on MacOS 11.4. make -j8 -s fails with the following error messages:

ld: warning: dylib (/opt/local/lib/libheif.dylib) was built for newer macOS version (11.3) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libzstd.dylib) was built for newer macOS version (11.3) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libtiff.dylib) was built for newer macOS version (11.2) than being linked (11.0)
Undefined symbols for architecture x86_64:
  "_GifFreeMapObject", referenced from:
      GIFDataset::CreateCopy(char const*, GDALDataset*, int, char**, int (*)(double, char const*, void*), void*) in gifdataset.o
  "_GifMakeMapObject", referenced from:
      GIFDataset::CreateCopy(char const*, GDALDataset*, int, char**, int (*)(double, char const*, void*), void*) in gifdataset.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libgdal.la] Error 1
make: *** [check-lib] Error 2

These symptoms seem to be eerily similar to #938, though that was reported as fixed years ago, so I'm not sure whether it is actually related.

Steps to reproduce the problem.

  1. Clone the gdal repo locally
  2. cd gdal/gdal
  3. ./configure --with-python
  4. make -j8 -s

I have also tried configure --with-gif=internal / external, same results.

Operating system

MacOS 11.4 Darwin kernel version 20.5.0 x86_64 MacPorts 2.7.1 giflib 4.2.3 from MacPorts

GDAL version and provenance

master from github, as at commit 961851a87be13289916eb9705616078a652682ab

Also tried with branches release/3.3 and release/3.2, same results.

direvus avatar Jun 04 '21 04:06 direvus

Did you "make clean" after changing the ./configure options, before rebuilding ? It could help also if you redirected the build log to a file and extract the line where gifdataset.cpp is compiled

rouault avatar Jun 04 '21 11:06 rouault

I did make clean between rebuilds, yes. I'll see about capturing the build log for gifdataset next time, thanks.

direvus avatar Jun 04 '21 12:06 direvus

Hi @rouault I've got the line from the build log for you:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C gif install-obj
/bin/sh /Users/brendanjurd/src/gdal/gdal/libtool --mode=compile --silent --tag=CXX g++ -std=c++11 -I/Users/brendanjurd/src/gdal/gdal/port -I/Users/brendanjurd/src/gdal/gdal/gcore -I/Users/brendanjurd/src/gdal/gdal/alg -I/Users/brendanjurd/src/gdal/gdal/ogr -I/Users/brendanjurd/src/gdal/gdal/ogr/ogrsf_frmts -I/Users/brendanjurd/src/gdal/gdal/gnm -I/Users/brendanjurd/src/gdal/gdal/apps -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2  -Wall -Wextra -Winit-self -Wunused-parameter -Wformat -Werror=format-security -Wno-format-nonliteral -Wshorten-64-to-32 -Wshadow -Wmissing-include-dirs -Werror=vla -Wdate-time -Wnull-dereference -Wextra-semi -Wcomma -Wfloat-conversion -Wdocumentation -Wno-documentation-deprecated-sync -Wunused-private-field -Wmissing-declarations -Wnon-virtual-dtor -Woverloaded-virtual -fno-operator-names -Wzero-as-null-pointer-constant -Wsuggest-override -Wimplicit-fallthrough   -DGNM_ENABLED -I/Users/brendanjurd/src/gdal/gdal/port -I/opt/local/include/openjpeg-2.4 -I/usr/local/Cellar/netcdf/4.7.4_2/include  -DGDAL_COMPILATION -DHAVE_XERCES -I/usr/local/include -I/usr/local/include/xercesc -I/Users/brendanjurd/src/gdal/gdal/port -I/opt/local/include/openjpeg-2.4 -I/usr/local/Cellar/netcdf/4.7.4_2/include  -DGDAL_COMPILATION -c -o ../o/gifdataset.lo gifdataset.cpp

Hope that is helpful, let me know if there is any other info you need from me.

direvus avatar Jun 07 '21 01:06 direvus

This remains broken for me as of MacOS 11.6 and master d77cda87ea. I did a little digging and read that the giflib API had changed between major versions 4 and 5, so tried to link against a homebrew install of giflib (5.2.1) with no change in the outcome.

The only way I can get gdal to build at all is to disable gif support entirely (--with-gif=no)

direvus avatar Nov 05 '21 05:11 direvus

closing as autoconf has been removed from master and replaced by cmake

rouault avatar Aug 18 '22 16:08 rouault