@@ -81,29 +81,14 @@ def clean(self):
81
81
def cmake_prefix_paths (self ):
82
82
return super ().cmake_prefix_paths + [self .install_dir ]
83
83
84
- def _get_poco (self ):
85
- # find and copy libPocoFoundation.so.71 from the sysroot into self.source_dir
86
- # this is a bit ugly, but allows us to link the poco library whether we're running
87
- # hybrid or purecap cheribsd. this is helpful because if we're running hybrid cheribsd,
88
- # the hybrid rootfs gets mounted, which doesn't include the purecap build of the poco library.
89
- #
90
- # one day, if we're only running the purecap kernel, we can just append the path
91
- # of libPocoFoundation.so.71 to LD_CHERI_LIBRARY_PATH in _set_env() below.
92
- poco_path = self .target_info .sysroot_install_prefix_absolute / "lib/libPocoUtil.so.71"
93
- if poco_path .is_file ():
94
- self .info ("Found pocofoundation:" , poco_path )
95
- self .install_file (poco_path , self .source_dir / poco_path .name , force = True , print_verbose_only = False )
96
- else :
97
- self .fatal ("libPocoFoundation.so.71 cannot be found at expected path" , poco_path )
98
-
99
84
def _set_env (self ):
100
85
# create cheri_setup.csh and cheri_setup.sh files in self.source_dir which can be source'ed
101
86
# to set environment variables (primarily LD_CHERI_LIBRARY_PATH)
102
87
#
103
88
# based off the install/setup.bash file sourced for ubuntu installs
104
89
105
90
# source the setup script created by ROS to set LD_LIBRARY_PATH
106
- setup_script = self .source_dir / "install" / "setup.bash"
91
+ setup_script = self .install_dir / "setup.bash"
107
92
if not setup_script .is_file ():
108
93
self .warning ("No setup.bash file to source." )
109
94
return
@@ -116,9 +101,20 @@ def _set_env(self):
116
101
self .warning ("LD_LIBRARY_PATH not set." )
117
102
return
118
103
104
+ # add Poco libraries to LD_LIBRARY_PATH
105
+ poco_path = self .target_info .sysroot_install_prefix_absolute / "lib"
106
+ if (poco_path / "libPocoFoundation.so.71" ).is_file ():
107
+ self .info ("Found libPocoFoundation.so.71 in the expected path: " , poco_path )
108
+ ld_library_path = ld_library_path + ":" + str (poco_path )
109
+ else :
110
+ self .fatal ("libPocoFoundation.so.71 was not found in the expected path: " , poco_path )
111
+
112
+ # remove the host prefix for the install directory from entries in the
113
+ # LD_LIBRARY_PATH
114
+ host_prefix = str (self .install_dir ).split ("/opt" )[0 ]
115
+ ld_library_path = ld_library_path .replace (str (host_prefix ), "" )
116
+
119
117
# convert LD_LIBRARY_PATH into LD_CHERI_LIBRARY_PATH for CheriBSD
120
- ld_library_path = str (self .source_dir ) + ":" + ld_library_path
121
- ld_library_path = ld_library_path .replace (str (self .source_dir ), "${rootdir}" )
122
118
ld_cheri_library_path = ld_library_path
123
119
ld_cheri_library_path += ":${LD_CHERI_LIBRARY_PATH}"
124
120
ld_library_path += ":${LD_LIBRARY_PATH}"
@@ -136,14 +132,14 @@ def _set_env(self):
136
132
endif
137
133
setenv LD_LIBRARY_PATH {LD_LIBRARY_PATH}
138
134
""" .format (LD_CHERI_LIBRARY_PATH = ld_cheri_library_path , LD_LIBRARY_PATH = ld_library_path )
139
- self .write_file (self .source_dir / 'cheri_setup.csh' , csh_script , overwrite = True )
135
+ self .write_file (self .install_dir / 'cheri_setup.csh' , csh_script , overwrite = True )
140
136
posix_sh_script = """#!/bin/sh
141
137
rootdir=`pwd`
142
138
export LD_CHERI_LIBRARY_PATH={LD_CHERI_LIBRARY_PATH}
143
139
export LD_LIBRARY_PATH={LD_LIBRARY_PATH}
144
140
""" .format (LD_CHERI_LIBRARY_PATH = ld_cheri_library_path , LD_LIBRARY_PATH = ld_library_path )
145
141
# write LD_CHERI_LIBRARY_PATH to a text file to source from sh in CheriBSD
146
- self .write_file (self .source_dir / 'cheri_setup.sh' , posix_sh_script , overwrite = True )
142
+ self .write_file (self .install_dir / 'cheri_setup.sh' , posix_sh_script , overwrite = True )
147
143
148
144
def update (self ):
149
145
super ().update ()
@@ -167,10 +163,9 @@ def install(self, **kwargs):
167
163
168
164
# call the functions to copy the poco library and create an env setup file
169
165
if not self .compiling_for_host ():
170
- self ._get_poco ()
171
166
self ._set_env ()
172
167
173
168
def run_tests (self ):
174
169
# only test when not compiling for host
175
170
if not self .compiling_for_host ():
176
- self .target_info .run_cheribsd_test_script ("run_ros2_tests.py" , mount_sourcedir = True , mount_sysroot = True )
171
+ self .target_info .run_cheribsd_test_script ("run_ros2_tests.py" , mount_sourcedir = True , mount_installdir = True , mount_sysroot = True )
0 commit comments