Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol not found: _iconv #31576

Closed
aberenyi opened this issue Sep 5, 2019 · 35 comments
Closed

Symbol not found: _iconv #31576

aberenyi opened this issue Sep 5, 2019 · 35 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers macOS

Comments

@aberenyi
Copy link

aberenyi commented Sep 5, 2019

Describe the bug

GDAL/OGR and occasionally SAGA processing scripts tend to fail with the following error

Symbol not found: _iconv

How to Reproduce

Processing / GDAL / Raster Misc / Merge results in

Traceback (most recent call last):

File "/Applications/QGIS3.8.app/Contents/MacOS/bin/gdal_merge.py", line 38, in <module>

from osgeo import gdal

File "/Applications/QGIS3.8.app/Contents/Resources/python/osgeo/__init__.py", line 21, in <module>

_gdal = swig_import_helper()

File "/Applications/QGIS3.8.app/Contents/Resources/python/osgeo/__init__.py", line 17, in swig_import_helper

_mod = imp.load_module('_gdal', fp, pathname, description)

File "/Applications/QGIS3.8.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/imp.py", line 242, in load_module

return load_dynamic(name, filename, file)

File "/Applications/QGIS3.8.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.7/imp.py", line 342, in load_dynamic

return _load(spec)

ImportError: dlopen(/Applications/QGIS3.8.app/Contents/Resources/python/osgeo/_gdal.cpython-37m-darwin.so, 2): Symbol not found: _iconv

Referenced from: /Applications/QGIS3.8.app/Contents/MacOS/lib/libfreexl.1.dylib (which was built for Mac OS X 10.14)

Expected in: /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib

in /Applications/QGIS3.8.app/Contents/MacOS/lib/libfreexl.1.dylib

Processing / GDAL / Raster extraction / Contour results in

dyld: Symbol not found: _iconv

Referenced from: /usr/lib/libcups.2.dylib

Expected in: /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib

in /usr/lib/libcups.2.dylib

Interestingly both commands are working when issued from the command line.

Tried to add /usr/lib to DYLD_LIBRARY_PATH but it didn't help.

QGIS and OS versions

QGIS version 3.8.0-Zanzibar QGIS code revision 11aff65
Compiled against Qt 5.12.3 Running against Qt 5.12.3
Compiled against GDAL/OGR 2.4.1 Running against GDAL/OGR 2.4.1
Compiled against GEOS 3.7.2-CAPI-1.11.2 Running against GEOS 3.7.2-CAPI-1.11.2 b55d2125
PostgreSQL Client Version 11.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.1
Compiled against PROJ 5.2.0 Running against PROJ Rel. 5.2.0, September 15th, 2018
OS Version macOS High Sierra (10.13)    

Additional context

@aberenyi aberenyi added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 5, 2019
@jbarlow83
Copy link

This seems pretty serious for macOS.

I can confirm the same issue in 3.8.1 (dcd95cc).

@Spartacus1
Copy link

No news on this?? Qgis is completely unusable in MacOS without solving this bug.
Alternative compilation is working fine.

@nyalldawson
Copy link
Collaborator

If there was news it would be reported here already.

@Spartacus1
Copy link

Thank you for the precious information Nyall.
I'm wondering if it would be possible to share ideas or get information from WK since his compilation is working just fine. Another reason why I asked is because there's no mean, from the qgis.org site, to know if the available version is a revised one. We only see "https://qgis.org/downloads/macos/qgis-macos-pr.dmg". Maybe a sub-version number in the download could help.
Best Regards

@kyngchaos
Copy link
Contributor

From the error, it looks like the Mac packager build includes its own libiconv, which may not be built properly (missing the key _iconv symbol)... hmm, I kindof recall that iconv can be built with libiconv (or similar) as that symbol name. It does look the loader is confused - the system cups should be loading the system iconv, not the QGIS copy.

I don't build my own libiconv, I use the system iconv when needed. Also, I just found that the Mac packager build doesn't use the cmake Mac bundling mechanism to change all linking to relative links, it's all left to how each individual library was compiled, some absolute paths, some with rpath. This may cause loading confusion with the helper programs. When run from a Terminal, it's possible a different installation of GDAL is running (ie my framework), which is linked correctly. If the PATH is set to run the QGIS copies of those tools, maybe QGIS has an rpath set (in its build) that changes the linking environment for the worse.

DYLD_LIBRARY_PATH won't help anything - Apple locked that down for security reasons.

@Spartacus1
Copy link

Spartacus1 commented Nov 7, 2019

QGIS is basically unusable for any raster operation without solving this issue. It's also present in 3.10 and even in 3.11 NB.

@jrselva
Copy link

jrselva commented Nov 10, 2019

QGIS is basically unusable for any raster operation without solving this issue. It's also present in 3.10 and even in 3.11 NB.

So, any alternative for MacOS users? How should we proceed? Thanks

@Spartacus1
Copy link

Spartacus1 commented Nov 10, 2019

You can still use kyngchaos build. It's working great but it is still version 3.8.3. Download it from the "Alternative build" in the downloads page. I prefer to have a stable working version than go after quickly climbing version numbers that still have lots of bugs. In this case, either the so called "LTR" or stable version and the latest version have the same bugs. Let's hope that the talented QGIS developer team can solve these ones as soon as possible.

@PeterPetrik
Copy link
Contributor

PeterPetrik commented Dec 12, 2019

can you confirm this happens also on MacOS10.14.x and MacOS10.15.x or just 10.13.x?
i can run hillshade on 10.15.1 without problem

@jlayt
Copy link

jlayt commented Dec 12, 2019

One of my users who had this problem with QGIS 3.10.0 on macOS 10.14.x now reports that it Works For Them with QGIS 3.10.1 on macOS 10.14.6.

CORRECTION: They misunderstood my question: they are still experiencing this issue.

@Spartacus1
Copy link

Hi jlayt. In my case the problem simply gone after a PeterPetrik's suggestion. Peter, maybe you can post the solution you told me about here. Changing the "libcups.2.dylib" by a copy of the same one included in the system solves the problem.

@jlayt
Copy link

jlayt commented Dec 17, 2019

So my user just wiped his iMac and installed macOS Catalina 10.15 clean, then installed QGIS 3.10.1 clean, no Brew or other software or drivers or anything. He still gets the issue.

Interesting suggestion around the libcups, can't think of a reason why QGIS should be trying to ship its own version, the system one should suffice, but also can't think why it would be only libcups causing the issue? And why would raster processing tools be calling into a printer library? Unless the gdal raster stack is using one of the libcups/openprinting rasterization tools/libraries, which I guess is possible?

I have access to High Sierra, Mojave and Catalina machines to test on if needed.

@PeterPetrik
Copy link
Contributor

please try workround I described here: qgis/QGIS-Mac-Packager#28 (comment)

I will try to fix the issue properly for next release

@jlayt
Copy link

jlayt commented Dec 20, 2019

please try workround I described here: qgis/QGIS-Mac-Packager#28 (comment)

Confirmed that resolves the issue. Many thanks!

@Spartacus1
Copy link

Spartacus1 commented Jan 20, 2020 via email

@gioman
Copy link
Contributor

gioman commented Jan 20, 2020

Hi Peter Until the problem with GDAL is not solved, could it be possible to pack QGIS with the system’s libiconv.2.dylib. This trick you suggested work perfectly for now and, this way, users can download the packed version and use it almost fully functional. You can make this “bricolage” in advance in the provided version in qgis.org http://qgis.org/

@Spartacus1 is this a thing with the latest installers? I tested them on Catalina and had no issues in testing several tools in processing (gdal, grass, saga, qgis).

@Spartacus1
Copy link

Hi Giovanni

The problem still exists in the latest oficial version compiled by Peter. A simple Hillshade generation from the raster menu will not work, returning a libiconv.2.dylib related error. If we install via homebrew or use the WK compilation the problem is absent. However, most users just download the main link from qgis.org and will suffer from this bug. Peter gave a workaround that works perfectly but we need to manually replace the qgis.app libiconv.2.dylib by the system's one.

The temporary solution is described by Peter in this thread:

qgis/QGIS-Mac-Packager#28

Best regards

@gioman
Copy link
Contributor

gioman commented Jan 20, 2020

The problem still exists in the latest oficial version compiled by Peter.

@Spartacus1 isn't this the one linked in the Download page on qgis.org site? if yes I have no issues with it. But maybe I tested the wrong tool.

A simple Hillshade generation

GDAL's?

@Spartacus1
Copy link

Spartacus1 commented Jan 20, 2020 via email

@gioman
Copy link
Contributor

gioman commented Jan 20, 2020

Yes, GDAL’s one from the Raster Menu -> Hillshade and let it generate a temporary file. The problem exists with the very latest oficial version. Just tested an hour ago. I have already made Peter’s suggested medicine to solve the problem and it works now.

@Spartacus1 just tested on a clean Catalina machine: no issues and no tricks applied.

@DonovanMaillard
Copy link

DonovanMaillard commented Mar 9, 2020

Hi, I'm new here.

I confirm this issue on my machine also, on MacOS catalina and QGIS 3.10 an 3.12 I can't make operations on raster for now, with :

dyld: Symbol not found: _iconv
             
              Referenced from: /usr/lib/libarchive.2.dylib
             
              Expected in: /Applications/QGIS3.12.app/Contents/MacOS/lib/libiconv.2.dylib

I also reproduced this issue on a second macOs Catalina (mac mini & mac book air)

@xuxiangpy
Copy link

Hi, all. I solved this problem. The soulution is deleting the /Applications/QGIS3.10.app/Contents/MacOS/lib/libiconv.2. dylib, rather than replacing it. Hope it helps, if anyone has the same problem. GL

@xuxiangpy
Copy link

Hi, all. I solved this problem. The soulution is deleting the /Applications/QGIS3.10.app/Contents/MacOS/lib/libiconv.2. dylib, rather than replacing it. Hope it helps, if anyone has the same problem. GL

It works for me! Good luck.

@Spartacus1
Copy link

Hi, all. I solved this problem. The soulution is deleting the /Applications/QGIS3.10.app/Contents/MacOS/lib/libiconv.2. dylib, rather than replacing it. Hope it helps, if anyone has the same problem. GL

No way!! It really works! Tested with 3.12 and it will also work.

@xuxiangpy
Copy link

Hi, all. I solved this problem. The solution is deleting the /Applications/QGIS3.10.app/Contents/MacOS/lib/libiconv.2. dylib, rather than replacing it. Hope it helps, if anyone has the same problem. GL

No way!! It really works! Tested with 3.12 and it will also work.

HAHAHA, good luck bro

@Spartacus1
Copy link

Hi, all. I solved this problem. The solution is deleting the /Applications/QGIS3.10.app/Contents/MacOS/lib/libiconv.2. dylib, rather than replacing it. Hope it helps, if anyone has the same problem. GL

No way!! It really works! Tested with 3.12 and it will also work.

HAHAHA, good luck bro

Some modules still do not work, for instance Raster->Miscellaneous->Merge. However seems to work as well as having the replaced libiconv.2. dylib in place.

@xuxiangpy
Copy link

Hi, all. I solved this problem. The solution is deleting the /Applications/QGIS3.10.app/Contents/MacOS/lib/libiconv.2. dylib, rather than replacing it. Hope it helps, if anyone has the same problem. GL

No way!! It really works! Tested with 3.12 and it will also work.

HAHAHA, good luck bro

Some modules still do not work, for instance Raster->Miscellaneous->Merge. However seems to work as well as having the replaced libiconv.2. dylib in place.

I did not try that. However, if I have some new solution I will post it. Thank you for your comments.

@gioman gioman added the Feedback Waiting on the submitter for answers label Jul 6, 2020
@gioman
Copy link
Contributor

gioman commented Jul 6, 2020

Some modules still do not work, for instance Raster->Miscellaneous->Merge.

Just tested a clean install of QGIS 3.14.0 on macOS Catalina and cannot replicate. Is there a clear way to replicate this problem?

@gioman gioman changed the title [MacOS] Symbol not found: _iconv Symbol not found: _iconv Jul 6, 2020
@aberenyi
Copy link
Author

aberenyi commented Jul 7, 2020

It's still there on High Sierra (just tested on a clean install, w/o homebrew iconv/gdal).

Unfortunately @PeterPetrik's workaround seems to throw

Reason: Incompatible library version: libgdal.20.dylib requires version 9.0.0 or later, but libiconv.2.dylib provides version 7.0.0

@PeterPetrik
Copy link
Contributor

@PeterPetrik PeterPetrik self-assigned this Jul 17, 2020
@petrusgomes
Copy link

I tried, but it crashes during launch (loading banner visible for a few seconds). 3.14 works (except for _iconv issues).
Catalina 10.15.6

@PeterPetrik
Copy link
Contributor

@PeterPetrik
Copy link
Contributor

should be fixed in nightly2 builds with the new installer (half-baked still)

@antonsampedro
Copy link

I could not fix the issue.
I don't have the file libiconv.2. dylib in my lib folder. Should I install Peter's?

QGIS 3.14
Mojave 10.14

@ArturoDucasse
Copy link

I was recently getting in the terminal the following message after doing any git command (git, git add, git commit, etc...).

dyld[1233]: Symbol not found: _iconv
  Referenced from: <1A9E7E67-8CB3-3E95-9F48-C91C86057502> /opt/homebrew/Cellar/git/2.39.1/bin/git
  Expected in:     <249EE119-1841-3E25-87D8-BFA4B98C1FF8> /Library/PostgreSQL/14/lib/libiconv.2.dylib
[1]    1233 abort      git

This started happening right after updating my macOS to Ventura 13.2 (22D49), my solution was running the following command on the terminal brew uninstall git.

Note:
I had previously updated Xcode at the App Store, plus running the command xcode-select --install in the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers macOS
Projects
None yet
Development

No branches or pull requests