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

EPICS host arch guess doesn't work on ARM #2

Open
Araneidae opened this issue Apr 9, 2020 · 5 comments
Open

EPICS host arch guess doesn't work on ARM #2

Araneidae opened this issue Apr 9, 2020 · 5 comments

Comments

@Araneidae
Copy link
Collaborator

The code in mydbstatic.py at https://github.com/Araneidae/epicsdbbuilder/blob/84846091f6faccbc61bb6499a0f7835f4d829d89/epicsdbbuilder/mydbstatic.py#L57 used to figure out the path to the EPICS libraries fails for a linux-arm architecture. The key problem is that we're trying to second guess the computation of EPICS_HOST_ARCH in $EPICS_BASE/lib/perl/EpicsHostArch.pl.

Maybe it'll be simpler to literally just call this script!

@hanak
Copy link
Contributor

hanak commented Jan 15, 2021

Perl is used with EPICS build system I think. Recently, I have created an IOC which can read EPICS DB. With this IOC, one can develop an EPICS IOC without touching any C/C++, any EPICS build system component, and any Perl. Also, Perl might not need to be even installed. So far, epicsdbbuilder requires just the EPICS binaries and DBD. Is the automatic guess by EPICS worth a new dependency on the Perl?

@Araneidae
Copy link
Collaborator Author

Good point, am happy to avoid a Perl dependency. But do we really ever have an installation of EPICS without the complete build system?

Certainly an alternative fix to this issue would simply be to do a better job at emulating EpicsHostArch.pl. In fact, here it is in its (3.14.12.7) entirety:

use Config;
use POSIX;

$suffix="";
$suffix="-".$ARGV[0] if ($ARGV[0] ne "");

$EpicsHostArch = GetEpicsHostArch();
print "$EpicsHostArch$suffix";

sub GetEpicsHostArch { # no args
    $arch=$Config{'archname'};
    if ($arch =~ /sun4-solaris/)        { return "solaris-sparc";
    } elsif ($arch =~ m/i86pc-solaris/) { return "solaris-x86";
    } elsif ($arch =~ m/i[3-6]86-linux/){ return "linux-x86";
    } elsif ($arch =~ m/x86_64-linux/)  { return "linux-x86_64";
    } elsif ($arch =~ m/arm-linux/)     { return "linux-arm";
    } elsif ($arch =~ m/MSWin32-x86/)   { return "win32-x86";
    } elsif ($arch =~ m/MSWin32-x64/)   { return "windows-x64";
    } elsif ($arch =~ m/cygwin/)        {
            my($kernel, $hostname, $release, $version, $cpu) = POSIX::uname();
            if ($cpu =~ m/x86_64/)      { return "cygwin-x86_64";  }
            return "cygwin-x86";
    } elsif ($arch =~ m/darwin/)        {
            my($kernel, $hostname, $release, $version, $cpu) = POSIX::uname();
            if ($cpu =~ m/Power Macintosh/) { return "darwin-ppc";  }
            elsif ($cpu =~ m/i386/)         { return "darwin-x86";  }
            elsif ($cpu =~ m/x86_64/)       { return "darwin-x86";  }
            else                            { return "unsupported"; }
    } else { return "unsupported"; }
}

Think the main challenge will be to find the right Python calls to get the appropriate architecture fields.

@hanak
Copy link
Contributor

hanak commented Jan 21, 2021

About a use case. I think I might a have a use of for EPICS without an EPICS Build System. Consider you want to develop an IOC which talks to a device over TCP/IP. The device supports simple ASCII-based protocol. And, this can be handled by StreamDevice. Thus, the only thing you need is a pre-built IOC which supports StreamDevice. On you got those, you can start working on your integration and control loops immediately.

About a script. It looks like the script is not able to guess cross-compilation (win32-x86-mingw). I think Python is able to tell you details about the processor. However, I do not have access to an ARM machine in order to tell whether this is usable there.

@Araneidae
Copy link
Collaborator Author

I have access to classic 32-bit ARM machines, but not an 64-bit ARMv8 yet. I think it's worth looking at a pure Python version of this script then.

@hanak
Copy link
Contributor

hanak commented Jan 21, 2021

Maybe, a solution could be to guess what the script can guess and if the script is uncertain, print out the evidence available and fail with a suggestion to extend the script. I think this should be sufficient to make a change in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants