qgis / QGIS-Mac-Packager

Scripts for Official QGIS MacOS Packages
https://www.qgis.org
GNU General Public License v2.0
55 stars 21 forks source link

Symbol not found: _iconv #28

Closed aberenyi closed 4 years ago

aberenyi commented 4 years ago

Hi there,

This is a gentle reminder that some of us are still waiting for a fix re https://github.com/qgis/QGIS/issues/31576

Cheers

Spartacus1 commented 4 years ago

Hi Peter. The bug is still present in version 3.10.1. This makes this version completely unusable under MacOS for Raster analysis (a simple hillshade will not succeed). This bug should be a "very high priority" for MacOS QGIS version.

PeterPetrik commented 4 years ago

homebrew's iconv is build with different prefix that system one. Problem is that we are bundling homebrew iconv but some libraries are build with system one. We need to use one or other consistently (probably system one).

peter@pp-mb:~/Projects/bundle/QGIS-Mac-Packager$ nm -gU /usr/lib/libiconv.dylib 
00000000000f2710 D __libiconv_version
0000000000002408 T _iconv
0000000000002727 T _iconv_canonicalize
000000000000242a T _iconv_close
0000000000001129 T _iconv_open
0000000000002437 T _iconvctl
0000000000002530 T _iconvlist
0000000000013f8c T _libiconv_set_relocation_prefix
peter@pp-mb:~/Projects/bundle/QGIS-Mac-Packager$ nm -gU /usr/local/Cellar/libiconv/1.16/lib/libiconv.dylib 
00000000000f67c0 D __libiconv_version
00000000000039c8 T _iconv_canonicalize
00000000000031ea T _libiconv
000000000000320c T _libiconv_close
0000000000001d60 T _libiconv_open
0000000000003219 T _libiconv_open_into
0000000000016ab3 T _libiconv_set_relocation_prefix
00000000000036cb T _libiconvctl
00000000000037cc T _libiconvlist
Spartacus1 commented 4 years ago

HI Peter

Sorry for merging both messages. The problem was present in Mojave and it’s still present in Catalina. Probably, if that solves the case, a dual compilation can be justified (like x86 or x64 in the PC’s). I do not have a High Sierra machine to test but I can get one in the next few days. Best regards

On Dec 12, 2019, at 14:27, Peter Petrik notifications@github.com wrote:

homebrew's iconv is build with different prefix that system one. Problem is that we are bundling homebrew iconv but some libraries are build with system one. We need to use one or other consistently (probably system one).

peter@pp-mb:~/Projects/bundle/QGIS-Mac-Packager$ nm -gU /usr/lib/libiconv.dylib 00000000000f2710 D __libiconv_version 0000000000002408 T _iconv 0000000000002727 T _iconv_canonicalize 000000000000242a T _iconv_close 0000000000001129 T _iconv_open 0000000000002437 T _iconvctl 0000000000002530 T _iconvlist 0000000000013f8c T _libiconv_set_relocation_prefix

peter@pp-mb:~/Projects/bundle/QGIS-Mac-Packager$ nm -gU /usr/local/Cellar/libiconv/1.16/lib/libiconv.dylib 00000000000f67c0 D __libiconv_version 00000000000039c8 T _iconv_canonicalize 00000000000031ea T _libiconv 000000000000320c T _libiconv_close 0000000000001d60 T _libiconv_open 0000000000003219 T _libiconv_open_into 0000000000016ab3 T _libiconv_set_relocation_prefix 00000000000036cb T _libiconvctl 00000000000037cc T _libiconvlist

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS-Mac-Packager/issues/28?email_source=notifications&email_token=ACNLBQSRHOJUD3GFLRLUAQLQYJC3JA5CNFSM4JVV7VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGW2MSI#issuecomment-565028425, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNLBQXDR4PYVTOYG4CY6RLQYJC3JANCNFSM4JVV7VLA.

can you confirm this happens also on MacOS10.14.x and MacOS10.15.x or just 10.13.x?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS/issues/31576?email_source=notifications&email_token=ACNLBQXN65HIZMXW5XNRQKLQYJAZXA5CNFSM4IT5GTZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGWYYOY#issuecomment-565021755, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNLBQW2NTXX5OU2YRT2ND3QYJAZXANCNFSM4IT5GTZQ.

aberenyi commented 4 years ago

Hi @PeterPetrik,

I can confirm that High Sierra is also affected by this.

Cheers

PeterPetrik commented 4 years ago

can you make a try?

rename /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib_old and

and copy

/usr/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib.

run QGIS and see if it solves the problem?

Spartacus1 commented 4 years ago

Hi Peter

Apparently, seem to have worked!!! I had try a similar solution in a previous version and this solution trigger other problems. However this small trick seems to fix things. Maybe you can replace the build lib by a simlink to the system one.

On Dec 12, 2019, at 14:52, Peter Petrik notifications@github.com wrote:

can you make a try?

rename /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib_old and

and copy

/usr/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib.

run QGIS and see if it solves the problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS-Mac-Packager/issues/28?email_source=notifications&email_token=ACNLBQVBAH4647EHD5GNR4TQYJF4NA5CNFSM4JVV7VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGW5CAQ#issuecomment-565039362, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNLBQR6TFGQT7ZMEQ25TBLQYJF4NANCNFSM4JVV7VLA.

PeterPetrik commented 4 years ago

it is not proper solution, but I can try to use system iconv if it works for building all of the stuff

Spartacus1 commented 4 years ago

After testing with a few modules, I can confirm that you can go on with this solution or, at least, suggest this small patch to users. I was experiencing problems with some modules, even in WK compilation, that are now gone!! It was impossible, for instance, to use the Clip by Mask module with two layers with different CRS. It is now working perfectly.

On Dec 12, 2019, at 15:06, Peter Petrik notifications@github.com wrote:

it is not proper solution, but I can try to use system iconv if it works for building all of the stuff

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qgis/QGIS-Mac-Packager/issues/28?email_source=notifications&email_token=ACNLBQTRQSEMO6MT6PE2BOTQYJHO5A5CNFSM4JVV7VLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGW6PAA#issuecomment-565045120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNLBQUZV6QIAWZWTPLQ4KLQYJHO5ANCNFSM4JVV7VLA.

aberenyi commented 4 years ago

The workaround didn't work for me (QGIS 3.10.0, macOS 10.13.6).

Will try to update QGIS to the latest version - see if that helps.

Spartacus1 commented 4 years ago

In my case worked. So far so good. Check if you download the latest version available. The name of the image is the same as the previous one "qgis-macos-pr.dmg" but it was compiled in December 6.

aberenyi commented 4 years ago

Same result with 3.10.1, however, according to dyld my libiconv.2.dylib is way too old (on macOS 10.13.6).

$ ./QGIS
dyld: Library not loaded: @executable_path/lib/libiconv.2.dylib
  Referenced from: /Applications/QGIS3.10.app/Contents/MacOS/./lib/libgdal.20.dylib
  Reason: Incompatible library version: libgdal.20.dylib requires version 9.0.0 or later, but libiconv.2.dylib provides version 7.0.0
aberenyi commented 4 years ago

I can confirm that the workaround resolves the issue on macOS 10.15.1 (QGIS 3.10.1).

PeterPetrik commented 4 years ago

i think the problem is that https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-gdal-python.rb uses system's iconv instead of brew's iconv

PeterPetrik commented 4 years ago

unfortunately we need to wait for next GDAL release planned 17th January. homebrew dependencies are already updated to not-production ready GDAL version, so I cannot run update on build machine. and without the update it is hard to fix the dependencies ...

aberenyi commented 4 years ago

@PeterPetrik thanks for the heads up, keep up the good work.

andrensc commented 4 years ago

Thank you everybody for the amazing work trying to figure this one out.

I'm not sure if I'm running into the same problem you guys were experiencing but I tried @PeterPetrik solution. Unfortunately this workaround does not solve it for me: after copying libiconv.2.dylib from /usr/lib/ onto QGIS3.4.app/Contents/MacOS/lib/ QGIS crashes immediately after I open a project. When I return the original libiconv.2.dylib QGIS works again but I can't still perform GDAL ops like "Clip Raster by Mask Layer" and returns the same mistake as before:

dyld: Symbol not found: _iconv

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

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

in /usr/lib/libarchive.2.dylib

I'm going to try installing a previous build of QGIS to see what happens. I'll let you know.

Spartacus1 commented 4 years ago

Hi andrensc

The problem you describe will occur in projects where you were able to generate raster images with the same extension but without this problem, for instance using previous WK compilations. If you start a new project, you will be able to generate layers successfully and the project will open after. It's a very awkward problem.

andrensc commented 4 years ago

Thanks @Spartacus1 , awkward indeed!!

Actually I didn't mention it before but after I copied the system libiconv.2.dylib to the QGIS3.4 library and noticed that QGIS crashed when opening a project, I tried starting a new project: QGIS crashed as soon as I expanded an item on the browser panel. When putting the original libiconv files back, I could handle the browser panel without an issue. However, I could not run GDAL ops.

Spartacus1 commented 4 years ago

This problem is still present in version 3.12. The workaround is not the best solution but still works:

rename /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib_old and

and copy

/usr/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib.

Best regards

PeterPetrik commented 4 years ago

sorry, https://lists.osgeo.org/pipermail/qgis-developer/2020-February/060289.html

gioman commented 4 years ago

This problem is still present in version 3.12.

@aberenyi @PeterPetrik I'm not an advanced mac user, but now I have a mac with Catalina that I can use for tests. On a clean install of the OS I downloaded the 3.12 installer, installed and everything seems to work (well, expected GRASS in processing but I think is expected). So it this not about the installer in the qgis.org download page?

gioman commented 4 years ago

This problem is still present in version 3.12.

@aberenyi @PeterPetrik I'm not an advanced mac user, but now I have a mac with Catalina that I can use for tests. On a clean install of the OS I downloaded the 3.12 installer, installed and everything seems to work (well, expected GRASS in processing but I think is expected). So it this not about the installer in the qgis.org download page?

aberenyi commented 4 years ago

@PeterPetrik thanks for the heads up.

Regarding the solutions outlined in your mail - it'd be absolutely brilliant to integrate the QGIS package more closely w/ homebrew as it will also resolve the never ending saga of different python environments.

aberenyi commented 4 years ago

@gioman interesting... I've just installed QGIS 3.12 and can also confirm that the issue still exists.

gioman commented 4 years ago

and can also confirm that the issue still exists.

@aberenyi weird, here is all ok (unless I'm missing where should I see any trouble).

aberenyi commented 4 years ago

@gioman it's quite easy to test. Try to generate contour lines with GDAL using any raster source.

Also, have you installed homebrew before QGIS?

gioman commented 4 years ago

@gioman it's quite easy to test. Try to generate contour lines with GDAL using any raster source.

@aberenyi it works

Also, have you installed homebrew before QGIS?

no. Clean Catalina install.

aberenyi commented 4 years ago

@gioman

no. Clean Catalina install.

that could be the reason why it's working for you - see @PeterPetrik's comment.

pedarius commented 4 years ago

macOS 10.13.2 QGIS 3.12.1

copied the libiconv.2.dylib like PeterPetrik suggested but:

Dyld Error Message: Library not loaded: @executable_path/lib/libiconv.2.dylib Referenced from: /Applications/QGIS3.12.app/Contents/MacOS/lib/libgdal.20.dylib Reason: Incompatible library version: libgdal.20.dylib requires version 9.0.0 or later, but libiconv.2.dylib provides version 7.0.0

PeterPetrik commented 4 years ago

I work on the new dependencies build system (outside homebrew), new automatic CI for qgis on Mac and new bundler with GDAL3/PROJ6 that will be ready for 3.14 release at least. I hope the new system will land in nightlies this month. I will keep you informed

microcebus commented 4 years ago

I work on the new dependencies build system (outside homebrew), new automatic CI for qgis on Mac and new bundler with GDAL3/PROJ6 that will be ready for 3.14 release at least. I hope the new system will land in nightlies this month. I will keep you informed

Thanks for the update and your solution Peter. It worked for me. QGIS 3.12.2, OSX.14.6 (Mojave), hackintosh, installed via Homebrew/Cask

epurpur commented 4 years ago

This problem is still present in version 3.12. The workaround is not the best solution but still works:

rename /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib_old and

and copy

/usr/lib/libiconv.2.dylib to /Applications/QGIS3.8.app/Contents/MacOS/lib/libiconv.2.dylib.

Best regards

I tried the following (and other solutions referenced in this thread) and it did not work. But glad the issue has been addressed and I am looking forward to a solution!

PeterPetrik commented 4 years ago

can anyone test with https://qgis.org/downloads/macos/nightly2/qgis_nightly2_master_20200723_032054.dmg ?

microcebus commented 4 years ago

can anyone test with https://qgis.org/downloads/macos/nightly2/qgis_nightly2_master_20200723_032054.dmg ?

Seems to work okay, but got the following error at start up. Possibly user error?

===== Couldn't load plugin 'qgis_resource_sharing' due to an error when calling its classFactory() method

ImportError: cannot import name 'QtWebKitWidgets' from 'PyQt5' (/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/PyQt5/init.py) Traceback (most recent call last): File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 334, in _startPlugin plugins[packageName] = package.classFactory(iface) File "/Users/lukek/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing/init.py", line 55, in classFactory from resource_sharing.plugin import Plugin File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/lukek/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing/resource_sharing/plugin.py", line 31, in from .gui.resource_sharing_dialog import ResourceSharingDialog File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 743, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/Users/lukek/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing/resource_sharing/gui/resource_sharing_dialog.py", line 83, in FORMCLASS, = uic.loadUiType(ui_path('resource_sharing_dialog_base.ui')) File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/PyQt/uic/init.py", line 36, in loadUiType return PyQtLoadUiType(*args, **kwargs) File "/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/PyQt5/uic/init.py", line 203, in loadUiType exec(code_string.getvalue(), ui_globals) File "", line 284, in ImportError: cannot import name 'QtWebKitWidgets' from 'PyQt5' (/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/PyQt5/init.py)

Python version: 3.7.7 (default, Jul 15 2020, 17:09:38) [Clang 11.0.3 (clang-1103.0.32.62)] QGIS version: 3.15.0-Master Master, 7565a647e7

Python Path: /Users/~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/contour /Applications/QGIS.app/Contents/MacOS/../Resources/python /Users/~/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins /Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages /Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/netCDF4-1.5.3-py3.7-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/GDAL-3.1.2-py3.7-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python37.zip /Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/pyproj-2.6.0-py3.7-macosx-10.13.0-x86_64.egg /Applications/QGIS.app/Contents/MacOS/lib/python3.7 /Applications/QGIS.app/Contents/MacOS/lib/python3.7/lib-dynload /Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/cftime-1.2.0-py3.7-macosx-10.13.0-x86_64.egg /Users/~/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing/ext_libs

gioman commented 4 years ago

Seems to work okay, but got the following error at start up. Possibly user error?

@microcebus the error comes from a 3rd party plugin. Remove it and see if the error goes away.

qgis_resource_sharing

PeterPetrik commented 4 years ago

This is separate issue with half-baked new installer. Please report to QGIS-Mac-Packager as separate issue.

microcebus commented 4 years ago

Thanks Gioman, that worked. The only other gotcha appears to be it doesn't seem to recognise kml, kmz or gpx files either in existing project files or adding them to new project files. 2020-07-24T00:51:51 CRITICAL Invalid Data Source : /Users/~/test.kmz is not a valid or recognized data source.

PeterPetrik commented 4 years ago

@microcebus that is covered in https://github.com/qgis/QGIS-Mac-Packager/issues/48

microcebus commented 4 years ago

Good to know. Thanks Peter for your efforts on this.

Lesanse commented 4 years ago

I'm sorry to bother you all guys because I am no developer but where am I to find /usr/lib/libiconv.2.dylib ???

I really need this fixed and I can't find it in code files on here nor on my Mac folders...

Thanks in advance!

aberenyi commented 4 years ago

@PeterPetrik many thanks for your continued effort in fixing this.

I can confirm that the half-baked version looks okay, however, couldn't really test the original issue as GDAL is not included yet.

epurpur commented 4 years ago

Sorry if this is out of date now but the new dev version that @PeterPetrik provided a link to does not appear to include any GDAL tools? Though I did notice the version was 3.1.2.

Thank you for your continued work on this.

PeterPetrik commented 4 years ago

@epurpur I have created the issue https://github.com/qgis/QGIS-Mac-Packager/issues/66