Strip Shared objects in solaris - solaris

I don't see any command like strip in the solaris platform. I checked in google. In one of the link, objcopy command is mentioned but that also is not present in my solaris platform. Can anyone tell the command in solaris to strip the binary or shared objects. Below is ouput of uname -a.
SunOS 5.10 Generic_Virtual i86pc i386 i86pc

The command is strip.
Per this Solaris 10 documentation, the SUNWbtool package needs to be installed.
Run either
/usr/sbin/pkgchk -l -p /usr/bin/strip
or
grep strip /var/sadm/install/contents
to see if strip was installed, but then deleted.
Also, run
grep SUNWbtool /var/sadm/install/contents
to see if the SUNWbtool package has been installed. If no lines appear, it hasn't been installed.

Related

Using local Perl module instead of one installed by CPAN

I have found it necessary to expand upon a CPAN module. (Unicode::CharName goes up to Unicode 4.1; I need some characters from Unicode 5.0 & 5.1).
I've made the changes needed and have my own CharName.pm module.
I now would like to use it with my various Perls. I currently use:
Strawberry Perl for Windows
git for Windows MINGW64; My .bashrc sets
$PATH to Strawberry perl and $PERL5LIB=/c/Strawberry/perl/vendor/lib:/c/Strawberry/perl/site/lib
WSL Ubuntu
Where should I put my version of Unicode::CharName, so that it over-rides the ones installed by CPAN?
I don't want to have to change any scripts that currently
use Unicode::CharName;
Using cpanm you could download the module, patch it, and install it as normal:
$ cpanm --look Unicode::CharName
# new shell opens
$ patch lib/Unicode/CharName.pm custom.patch # or whatever process
$ perl Makefile.PL
$ make install
$ exit
You can also install it to a local::lib to avoid overwriting it globally, by adding the -l local/ option to the cpanm command. Then you can add the absolute path of this local::lib to your PERL5LIB or via -I or use lib. If you specified /path/to/local for the -l option, it would be /path/to/local/lib/perl5.
Manually copying files rather than going through the normal installation process is likely to lead to problems. Many distributions depend on the installation process to build the modules correctly. Also, you will need to install the module separately for each Perl you want to use it for; installed Perl modules are not generally cross-compatible between Perl versions or architectures. (A strictly simple pure-Perl module can be an exception to these rules, but the only module I feel comfortable abusing this way is App::cpanminus, because it was designed to do this.)

CPAN 1.61 has issue with embedded space in path within Cygwin on Win7

I’m a mere mortal using Cygwin on Win7 and wanting to develop perl scripts using SOAP::lite. Installation instructions I found at soaplite.com directed me to start with perl –MCPAN –e shell before attempting an > install SOAP::lite
The newb in me didn’t appreciate that my windows user profile has a space character in it and the CPAN set-up seemed to go all horribly wrong around the point where the script was writing make files for local::lib, MYMETA.yml and MYYMETA.json. I got “no such file or directory” messages quoting only the portion of the path that followed the space in my user profile.
$ uname -a
CYGWIN_NT-6.1 UKLHRL00020 2.0.4(0.287/5/3) 2015-06-09 12:22 x86_64 Cygwin
$ cpan --version
Loading internal null logger. Install Log::Log4perl for logging messages
/usr/bin/cpan version 1.61 calling Getopt::Std::getopts (version 1.06 [paranoid]),
running under Perl version 5.14.4.
[Now continuing due to backward compatibility and excessive paranoia.
See ``perldoc Getopt::Std'' about $Getopt::Std::STANDARD_HELP_VERSION.]
Nothing to install!
When I ran perl –MCPAN –e shell for the first time, it did report “Warning: You do not have write permission for Perl library directories.” and I elected for the default option [local::lib] for the approach to be taken.
So what can I do next?
Looking closer at the Cygwin’s setup-x86_64.exe, a search for “cpan” lists eight packages under the perl category for perl-CPAN-* and perl-Parse-CPAN*, which are all set to “Skip”. The package perl-CPANMeta: Perl distribution CPAN-Meta is version 2.150001-1 from cygwin.mirrors.pair.com. Since this is not installed yet, but the installed Perl5 has some knowledge of an old CPAN, I need to know if it is safe to install the latest and will it work with a space in my profile? Do I need to remove the old CPAN, and how?
You probably want to update to the latest version of ExtUtils::MakeMaker, recent versions contain various fixes for paths containing spaces. This should fix these issues.

Perlbrew list and wrong version number

I installed two version of Perl using --as (naming the version with the major number only)
5.20.0 installed as 5.20 and
5.20.0 with threading installed as 5.20t
This is the output of perlbrew list
* 5.20 (5.20.0)
5.20t (5.20.0)
I then upgraded Perl to 5.20.1 using
$ perlbrew upgrade-perl
Upgrading 5.20 to 5.20.1
Installing /Users/corti/perl5/perlbrew/build/perl-5.20.1 into ~/perl5/perlbrew/perls/5.20
This could take a while. You can run the following command on another shell to track the status:
tail -f ~/perl5/perlbrew/build.perl-5.20.1.log
5.20 is successfully installed.
Perl seems to be correctly upgraded (v5.20.1):
$ perl -version
This is perl 5, version 20, subversion 1 (v5.20.1) built for darwin-2level
Copyright 1987-2014, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
But perlbrew list does not recognise the new version and calling perlbrew upgrade-perl does the upgrade again
$ perlbrew list
* 5.20 (5.20.0)
5.20t (5.20.0)
Why does perlbrew not recognise the update?
Because perlbrew checks for the existence of a file called
perls/*/.version
and uses its contents to determine which version of Perl is installed. If it doesn't find the file, it falls back to running the perl executable
perls/*/bin/perl
to determine the installed version and the creates the .version file.
The upgrade-perl command fails to update the file, so subsequent runs don't properly detect the installed version. I have filed a bug report

Command to download the package from internet in solaris

Can any one suggest a command to download the package from the interent in the solaris box?
Thanks in advance.
See https://stackoverflow.com/a/14584664/141978 from RaamEE:
The wget command in Solaris 10 is somewhat hidden from sight.
You can find it here
/usr/sfw/bin/wget
This was checked on s10u10
Then use /usr/sfw/bin/wget <url>
It's hard to tell as you provide few information but wget is a common tool to retrieve things from the Internet.
wget http://server/package.zip
If a Solaris package, pkgadd also supports URLs:
pkgadd -d http://server/package.pkg
I once needed to get wget installed on old remote Solaris 8 server (there is no /usr/sfw/ on Solaris 8).
So, after some web surfing, I did the following:
Downloaded wget-1.10.2-sol8-sparc-local.gz from http://download.nust.na/pub3/solaris/sparc/5.8/ to my Windows machine (where I always have 7-Zip installed)
Extracted wget-1.10.2-sol8-sparc-local.gz
Uploaded resulting package wget-1.10.2-sol8-sparc-local into Solaris server
Under root user executed pkgadd -d wget-1.10.2-sol8-sparc-local
Right away you can start using it as wget <URL>.

How do I install cygwin components from the command line?

Is there a tool in the Cygwin package similar to apt-get on Debian or yum on redhat that allows me to install components from the command line?
Cygwin's setup accepts command-line arguments to install packages from the command-line.
e.g. setup-x86.exe -q -P packagename1,packagename2 to install packages without any GUI interaction ('unattended setup mode').
(Note that you need to use setup-x86.exe or setup-x86_64.exe as appropriate.)
See https://cygwin.com/packages/ for the package list.
For a more convenient installer, you may want to use
apt-cyg as your package manager. Its syntax similar to
apt-get, which is a plus. For this, follow the above
steps and then use Cygwin Bash for the following steps
wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/local/bin
Now that apt-cyg is installed. Here are few examples of
installing some packages
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates
There is no tool specifically in the 'setup.exe' installer that offers the
functionality of apt-get. There is, however, a command-line package installer
for Cygwin that can be downloaded separately, but it is not entirely stable and
relies on workarounds.
apt-cyg: http://github.com/transcode-open/apt-cyg
Check out the issues tab for the project to see the known problems.
There exist some scripts, which can be used as simple package managers for Cygwin. But it’s important to know, that they always will be quite limited, because of...ehm...Windows.
Installing or removing packages is fine, each package manager for Cygwin can do that. But updating is a pain since Windows doesn’t allow you to overwrite an executable, which is currently running. So you can’t update e.g. Cygwin DLL or any package which contains the currently running executable from the Cygwin itself. There is also this note on the Cygwin Installation page:
"The basic reason for not having a more full-featured package manager is that
such a program would need full access to all of Cygwin’s POSIX functionality.
That is, however, difficult to provide in a Cygwin-free environment, such as
exists on first installation. Additionally, Windows does not easily allow
overwriting of in-use executables so installing a new version of the Cygwin
DLL while a package manager is using the DLL is problematic."
Cygwin’s setup uses Windows registry to overwrite executables which are in use
and this method requires a reboot of Windows. Therefore, it’s better to close
all Cygwin processes before updating packages, so you don’t have to reboot
your computer to actually apply the changes. Installation of a new package
should be completely without any hassles. I don’t think any of package managers
except of Cygwin’s setup.exe implements any method to overwrite files in use,
so it would simply fail if it cannot overwrite them.
Some package managers for Cygwin:
apt-cyg
Update: the repository was disabled recently due to copyright issues (DMCA takedown). It looks like the owner of the repository issued the DMCA takedown on his own repository and created a new project called Sage (see bellow).
The best one for me. Simply because it’s one of the most recent. It doesn’t use Cygwin’s setup.exe, it rather re-implements, what setup.exe does. It works correctly for both platforms - x86 as well as x86_64. There are a lot of forks with more or less additional features. For example, the kou1okada fork is one of the improved versions, which is really great.
apt-cyg is just a shell script, there is no installation. Just download it (or clone the repository), make it executable and copy it somewhere to the PATH:
chmod +x apt-cyg # set executable bit
mv apt-cyg /usr/local/bin # move somewhere to PATH
# ...and use it:
apt-cyg install vim
There is also bunch of forks with different features.
sage
Another package manager implemented as a shell script. I didn't try it but it actually looks good.
It can search for packages in a repository, list packages in a category, check dependencies, list package files, and more. It has features which other package managers don't have.
cyg-apt
Fork of abandoned original cyg-apt with improvements and bugfixes. It has quite a lot of features and it's implemented in Python. Installation is made using make.
Chocolatey’s cyg-get
If you used Chocolatey to install Cygwin, you can install the package cyg-get, which is actually a simple wrapper around Cygwin’s setup.exe written in PowerShell.
Cygwin’s setup.exe
It also has a command line mode. Moreover, it allows you to upgrade all installed packages at once (as apt-get upgrade does on Debian based Linux).
Example use:
setup-x86_64.exe -q --packages=bash,vim
You can create an alias for easier use, for example:
alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"
Then you can, for example, install Vim package with:
cyg-get vim
First, download installer at: https://cygwin.com/setup-x86_64.exe (Windows 64bit), then:
# move installer to cygwin folder
mv C:/Users/<you>/Downloads/setup-x86_64.exe C:/cygwin64/
# add alias to bash_aliases
echo "alias cygwin='C:/cygwin64/setup-x86_64.exe -q -P'" >> ~/.bash_aliases
source ~/.bash_aliases
# add bash_aliases to bashrc if missing
echo "source ~/.bash_aliases" >> ~/.profile
e.g.
# install vim
cygwin vim
# see other options
cygwin --help
I wanted a solution for this similar to apt-get --print-uris, but unfortunately apt-cyg doesn't do this. The following is a solution that allowed me to download only the packages I needed, with their dependencies, and copy them to the target for installation. Here is a bash script that parses the output of apt-cyg into a list of URIs:
#!/usr/bin/bash
package=$1
depends=$( \
apt-cyg depends $package \
| perl -ne 'while ($x = /> ([^>\s]+)/g) { print "$1\n"; }' \
| sort \
| uniq)
depends=$(echo -e "$depends\n$package")
for curpkg in $depends; do
if ! grep -q "^$curpkg " /etc/setup/installed.db; then
apt-cyg show $curpkg \
| perl -ne '
if ($x = /install: ([^\s]+)/) {
print "$1\n";
}
if (/\[prev\]/) {
exit;
}'
fi
done
The above will print out the paths of the packages that need downloading, relative to the cygwin mirror root, omitting any packages that are already installed. To download them, I wrote the output to a file cygwin-packages-list and then used wget:
mirror=http://cygwin.mirror.constant.com/
uris=$(for line in $(cat cygwin-packages-list); do echo "$mirror$line"; done)
wget -x $uris
The installer can then be used to install from a local cache directory. Note that for this to work I needed to copy setup.ini from a previous cygwin package cache to the directory with the downloaded files (otherwise the installer doesn't know what's what).
Old question, but still relevant. Here is what worked for me today (6/26/16).
From the bash shell:
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
Dawid Ferenczy's answer is pretty complete but after I tried almost all of his options I've found that the Chocolatey’s cyg-get was the best (at least the only one that I could get to work).
I was wanting to install wget, the steps was this:
choco install cyg-get
Then:
cyg-get wget
Usually before installing a package one has to know its exact name:
# define a string to search
export to_srch=perl
# get html output of search and pick only the cygwin package names
wget -qO- "https://cygwin.com/cgi-bin2/package-grep.cgi?grep=$to_srch&arch=x86_64" | \
perl -l -ne 'm!(.*?)<\/a>\s+\-(.*?)\:(.*?)<\/li>!;print $2'
# and install
# install multiple packages at once, note the
setup-x86_64.exe -q -s http://cygwin.mirror.constant.com -P "<<chosen_package_name>>"