#author("2021-11-08T17:46:16+09:00","default:Miyashita","Miyashita")
#author("2021-11-08T17:47:09+09:00","default:Miyashita","Miyashita")
*エラーのログと対処 [#ud69ab65]
エラーの根本的な原因がわからないまま載せることが多いので,役には立たないかも.~
#contents
~

**GMT.jl の precompile error [#b926fa4e]
GMT.jl はコンパイル失敗しやすい.~
ある時のエラー.~
#codeprettify{{
julia> using GMT: GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]
ERROR: LoadError: failed process: Process(`grep libgdal`, ProcessExited(1)) [1]
}}
libgdal が探せていない?下は失敗した GMT.jl のソース部分.~
#codeprettify{{
_GMTver, GMTbyConda, _libgmt, _libgdal, _libproj, _GMT_bindir = get_GMTver()

if (!GMTbyConda)		# In the other case (the non-existing ELSE branch) lib names already known at this point.
	_libgmt = haskey(ENV, "GMT_LIBRARY") ? ENV["GMT_LIBRARY"] : string(chop(read(`gmt --show-library`, String)))
	@static Sys.iswindows() ?
		(Sys.WORD_SIZE == 64 ? (_libgdal = "gdal_w64.dll") : (_libgdal = "gdal_w32.dll")) : (
			Sys.isapple() ? (_libgdal = string(split(readlines(pipeline(`otool -L $(_libgmt)`, `grep libgdal`))[1])[1])) : (
				Sys.isunix() ? (_libgdal = string(split(readlines(pipeline(`ldd $(_libgmt)`, `grep libgdal`))[1])[3])) :
				error("Don't know how to install this package in this OS.")
			)
		)
	@static Sys.iswindows() ?
		(Sys.WORD_SIZE == 64 ? (_libproj = "proj_w64.dll") : (_libproj = "proj_w32.dll")) : (
			Sys.isapple() ? (_libproj = string(split(readlines(pipeline(`otool -L $(_libgdal)`, `grep libproj`))[1])[1])) : (
				Sys.isunix() ? (_libproj = string(split(readlines(pipeline(`ldd $(_libgdal)`, `grep libproj`))[1])[3])) :
				error("Don't know how to use PROJ4 in this OS.")
			)
		)
end
const GMTver, libgmt, libgdal, libproj, GMT_bindir = _GMTver, _libgmt, _libgdal, _libproj, _GMT_bindir
}}
これをもとに下記コマンドで何が出てくるかを確認.
#codeprettify{{
ldd /usr/local/gmt/lib/libgmt.so | grep libgdal
}}
どうやら,もともと libgmt.so に libgdal が検出できていなかった模様.~
GMT をソースからビルドしたため,cmake で libgdal.so のパッケージが検出できるようにして,再度 GMT をインストールすることで解決.~
または,直接 libgmt.so に libgdal.so の依存関係を追加してもよい.
#codeprettify{{
$ patchelf --add-needed libgdal.so libgmt.so
$ ldd libgmt.so
        linux-vdso.so.1 (0x00007ffd4868d000)
        libgdal.so => /usr/lib/libgdal.so (0x00007f8f8f055000)
        .....
$ ldd libgmt.so | grep libgdal.so
        libgdal.so => /usr/lib/libgdal.so (0x00007f8e8aae4000)
}}
~
~

**GMT.jl の makecpt,-D オプション [#h1dc5b50]
バージョン~
Julia v1.0.0~
GMT v0.5.0~
makecpt の -D オプションが反映されない問題.
#codeprettify(lang-julia){{
using GMT:GMT
cpt = GMT.makecpt(C=:polar, T="-1.0/1.0", D=true, V=true)
GMT.gmt("write tmp.cpt",cpt);
}}
で出力された tmp.cpt を見てみると,
 -1	blue	0	white
 0	white	1	red
 B	black
 F	white
 N	127.5
となり,B, F に -D オプションの効果が入っていない.~
~
(追記)[[issues #179>https://github.com/GenericMappingTools/GMT.jl/issues/179]]で聞いたら GMT 自体のライブラリが原因らしい.~
最新の GMT バージョンがリリースされたら適切に動くようになるかも.~
~
現状では
#codeprettify(lang-julia){{
cptfile = "tmp.cpt"
GMT.gmt("makecpt -Cpolar -T-1.0/1.0 -D -V > $cptfile")
cpt = GMT.gmt("read -Tc $cptfile")
run(`rm -f $cptfile`)
}}
と一旦 gmt コマンドをそのまま実行し,read で読むと良い.~
~
(さらに追記 2019/11)~
GMT のバージョン6.0 をインストール後,これの libgmt.so を参照するようにしたら,-D オプションが機能した!~
GMT の開発者さんありがとうございます.
~
~

** registry dirty [#t4a40ecf]
環境は Julia v1.0.3, Ubuntu 18.04 LTS.~
#codeprettify(lang-julia){{
(v1.0) pkg> update
}}
をすると warning が出て
 ┌ Warning: Some registries failed to update:
   `~/.julia/registries/General` — registry dirty
と言われた.何が dirty なのかは不明.~
[[Issues>https://github.com/JuliaStats/StatsBase.jl/issues/419]]を読んで該当箇所を git で修正したら出なくなった.
#codeprettify{{
cd ~/.julia/registries/General
git fetch origin --prune
git checkout -- .
git reset --hard origin/master
}}
~

**curlのエラーによるパッケージのアップデート,ビルドのエラー [#k449cef3]
バージョン: v1.0.0~
Pkg.update や Pkg.build は curl でエラーが発生すると全部うまくいかない.エラーは下記の通り.
 curl: (48) An unknown option was passed in to libcurl
[[Ubuntu/curl関係のエラー]]の修正をしたらビルド成功.~
~

** (謎) 数値の誤表示? [#d493952b]
バージョン: v0.6.2~

画像から.
#ref(https://main-t-miyashita.ssl-lolipop.jp/hydrocoast/image/julia/error_num0.png)
値を変更せず,全く同じことをしているのに,
#codeprettify(lang-julia){{
julia> ϕ[24,16,1]
8.099876.....
}}
となるはずが1度だけ
#codeprettify(lang-julia){{
julia> ϕ[24,16,1]
8.899876.....
}}
になっている.~
~

**Juno 更新,Atom 再起動,Pkg.update の後に precompiling error [#f5f15b15]
バージョン: v0.6.2~

Atom で Juno 更新,再起動,さらに Atom の REPL で
#codeprettify(lang-julia){{
Pkg.update()
}}
を実行した後,
#codeprettify(lang-julia){{
using NetCDF
}}
などを実行しようとしたら,途中でエラーが出現した.下はエラーメッセージ.
 WARNING: Module Compat with uuid xxxxxxxxxxxxxx is missing from the cache.
 This may mean module Compat does not support precompilation but is imported by a module that does.
 ERROR: LoadError: Declaring __precompile__(false) is not allowed in files that are being precompiled.
[[issue #19017>https://github.com/JuliaLang/julia/issues/19017]] や [[discourse.julialang.org>https://discourse.julialang.org/t/v-0-6-4-problem-with-plots/12374]] にあることと同じようなもの.~
REPL 再起動では直らず,Atom 再起動をしたらエラーがでなくなった.~
~

**Atom で Julia の REPL が起動できない [#a02f714a]
バージョン: v0.6.2~

Precompiling の HttpPaser のビルドで
#codeprettify{{
curl -f -o /home/miyashita/.julia/v0.6/HttpParser/deps/downloads/v2.7.1.zip -L https://github.com/nodejs/http-parser/archive/v2.7.1.zip
}}
が実行できず,Atom で REPL が起動できなかった.エラーは下の通り.
 curl: (1) Protocol "https" not supported or disabled in libcurl
何かの際に curl を再インストールして,https からダウンロードできなくなっていた.~
curl の設定を直して,
#codeprettify{{
curl -V
}}
で https が含まれているのを確認した後,再度 terminal から Julia を起動して
#codeprettify{{
julia> Pkg.build("HttpParser")
}}
をしたら正常に戻った.

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes