Problems Compiling Program: "ld:fatal:relocations remain against allocatable but non-writable sections"

Posted on 2006-10-24
Last Modified: 2013-12-27

I have been, and still am, having some issues trying to compile a program. My end-game plan is to port a solution in Apache, PHP, and RRDtool, that is currently working in an Intel - Linux environment over to a SPARC Solaris v9 64 bit environment.

First my problem, then I'll provide some background. I received this error while running 'make' during the build process for RRDtool:
memcpy                              0x1ff8      /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../../libz.a(inflate.o)
memcpy                              0x2010      /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../../libz.a(inflate.o)
memcpy                              0x245c      /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../../libz.a(inflate.o)
memcpy                              0x24d0      /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.6/../../../libz.a(inflate.o)
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
make[2]: *** [] Error 1
make[2]: Leaving directory `/usr/local/src/rrdtool-1.2.15/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/rrdtool-1.2.15'
make: *** [all] Error 2

...except on my screen, the lines above the fatal error were a few hundred in length. In each one, the path starting with /usr/local/lib, and ending with /libz.a(, was the same - only the file listed in parenthesis changed. I have seen this before a couple of times trying to compile code on this Solaris, but was able to get around it by installing the binary from For this package however, this is not an option. My problems (well, my initial ones anyways) I don't know how to begin troubleshooting this error, oh, and this is my first experience compiling on a Solaris. I'm sure there are other issues, but until I get by this I won't be able to see the others.

Now for a little background. I knew I needed the freetype2 library, so I got the source and compiled it, and everything went fine, installing in the /usr/local/include and /usr/local/lib branches. When I ran configure, I received a warning stating that it couldn't find any freetype2 libraries in /usr/include, so it assumed I was installing without them. Since that wasn't what I wanted, I tried to modify LDFLAGS and CPPFLAGS to pass with configure. I must have had the syntax wrong as I received the same warning the next time. No matter how I modifed the way I was setting those variables in configure, I received the same warning. So, desperate, I coped the freetype2 files from /usr/local/include to /usr/include. This time, I did not receive the warning about freetype, but did reveive an error b/c it could not find libart. I then installed libart, letting it go to the default location of /usr/local. Now the same warning again, but this time it could not find libart in /usr/include, and /usr/lib. Knowing I could not solve this with setting flags in configure, I again copied the files from /usr/local to /usr. Now compile ran fine, but make produced the error mentioned above.

That is my current tale of woe. If anyone could provide me with any assistance, I would greatly appreciate it.

Question by:jpetter
LVL 38

Accepted Solution

yuzh earned 500 total points
ID: 17800649
For Solaris 9 you can download apache-2.X, php-5.X, mysql-5.x
openssl binary packages and other tools from:

   When you download the package, please read the download README file to make sure that you get all the dependencies as well.

If you still what to compile them from source, since you are using gcc, you need to
doneload automake, autoconfig, bison (and other package required by the PHP installation, check the php site for Solaris installation for more details). these GNU tools
are also available ffrom:

   after you install all the tools, you need to set the ENV vars:
  export PATH

   before run configure.

   please read http:Q_21032633.html

   You can also follow the instructions in:

   It is for Solaris 8, it can also apply to Solaris 9, please use the latest package instead
of the older version mentioned in the doc.


Author Comment

ID: 17806756

Thanks for all the great information. I worked through the instructions found at the link you recommended, and they were great. My compile/build environment wasn't even close to having the requisite packages installed, but that document walked me through setting it up.

I haven't had a chance yet to try to build the package that initially prompted me to ask this question. However, the info here has allowed me to straighten my system out, and that to me is worth at least the points right there. I'll close this out, and if I still have problems tomorrow with building the latest rrdtool, I'll enter another question.

Many thanks again,

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question