PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: building sybperl on 12.0 but deploying on 12.5 too.
Date: Dec 2 2002 11:13PM

On Mon, 2002-12-02 at 14:02, jmcallister@dtint.com wrote:
> Hi Michael (and other Sybperl gurus),
> 
> I'm building sybperl 2.15 on Solaris 8. The Sybase version on the
> build server  is 12.0, however, the modules may be deployed on systems
> with ASE 12.5 or 12.0. I'm trying to avoid having to make symlinks
> (OCS-12_0 ---> OCS-12_5) to fake out sybperl when it's on an ASE 12.5
> server.
> 
> What's more, I also want the Sybase::CTlib module to magically figure
> out where Sybase is installed when it is loaded in a "terse"
> environment, say from cron or init. When I say "magic", I really just
> want it to use the environment variables if defined, next try the
> sybase user home account, and finally try some reasonable default
> (/usr/local/sybase). I've built it with EMBED_SYBASE=1 and
> EMBED_SYBASE_USE_HOME=1, but it seems to only check the sybase home
> account during the config phase, not dynamically after deployment.
>
> As far as the library files goes I want it to adapt to whatever is
> installed (lib, OCS-12_0, OCS-12_5, OCS-*). I can live with making a
> symlink ~sybase/lib ---> ~sybase/OCS-12_x/lib, but would rather not
> have to fake a version that's not installed.

First let's clarify some issues about env. variables, home directories,
etc for Sybase client apps (i.e. apps that use Client Library).

1. The $SYBASE env. variable is used to find the interfaces file, and to
find the locales related information. If the $SYBASE env. variable is
not set the the Sybase user's home directory is used.

2. On Solaris the location of the Sybase .so files (i.e. the libs
providing the open client functionality) is coded into the CTlib.so
file. This can be overridden with the LD_LIBRARY_PATH variable, but this
variable *must* be set before the program that needs to use it starts.

On Solaris scripts that run under cron usually get a very minimal
environment. I don't know if recent versions of Solaris allow you to
specify env. values in the crontab entry - that would be needed if you
needed to specify/set LD_LIBRARY_PATH to run a script.

Anyway - if you wanted to have an environment that was
coherent/consistent across your 12.0 and 12.5 systems I would suggest
doing the following:

In the Sybase install tree, always have a softlink for OCS-12_x to OCS
(this is already present for 12.5). Now always set SYBASE_OCS to OCS.
If possible always have the root of your Sybase installation tree in the
same place on all the machines (f.ex. /opt/sybase/... - even if that's a
symbolic link to /opt/sybase-12.5/).

If you can have this setup you can build sybperl with a 12.0 open
client, and it should work with no problems with both 12.0 and 12.5
installations.

Now if you can't have this setup, then there are of course two issues.

The first is finding the root of the Sybase installation tree. This can
be done in a BEGIN{} block in CTlib.pm. Theoretically using EMBED_SYBASE
and EMBED_SYBASE_USE_HOME *should* work - it should put something like
this in CTlib.pm:

BEGIN {
    if(!$ENV{'SYBASE'}) {
        if(@_ = getpwnam("sybase")) {
            $ENV{'SYBASE'} = $_[7];
        } else {
            $ENV{'SYBASE'} = 'your build-time SYBASE directory';
        }
    }
}

This still doesn't take care of the Sybase library location, for which
you will either have to symlink things to a standard location or make
sure that LD_LIBRARY_PATH is set before the scripts run...

Michael
-- 
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!