Home>Computers>Getting PCRE to compile on Solaris 9 SPARC

Getting PCRE to compile on Solaris 9 SPARC

So there are some folks who are still trying to run modern things on old SPARC machines still. I pulled out my old Solaris server that I used to host a backup of my website back in 2013, dusted it off and booted it up.

The web services came up flawlessly, just as they had worked then. However since a whole host of security vulnerabilities and code fixes had created a bunch of updates in the OpenCSW repository, the software repository of choice for my Sun Microsystems SPARC Solaris Boxen. Without missing a beat, not taking backups or snapshots other than the existing website and database itself, I decided to apply these updates and and just let it fly. Oh boy how we crashed and burned.

Basically installing Apache via OpenCSW just flat doesn’t work on Solaris 9 for some reason related to OpenSSL. If you disable SSL on Apache you can get the server to start. This has also created some other issues for users in this situation. For example, on system boot, you might not be able to access SSH because the service hasn’t started yet as a result of hanging whilst starting Apache because Apache will never complete starting up. I have to log in as a user over telnet or onto the local console and kill the script waiting for Apache to start before I can continue. I spent several hours trying various things after increasing the verbosity of the server for additional troubleshooting. At that point after growing frustrated with the whole thing I decided why don’t I just compile Apache, OpenSSL, and PHP on my own and install them. I’ve done this before, but it has been a while.

When you look up the requirements for compiling Apache, you will find that you need to install PCRE, APR, and APR-Util. Getting PCRE to compile and install was the one I had these troubles with as noted here.

After going through all of this, I realized that I hadn’t passed the critical -m64 argument to the compiler with the other stuff, which is critical if you plan on leveraging the full hardware availability of the CPU.

Most stuff I am able to get going with the gcc3, and binutils packages available from the OpenCSW repository. Though seemingly in order to get PCRE to compile successfully I had to use Sunstudio. Luckily for us, Sun Studio 12 will actually install and run just fine on Solaris 9, and is available on the internet in places still. (At least at the time of writing this.)

I was getting error messages like these when trying to compile:

ld: fatal: file ./.libs/libpcre.so: wrong ELF class: ELFCLASS64
configure: error: could not determine link -lib interface
ld: sparc:v9 architecture of input file . is incompatible with sparc output

When Getting this to compile I had to setup my PATH environment variable like this:

/opt/csw/bin:/usr/bin:/usr/ucb:/opt/csw/gcc3/bin:/opt/csw/gnu

Then I had to run configure to make sure that all the things I was building were built as 64 bit binaries, because my E3000 uses UltraSPARC II Processors:

./configure CFLAGS="-m64 -g" CXXFLAGS="-m64 -g" LDFLAGS="-m64 -g" --prefix=/opt/pcre

Basically all compiliation, and linking with ld is done through the first couple of paths. ar was not installed on my machine, so I had to install it from the opencsw repository. After many hours of looking over errors an d reading about other peoples problems I finally got the above to compile. Then when I ran my “sudo make install” I was greeted with this error message:

ln -sf pcre_assign_jit_stack.3           /opt/pcre/share/man/man3/pcre16_assign_jit_stack.3
Usage: ln [-f] [-s] f1
       ln [-f] [-s] f1 f2
       ln [-f] [-s] f1 ... fn d1

*** Error code 1
make: Fatal error: Command failed for target `install-data-hook'
Current working directory /storage/pcre-8.42
*** Error code 1
make: Fatal error: Command failed for target `install-data-am'
Current working directory /storage/pcre-8.42
*** Error code 1
make: Fatal error: Command failed for target `install-am'
Current working directory /storage/pcre-8.42
*** Error code 1
make: Fatal error: Command failed for target `install'

So the issue with this is that the ln command equipped with Solaris is too outdated to accept the arguments that the script is trying to pass. Since ln in included with the binutils package (If I recall correctly) in opencsw, you can install that and then you need to reverse your $PATH variable so that it is executed first.

/opt/csw/gnu:/opt/csw/bin:/usr/bin:/usr/ucb:/opt/csw/gcc3/bin

Then you can run your make install and it should behave…

5/5 - (1 vote)