Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for building synApps on a fresh Ubuntu 22 successfully #6

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
46 changes: 29 additions & 17 deletions assemble_synApps
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if ($releasefile eq "default")
$modules{'DXPSITORO'} = 'R1-3';
$modules{'DEVIOCSTATS'} = '3.1.16';
$modules{'ETHERIP'} = 'ether_ip-3-3';
$modules{'GALIL'} = 'V3-5';
$modules{'GALIL'} = 'V3-6';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Galil V3-6 does not build on Windows machines, which is why 3-5 is the default. Individual modules can be adjusted for your specifications by using the --set flag.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. I am fine with the option, of course.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Galil driver V3-6 and R3-6-85 have been patched to fix the build issue on Windows. The Galil repository name has changed recently and tag R3-6-85 was created to align the Galil repo structure to other synApps modules. I cloned this assemble_synApps repo and altered the assemble_synApps script for the Galil repo changes (see attached). After the assemble_synApps script completed successfully, I built the software by running "make" in the support folder. The software built successfully on CentOS stream 9, Windows 10 using visual studio 2019 & 2022.
assemble_synApps.txt
If the Galil driver isn't required, it can be commented out in configure/RELEASE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the update on that!

$modules{'IP'} = 'R2-22';
$modules{'IPAC'} = '2.16';
$modules{'IP330'} = 'R2-10';
Expand Down Expand Up @@ -202,11 +202,6 @@ sub get_repo {

chdir "$FOLDER_NAME";
`git checkout -q $TAG`;
chdir "..";

say $REL "$RELEASE_NAME=\$(SUPPORT)/$FOLDER_NAME";

print "\n";
}
else
{
Expand All @@ -218,12 +213,11 @@ sub get_repo {
`git stash -q`;
`git clean -fdx`;
`git checkout -q $TAG`;
chdir "..";

say $REL "$RELEASE_NAME=\$(SUPPORT)/$FOLDER_NAME";

print "\n";
}
system("mkdir -p configure; echo 'EPICS_BASE=$EPICS_BASE' >> configure/RELEASE.local");
chdir "..";
say $REL "$RELEASE_NAME=\$(SUPPORT)/$FOLDER_NAME";
print "\n";
}


Expand Down Expand Up @@ -524,15 +518,27 @@ if (exists($modules{GALIL}))

copy_recur("${FILTER_TAG}/.", "./");
rmtree("${FILTER_TAG}");

copy("./config/GALILRELEASE", "./configure/RELEASE.local");

system("mv config/* configure/");
rmtree("config");
copy("./configure/GALILRELEASE", "./configure/RELEASE.local");

add_line('-include $(TOP)/../RELEASE.local', "./configure/RELEASE");
add_line('-include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local', "./configure/RELEASE");
add_line('-include $(TOP)/configure/RELEASE.local', "./configure/RELEASE");
add_line('CONFIG = $(EPICS_BASE)/configure', "./configure/CONFIG");
add_line('include $(TOP)/configure/RELEASE', "./configure/CONFIG");
add_line('include $(CONFIG)/CONFIG', "./configure/CONFIG");
add_line('include $(EPICS_BASE)/configure/RULES_TOP', "./configure/RULES_TOP");
do_substitution('/configure/RULES', '/configure/RULES_TOP', "GalilTestApp/src/Makefile");
do_substitution('/configure/RULES', '/configure/RULES_TOP', "GalilTestApp/Db/Makefile");
do_substitution('/configure/RULES', '/configure/RULES_TOP', "GalilSup/Db/Makefile");
do_substitution('/configure/RULES', '/configure/RULES_TOP', "GalilSup/src/Makefile");


do_substitution("\QLIBRARY_IOC += GalilSupport\E", "LIBRARY_IOC_Linux \+= GalilSupport\nLIBRARY_IOC_WIN32 += GalilSupport", "GalilSup/src/Makefile");
do_substitution("PROD_IOC = GalilTest", "PROD_IOC_Linux = GalilTest\nPROD_IOC_WIN32 = GalilTest", "GalilTestApp/src/Makefile");
system("mkdir -p dbd && cp GalilSup/src/GalilSupport.dbd dbd/");

if (exists($modules{SNCSEQ}))
{
Expand Down Expand Up @@ -591,7 +597,7 @@ if (exists($modules{MEASCOMP}))

system("./configure --prefix=${PWD}");
system("make");
`make install || true`;
`sudo make install || true`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is requiring root access here? The point of line 585 is that 'make install' will install everything into its own directory. I just ran the script on Ubuntu 22 and there were no root requirements.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running this in a fresh system with a regular unprivileged user, it tries to install udev rules and modifying ld.so.cache.

Here, this first example is from the Github Action runner:

make[1]: Leaving directory '/home/runner/work/EPICS-synApps-assemble/EPICS-synApps-assemble/synapps/support/measComp-R4-2/libuldaq-1.2.1'
/usr/bin/install: cannot create regular file '/lib/udev/rules.d/50-uldaq.rules': Permission denied
make[2]: *** [Makefile:484: install-dist_rulesdataDATA] Error 1
make[1]: *** [Makefile:814: install-am] Error 2
make: *** [Makefile:511: install-recursive] Error 1

This happens after the permissions to udev are fixed:

make[2]: Leaving directory '/epics/synapps/support/measComp-R4-2/libuldaq-1.2.1/examples'
make[2]: Entering directory '/epics/synapps/support/measComp-R4-2/libuldaq-1.2.1'
make[2]: Leaving directory '/epics/synapps/support/measComp-R4-2/libuldaq-1.2.1'
make[1]: Leaving directory '/epics/synapps/support/measComp-R4-2/libuldaq-1.2.1'
Failed to send reload request: Permission denied
/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
make[3]: *** [Makefile:951: install-data-hook] Error 1
make[2]: *** [Makefile:866: install-data-am] Error 2
make[1]: *** [Makefile:814: install-am] Error 2
make: *** [Makefile:511: install-recursive] Error 1

To be sure, I removed sudo in my main branch and let it build as Github Action, the logs should be accessible for this job: https://github.com/BAMresearch/EPICS-synApps-assemble/actions/runs/8023437425/job/21919899065

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: The build logs and artifacts are listed at the bottom of the summary of a build job, here: https://github.com/BAMresearch/EPICS-synApps-assemble/actions/runs/8023437425


unlink("../configure/CONFIG_SITE.local");
add_line("USR_LDFLAGS+=-L${PWD}/lib", "../configure/CONFIG_SITE.local");
Expand Down Expand Up @@ -733,8 +739,14 @@ say $RELEASE "-include \$(SUPPORT)/RELEASE.local";
say $RELEASE "-include \$(SUPPORT)/RELEASE.\$(EPICS_HOST_ARCH).local";
say $RELEASE "-include \$(SUPPORT)/configure/RELEASE.local";
say $RELEASE "-include \$(SUPPORT)/configure/RELEASE.\$(EPICS_HOST_ARCH).local";


close($RELEASE);

`make release`;
system("make release"); # system() forwards output and errors of the command

if (exists($modules{GALIL}))
{
# copy updated RELEASE.local with correct paths to expected GALILRELEASE file
chdir "Galil-3-0-$modules{GALIL}/configure";
copy("RELEASE.local", "GALILRELEASE");
chdir "../..";
}