Skip to content

Commit

Permalink
Fix "assert.h not found error". Version set to 0.3.2
Browse files Browse the repository at this point in the history
code generated with ROOT.jl-generator 9a9320b542674d78e50f67a312d641a6e3c7d4ed
  • Loading branch information
grasph committed Sep 19, 2024
1 parent e62cdfa commit db1b524
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ROOT"
uuid = "1706fdcc-8426-44f1-a283-5be479e9517c"
version = "0.3.1"
version = "0.3.2"
authors = ["Philippe Gras CEA/IRFU"]

[deps]
Expand Down
2 changes: 1 addition & 1 deletion misc/ROOT.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module_name = "ROOT"
uuid = "1706fdcc-8426-44f1-a283-5be479e9517c"
version = "0.3.1"
version = "0.3.2"

export_jl_fname = "ROOT-export.jl"
module_jl_fname = "ROOT-generated.jl"
Expand Down
55 changes: 35 additions & 20 deletions src/ROOT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,43 @@ include("iROOT.jl")

TF1!kDefault = 0

module Internals
import Conda
function get_conda_build_sysroot()
cxx = joinpath(Conda.PREFIX, "bin", "c++")
cmd = `$cxx -DNDEBUG -xc++ -E -v /dev/null`
sysroot=""
err = Pipe()
run(pipeline(ignorestatus(cmd), stdout=devnull, stderr=err), wait=true)
close(err.in)
for l in eachline(err)
if occursin(r"sysroot/usr/include$", l)
sysroot = strip(l)
break
end
end
replace(normpath(sysroot), normpath("/usr/include") => "")
end
end

import .Internals

function __init__()
# Some required environment cleanup before loading the ROOT libraries
saved_path = ENV["PATH"]
saved_ld_library_path = get(ENV, "LD_LIBRARY_PATH", nothing)
saved_dyld_library_path = get(ENV, "DYLD_LIBRARY_PATH", nothing)
# Prevent mix-up of root library version is another version than ours is in LD_LIBRARY_PATH:
isnothing(saved_ld_library_path) || (ENV["LD_LIBRARY_PATH"] = "")
isnothing(saved_dyld_library_path) || (ENV["DYLD_LIBRARY_PATH"] = "")
# Workaroud to prevent a crash with root installed with Conda linker to
# the c++ compiler called by cling to get the include directories and
# missing in the PATH list. In the Conda install, compiler is same directory as ROOT
# binaries, rootbindir
ENV["PATH"] *= ":" * rootbindir

@initcxx
global gROOT = ROOT!GetROOT()

#Restore the environment:
ENV["PATH"] = saved_path
isnothing(saved_ld_library_path) || (ENV["LD_LIBRARY_PATH"] = saved_ld_library_path)
isnothing(saved_dyld_library_path) || (ENV["DYLD_LIBRARY_PATH"] = saved_dyld_library_path)

withenv(
# Prevent mix-up of root library version is another version than ours is in LD_LIBRARY_PATH:
"LD_LIBRARY_PATH" => "",
"DYLD_LIBRARY_PATH" => "",
# Workaroud to prevent a crash with root installed with Conda linker to
# the c++ compiler called by cling to get the include directories and
# missing in the PATH list. In the Conda install, compiler is same directory as ROOT
# binaries, rootbindir
"PATH" => ENV["PATH"] * ":" * rootbindir,
# Fix "assert.h not found" issue:
"CONDA_BUILD_SYSROOT" => Internals.get_conda_build_sysroot()) do
@initcxx
global gROOT = ROOT!GetROOT()
end
isinteractive() && _init_event_loop()
end

Expand Down

0 comments on commit db1b524

Please sign in to comment.