Skip to content

Commit 5622237

Browse files
committed
debugging macos CI
1 parent 56147f2 commit 5622237

File tree

8 files changed

+63
-17
lines changed

8 files changed

+63
-17
lines changed

.github/workflows/test-macos.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,20 @@ jobs:
4949
EOF
5050
echo -n "ROOT binary: " 1>&2
5151
which root 1>&2
52+
# - name: Setup upterm session
53+
# uses: owenthereal/action-upterm@v1
54+
# with:
55+
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
56+
# limit-access-to-actor: true
57+
# ## limits ssh access and adds the ssh public keys of the listed GitHub users
58+
# limit-access-to-users: grasph
59+
# ## If no one connects after 2 minutes, shut down server.
60+
# wait-timeout-minutes: 2
5261
- name: Build the Julia wrapper library
5362
run: |
54-
julia --project=@. -e 'import Pkg; Pkg.add("ROOTprefs"); using ROOTprefs; set_use_root_jll(false); set_ROOTSYS()' 1>&2
63+
cd ..
64+
# julia --project=@. -e 'import Pkg; Pkg.add("ROOTprefs"); using ROOTprefs; set_use_root_jll(false); set_ROOTSYS(); ROOTprefs._set_preference("no_auto_compile", true); Pkg.add(path="./ROOT.jl"); import ROOT; ROOT.cxxcompile();' 1>&2
65+
julia --project=@. -e 'import Pkg; Pkg.add("ROOTprefs"); using ROOTprefs; ROOTprefs._set_preference("no_auto_compile", true); Pkg.add(path="./ROOT.jl"); import ROOT; ROOT.cxxcompile();' 1>&2
5566
julia --project=@. -e 'import ROOT' 1>&2
5667
#- uses: julia-actions/julia-buildpkg@latest
5768
- uses: julia-actions/julia-runtest@latest

deps/Makefile

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ UNAME=$(shell uname)
99
ROOT_LIBS = $(shell $(ROOT_CONFIG) --libs) -lGeom
1010
ROOT_INC_DIR = $(shell $(ROOT_CONFIG) --incdir)
1111

12+
JULIA = julia
13+
1214
CPPFLAGS = -MMD -I. -I $(CXXWRAP_PREFIX)/include
15+
#JCXX_HAS_RANGE must be set to 0 if libcxxwrap_julia_stl.so was compiled without std::ranges support
16+
#JLCXX_HAS_RANGE = isdefined(CxxWrap.StdLib, :HAS_RANGES) ? 1 : 0
17+
#Disable dependencies on std::ranges if libcxxwrap_julis_stl.so was compiled without it
18+
ifeq ($(JLCXX_HAS_RANGES), 0)
19+
CPPFLAGS += -DJLCXX_FORCE_RANGES_OFF
20+
endif
1321
CXXFLAGS = $(patsubst -std=gnu%,,$(shell $(JL_SHARE)/julia-config.jl --cflags))
1422
CXXFLAGS += $(shell $(ROOT_CONFIG) --cflags)
1523
CXXFLAGS += -I$(VDT_DIR)/include
@@ -19,7 +27,6 @@ CXXFLAGS += -Wno-c++20-extensions
1927
#CXXFLAGS += -Wall -O0 -g #To compile with debugger infomation
2028
LDFLAGS = $(shell $(JL_SHARE)/julia-config.jl --ldflags)
2129
LDLIBS = $(shell $(JL_SHARE)/julia-config.jl --ldlibs) -L$(CXXWRAP_PREFIX)/lib -lcxxwrap_julia -lcxxwrap_julia_stl
22-
JULIA = julia
2330

2431
CXX_IS_CLANG = $(shell $(CXX) -dM -E - < /dev/null | grep -c __clang__)
2532

@@ -39,8 +46,10 @@ endif
3946

4047
ifneq ($(CXX_IS_CLANG), 0)
4148
CXXFLAGS += -ferror-limit=3
49+
PCH_SUFFIX=.pch
4250
else #assuming gcc
4351
CXXFLAGS += -fmax-errors=3
52+
PCH_SUFFIX=.gch
4453
endif
4554

4655

@@ -94,17 +103,30 @@ JULIA_LOAD_PATH=`pwd`/build/ROOT/src:$(JULIA_LOAD_PATH): "$(JULIA)" --project=..
94103
JULIA_LOAD_PATH=`pwd`/build/ROOT/src:$(JULIA_LOAD_PATH): "$(JULIA)" --project=.. TTree_examples/write_tree3.jl \
95104
&& JULIA_LOAD_PATH=`pwd`/build/ROOT/src:$(JULIA_LOAD_PATH): "$(JULIA)" --project=.. TTree_examples/read_tree3.jl
96105

97-
$(BUILD_DIR)/%.o: src/%.cxx
106+
#$(BUILD_DIR)/pch.h:
107+
# $(Q) [ -d $(BUILD_DIR)/libROOT/build ] || mkdir -p $(BUILD_DIR)/libROOT/build
108+
# echo '#include "Wrapper.h"\n#include "jlROOT.h"\n#include "jlcxx/functions.hpp"\n#include "jlcxx/stl.hpp"\n' > $@
109+
#
110+
#$(BUILD_DIR)/%.h$(PCH_SUFFIX): $(BUILD_DIR)/%.h
111+
# @echo "Precompile the header files."
112+
# $(Q) $(COMPILE.cc) $(CPPFLAGS) -I src -x c++-header -o $@ $<
113+
114+
$(BUILD_DIR)/pch.h$(PCH_SUFFIX):
115+
@echo "Precompile the header files."
116+
$(Q) [ -d $(BUILD_DIR)/include ] || mkdir -p $(BUILD_DIR)/include
117+
$(Q)echo '#include "Wrapper.h"\n#include "jlROOT.h"\n#include "jlcxx/functions.hpp"\n#include "jlcxx/stl.hpp"\n' > $(BUILD_DIR)/include/pch.h
118+
$(Q) $(COMPILE.cc) -Isrc -x c++-header -o $@ $(BUILD_DIR)/include/pch.h
119+
120+
$(BUILD_DIR)/%.o: src/%.cxx $(BUILD_DIR)/pch.h$(PCH_SUFFIX)
98121
@echo "Make $(notdir $@)"
99-
$(Q) [ -d $(BUILD_DIR)/libROOT/build ] || mkdir -p $(BUILD_DIR)/libROOT/build
100-
$(Q) $(COMPILE.cc) $(CPPFLAGS) -o $@ $<
122+
$(Q) [ -d $(BUILD_DIR) ] || mkdir -p $(BUILD_DIR)
123+
$(Q) $(COMPILE.cc) -include $(BUILD_DIR)/pch.h -o $@ $<
101124

102125
$(BUILD_DIR)/libroot_julia$(SO_SUFFIX): $(OBJS)
103126
@echo "Make $(notdir $@)"
104127
$(Q) $(MAKE) check_root
105128
$(Q) $(LINK.o) -o $@ --shared -fPIC $(OBJS) $(ROOT_LIBS) $(LDLIBS)
106129

107-
108130
echo_%:
109131
@echo "$* = $(subst ",\",$($*))"
110132

deps/pch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#error "Failed to use precompile headers."

deps/src/JlGlobals.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ struct JlGlobal: public Wrapper {
2020
// defined in /home/pgras/.julia/artifacts/541477a5cefd778e4ecbd314cfbc99eed20f2c4c/include/Rtypes.h:120:19
2121
t.method("ROOT!CreateClass", [](const char * arg0, int16_t arg1, const std::type_info & arg2, TVirtualIsAProxy * arg3, const char * arg4, const char * arg5, int32_t arg6, int32_t arg7)->TClass * { return ROOT::CreateClass(arg0, (Version_t)arg1, arg2, arg3, arg4, arg5, (Int_t)arg6, (Int_t)arg7); }, jlcxx::arg("this"), jlcxx::arg("cname"), jlcxx::arg("id"), jlcxx::arg("info"), jlcxx::arg("isa"), jlcxx::arg("dfil"), jlcxx::arg("ifil"), jlcxx::arg("dl"), jlcxx::arg("il"));
2222

23+
/* Link fails on ARM64
2324
DEBUG_MSG("Adding wrapper for void ::ROOT::AddClass(const char *, Version_t, const std::type_info &, DictFuncPtr_t, Int_t) (" __HERE__ ")");
2425
// signature to use in the veto list: void ::ROOT::AddClass(const char *, Version_t, const std::type_info &, DictFuncPtr_t, Int_t)
2526
// defined in /home/pgras/.julia/artifacts/541477a5cefd778e4ecbd314cfbc99eed20f2c4c/include/Rtypes.h:124:16
2627
t.method("ROOT!AddClass", [](const char * arg0, int16_t arg1, const std::type_info & arg2, DictFuncPtr_t arg3, int32_t arg4)->void { ROOT::AddClass(arg0, (Version_t)arg1, arg2, arg3, (Int_t)arg4); }, jlcxx::arg("this"), jlcxx::arg("cname"), jlcxx::arg("id"), jlcxx::arg("info"), jlcxx::arg("dict"), jlcxx::arg("pragmabits"));
28+
*/
2729

2830
DEBUG_MSG("Adding wrapper for void ::ROOT::RemoveClass(const char *, TClass *) (" __HERE__ ")");
2931
// signature to use in the veto list: void ::ROOT::RemoveClass(const char *, TClass *)
@@ -1060,10 +1062,13 @@ struct JlGlobal: public Wrapper {
10601062

10611063
module_.unset_override_module();
10621064

1065+
/*Link fails on ARM64
10631066
DEBUG_MSG("Adding wrapper for void ::ROOT::AddClass(const char *, Version_t, DictFuncPtr_t, Int_t) (" __HERE__ ")");
10641067
// signature to use in the veto list: void ::ROOT::AddClass(const char *, Version_t, DictFuncPtr_t, Int_t)
10651068
// defined in /home/pgras/.julia/artifacts/541477a5cefd778e4ecbd314cfbc99eed20f2c4c/include/TClassTable.h:100:16
10661069
t.method("ROOT!AddClass", [](const char * arg0, int16_t arg1, DictFuncPtr_t arg2, int32_t arg3)->void { ROOT::AddClass(arg0, (Version_t)arg1, arg2, (Int_t)arg3); }, jlcxx::arg("this"), jlcxx::arg("cname"), jlcxx::arg("id"), jlcxx::arg("dict"), jlcxx::arg("pragmabits"));
1070+
*/
1071+
10671072
module_.set_override_module(jl_base_module);
10681073

10691074
DEBUG_MSG("Adding wrapper for TBuffer & ::operator>>(TBuffer &, TArrayL *&) (" __HERE__ ")");

deps/src/Wrapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef WRAPPER_H
2+
#define WRAPPER_H
13
#include "jlcxx/jlcxx.hpp"
24

35
struct Wrapper{
@@ -8,3 +10,4 @@ struct Wrapper{
810
protected:
911
jlcxx::Module& module_;
1012
};
13+
#endif //WRAPPER_H not defined

deps/src/jlROOT.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifndef JLROOT_H
2+
#define JLROOT_H
13
#include "TVectorT.h"
24
#include "cstdint"
35
#include "Buttons.h"
@@ -301,3 +303,4 @@
301303
#include "TVirtualGeoPainter.h"
302304
#include "TVirtualGeoTrack.h"
303305
#include "TVirtualMagField.h"
306+
#endif //JLROOT_H not defined

src/CxxBuild.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ function build_root_wrapper(rootsys = ROOTprefs.get_ROOTSYS())
5151
CXXWRAP_PREFIX = CxxWrap.prefix_path()
5252
JL_SHARE = joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia")
5353
JULIA = joinpath(Sys.BINDIR, "julia")
54+
JLCXX_HAS_RANGES = isdefined(CxxWrap.StdLib, :HAS_RANGES) ? 1 : 0
5455
depsdir = joinpath(dirname(@__DIR__), "deps")
5556
srcdir = joinpath(depsdir, "src")
56-
cmd=`make -C "$depsdir" BUILD_DIR="$buildpath" CXXWRAP_PREFIX="$CXXWRAP_PREFIX" JL_SHARE="$JL_SHARE" JULIA="$JULIA" ROOT_CONFIG="$rootconfig" -j $(Sys.CPU_THREADS) VDT_DIR="$(VDT_jll.artifact_dir)"`
57+
cmd=`make -C "$depsdir" BUILD_DIR="$buildpath" CXXWRAP_PREFIX="$CXXWRAP_PREFIX" JL_SHARE="$JL_SHARE" JULIA="$JULIA" ROOT_CONFIG="$rootconfig" -j $(Sys.CPU_THREADS) VDT_DIR="$(VDT_jll.artifact_dir)" JLCXX_HAS_RANGES=$(JLCXX_HAS_RANGES)`
5758
extra_make_options = ROOTprefs._load_preference("extra_make_options", "")
5859
if !isempty(extra_make_options)
5960
cmd = Cmd([collect(cmd)..., extra_make_options])

src/ROOT.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,20 @@ Value of ROOTSYS preference when this module was precompiled.
3434
"""
3535
const rootsys = ROOTprefs.get_ROOTSYS()
3636

37+
"""
38+
`libroot_julia_from_jll`
39+
40+
Flag telling if the package was precompiled with the C++ wrapper library from the jll package (true) or built for an external C++ ROOT installation (false).
41+
"""
42+
const libroot_julia_from_jll = root_jll_preferred && Internals.CxxBuild.is_jll_supported()
43+
3744
"""
3845
`libroot_julia_path`
3946
4047
Path of the shared library containing the C++ code interfacing the Julia ROOT package with the C++ ROOT libraries. This library is provided by the package ROOT_julia_jll included in the dependency, when the C++ ROOT libraries are installed by the Julia package manager from the ROOT_jll package, or built on the fly (at first ROOT module import), if they are installed by another mean.
4148
"""
42-
const libroot_julia_path = Internals.CxxBuild.get_or_build_libroot_julia()
49+
const libroot_julia_path = ((!libroot_julia_from_jll && Preferences.load_preference("ROOT", "no_auto_compile", false)) ?
50+
"" : Internals.CxxBuild.get_or_build_libroot_julia())
4351

4452
const _libroot_compilation_failed = if isempty(libroot_julia_path) #precompilation failed
4553
# trick to invalidate the precompilation cache
@@ -48,14 +56,6 @@ const _libroot_compilation_failed = if isempty(libroot_julia_path) #precompilati
4856
ROOTprefs._load_preference("internal_compilation_failed", true)
4957
end
5058

51-
52-
"""
53-
`libroot_julia_from_jll`
54-
55-
Flag telling if the package was precompiled with the C++ wrapper library from the jll package (true) or built for an external C++ ROOT installation (false).
56-
"""
57-
const libroot_julia_from_jll = root_jll_preferred && Internals.CxxBuild.is_jll_supported()
58-
5959
# Display libroot_julia_path value on precompilation
6060
isempty(libroot_julia_path) || (@info "ROOT wrapper library: $libroot_julia_path")
6161

@@ -105,7 +105,7 @@ end
105105
function __init__()
106106
if !ok()
107107
ROOTprefs._set_preference("internal_compilation_failed", nothing)
108-
@warn "The imported ROOT module is empty because of the error mentioned above. To import the module again after resolving the issue, a restart of Julia is required."
108+
@warn "The imported ROOT module is empty because the backend library is not compiled. User ROOT.cxxcompile() to compile it. After compilation restart of Julia is required after the compilation."
109109
else
110110
libroot_julia_from_jll && Internals.loadlibdeps()
111111
@initcxx

0 commit comments

Comments
 (0)