Skip to content

Commit db1b524

Browse files
committed
Fix "assert.h not found error". Version set to 0.3.2
code generated with ROOT.jl-generator 9a9320b542674d78e50f67a312d641a6e3c7d4ed
1 parent e62cdfa commit db1b524

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ROOT"
22
uuid = "1706fdcc-8426-44f1-a283-5be479e9517c"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["Philippe Gras CEA/IRFU"]
55

66
[deps]

misc/ROOT.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module_name = "ROOT"
22
uuid = "1706fdcc-8426-44f1-a283-5be479e9517c"
3-
version = "0.3.1"
3+
version = "0.3.2"
44

55
export_jl_fname = "ROOT-export.jl"
66
module_jl_fname = "ROOT-generated.jl"

src/ROOT.jl

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,43 @@ include("iROOT.jl")
2626

2727
TF1!kDefault = 0
2828

29+
module Internals
30+
import Conda
31+
function get_conda_build_sysroot()
32+
cxx = joinpath(Conda.PREFIX, "bin", "c++")
33+
cmd = `$cxx -DNDEBUG -xc++ -E -v /dev/null`
34+
sysroot=""
35+
err = Pipe()
36+
run(pipeline(ignorestatus(cmd), stdout=devnull, stderr=err), wait=true)
37+
close(err.in)
38+
for l in eachline(err)
39+
if occursin(r"sysroot/usr/include$", l)
40+
sysroot = strip(l)
41+
break
42+
end
43+
end
44+
replace(normpath(sysroot), normpath("/usr/include") => "")
45+
end
46+
end
47+
48+
import .Internals
49+
2950
function __init__()
3051
# Some required environment cleanup before loading the ROOT libraries
31-
saved_path = ENV["PATH"]
32-
saved_ld_library_path = get(ENV, "LD_LIBRARY_PATH", nothing)
33-
saved_dyld_library_path = get(ENV, "DYLD_LIBRARY_PATH", nothing)
34-
# Prevent mix-up of root library version is another version than ours is in LD_LIBRARY_PATH:
35-
isnothing(saved_ld_library_path) || (ENV["LD_LIBRARY_PATH"] = "")
36-
isnothing(saved_dyld_library_path) || (ENV["DYLD_LIBRARY_PATH"] = "")
37-
# Workaroud to prevent a crash with root installed with Conda linker to
38-
# the c++ compiler called by cling to get the include directories and
39-
# missing in the PATH list. In the Conda install, compiler is same directory as ROOT
40-
# binaries, rootbindir
41-
ENV["PATH"] *= ":" * rootbindir
42-
43-
@initcxx
44-
global gROOT = ROOT!GetROOT()
45-
46-
#Restore the environment:
47-
ENV["PATH"] = saved_path
48-
isnothing(saved_ld_library_path) || (ENV["LD_LIBRARY_PATH"] = saved_ld_library_path)
49-
isnothing(saved_dyld_library_path) || (ENV["DYLD_LIBRARY_PATH"] = saved_dyld_library_path)
50-
52+
withenv(
53+
# Prevent mix-up of root library version is another version than ours is in LD_LIBRARY_PATH:
54+
"LD_LIBRARY_PATH" => "",
55+
"DYLD_LIBRARY_PATH" => "",
56+
# Workaroud to prevent a crash with root installed with Conda linker to
57+
# the c++ compiler called by cling to get the include directories and
58+
# missing in the PATH list. In the Conda install, compiler is same directory as ROOT
59+
# binaries, rootbindir
60+
"PATH" => ENV["PATH"] * ":" * rootbindir,
61+
# Fix "assert.h not found" issue:
62+
"CONDA_BUILD_SYSROOT" => Internals.get_conda_build_sysroot()) do
63+
@initcxx
64+
global gROOT = ROOT!GetROOT()
65+
end
5166
isinteractive() && _init_event_loop()
5267
end
5368

0 commit comments

Comments
 (0)