Some compilation info

If you're coding on or porting to IRIX, this is the forum for discussion.
User avatar
LarBob
Posts: 62
Joined: Mon Dec 25, 2017 4:08 pm
Location: Kentucky, United States
Contact:

Some compilation info

Post by LarBob » Thu Jul 19, 2018 6:22 pm

In this topic, I'll update everyone with a list of things I've compiled and how it was done. A lot of these are very simple as long as you have a modern GCC version on your machine. Also, if you want to tackle most things, use --without-gnu-ld as the GNU linker is broken on IRIX.
Assume that I'm using gcc 4.7.1 in all of these. They are also built for Irisware. If you wish to build things for Irisware as well, make sure to use -O2 in your CFLAGS+CXXFLAGS.
Click "show" to see how to compile GCC 4.7.3Show
As far as I know, this is the first guide on compiling GCC 4.7.3 on IRIX. Hopefully this will be pretty useful! A lot of this guide is copy+pasted from the last one and then just changed and added to where needed. Most of the configure lines are different and there's even a patch that wasn't necessary with 4.7.1.
gcc.sum results (testsuite invoked with gmake -k -j5 check-gcc)Show

Code: Select all

                === gcc Summary ===

# of expected passes            75096
# of unexpected failures        24
# of expected failures          112
# of unsupported tests          1236
/var/tmp/gccbuild/gcc-objs/gcc/xgcc  version 4.7.3 (GCC)
Prerequisites
neko texinfo, neko m4, neko tar, neko wget and at least GCC 4.3.x (all available in Nekoware)
NOTE: I tested with GCC 4.7.1, so if you have trouble compiling with GCC 4.3.x, try doing this with 4.7.1.
A decently fast machine (4.7.1 took 16+ hours to compile on my 2x 250 MHz Octane, luckily I'm using Calcifer for compilation now...)

CFLAGS and CXXFLAGS
IRISWare requires the -O2 flag.

PATH stuff
Obviously make sure the GCC version you're going to be compiling with is in your PATH.
Also, make sure to set LD_LIBRARY_PATH properly, e.g. if you're compiling with 4.7.1 configured for IRISWare and using csh/tcsh:

Code: Select all

setenv LD_LIBRARY_PATH /opt/local/gcc47/lib:/opt/local/gcc47/lib64:/opt/local/gcc47/lib32
Getting stuff

Make a folder in /var/tmp called gccbuild. After making it, cd there.
Next, open up your favorite editor and save this, chmod +x it, and run it to download everything you need.

Code: Select all

wget ftp://ftp.gmplib.org/pub/gmp-5.1.3/gmp-5.1.3.tar.bz2
wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2
wget ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.bz2
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.1.tar.gz
wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.3/gcc-4.7.3.tar.bz2
tar jxf gmp-5.1.3.tar.bz2 && tar jxf binutils-2.23.2.tar.bz2 && tar jxf mpfr-3.1.2.tar.bz2 && tar zxf mpc-1.0.1.tar.gz && tar jxf gcc-4.7.3.tar.bz2
rm *.tar.bz2 *.tar.gz
Building
Unless otherwise stated, to build each project, cd into the directory, run the configure line I've provided, and then make by the use of

Code: Select all

gmake -j[amount of CPUs +1]
. For example, on my Octane I used

Code: Select all

gmake -j3
. I've heard it's a good rule of thumb to use one more CPU than you have as it makes sure they stay fed. This most definitely applies to modern systems, and it won't really hurt here. Also, it is a good idea to run

Code: Select all

gmake -j[amount of CPUs +1] check
after compiling gmp and binutils, but it is not absolutely necessary if you are willing to live on the edge and go without these checks.

Patches
libgomp must be patched in order to correctly detect the number of CPUs.
Create /opt/local/patches/gcc473-libgomp.patch with this inside:

Code: Select all

diff -urnp libgomp-orig/config/posix/proc.c libgomp/config/posix/proc.c
*** libgomp-orig/config/posix/proc.c    Sat Dec  8 14:57:52 2012
--- libgomp/config/posix/proc.c Sat Dec  8 14:58:43 2012
***************
*** 38,43 ****
--- 38,48 ----
  #endif
  
  
+ #ifdef __sgi
+ #define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
+ #endif
+ 
+ 
  /* At startup, determine the default number of threads.  It would seem
     this should be related to the number of cpus online.  */
dwarf2cfi.c must be patched in order to prevent an error during the GCC build
Create /opt/local/patches/gcc473-dwarf2cfi.patch

Code: Select all

--- dwarf2cfi.c	2012-01-10 00:28:55.000000000 -0800
+++ dwarf2cfi_patch.c	2018-07-20 14:42:17.251616220 -0700
@@ -1240,6 +1240,10 @@
 
   add_cfi_restore (regno);
   update_row_reg_save (cur_row, regno, NULL);
+  if (REG_P (INCOMING_RETURN_ADDR_RTX)
+	&& regno == dwf_regno (INCOMING_RETURN_ADDR_RTX)
+	&& regno != DWARF_FRAME_RETURN_COLUMN)
+    reg_save (DWARF_FRAME_RETURN_COLUMN, regno, 0);
 }
 
 /* A subroutine of dwarf2out_frame_debug, process a REG_CFA_WINDOW_SAVE.
Configure lines
After each is done building, you should run gmake install
gmp

Code: Select all

./configure --prefix=/opt/local/gcc473 --enable-cxx CPPFLAGS=-fexceptions ac_cv_type_uint_least32_t=no
mpfr

Code: Select all

./configure --prefix=/opt/local/gcc473 --with-gmp-include=/opt/local/gcc473/include --with-gmp-lib=/opt/local/gcc473/lib
mpc

Code: Select all

./configure --prefix=/opt/local/gcc473 --with-gmp-include=/opt/local/gcc473/include --with-gmp-lib=/opt/local/gcc473/lib --with-mpfr-include=/opt/local/gcc473/include --with-mpfr-lib=/opt/local/gcc473/lib
IMPORTANT NOTE:
If the configure line for binutils/gcc is too long, save it in a file first then run it with

Code: Select all

sh filename
.

binutils
Configure & build binutils in a separate directory:

Code: Select all

cd .. && mkdir bu-objs && cd bu-objs

../binutils-2.23.2/configure --prefix=/opt/local/gcc473 --enable-obsolete --with-gmp-include=/opt/local/gcc473/include --with-gmp-lib=/opt/local/gcc473/lib --with-mpfr-include=/opt/local/gcc473/include --with-mpfr-lib=/opt/local/gcc473/lib --with-mpc-include=/opt/local/gcc473/lib --with-mpc-lib=/opt/local/gcc473/lib --without-ppl --without-cloog --without-isl --disable-werror
gcc
Also configured & built gcc in a separate directory

Code: Select all

cd ../gcc-4.7.1 && patch < /opt/local/patches/gcc473-libgomp.patch && cd gcc && patch < /opt/local/patches/gcc473-dwarf2cfi.patch

cd /var/tmp/gccbuild && mkdir gcc-objs && cd gcc-objs

../gcc-4.7.3/configure --prefix=/opt/local/gcc473 --enable-obsolete --with-as=/opt/local/gcc473/bin/as --with-gnu-as --with-gmp-include=/opt/local/gcc473/include --with-gmp-lib=/opt/local/gcc473/lib --with-mpfr-include=/opt/local/gcc473/include --with-mpfr-lib=/opt/local/gcc473/lib --with-mpc-include=/opt/local/gcc473/include --with-mpc-lib=/opt/local/gcc473/lib --enable-languages=c,c++ --without-ppl --without-cloog --without-isl --without-gnu-ld --with-ld=/usr/bin/ld --with-abi=n32
IMPORTANT NOTE: There is an issue that rears its head when working with gcc compilation in IRIX which seems to be undocumented in other guides. The default IRIX environment space is only 20K, that that is too small for one of the commands gmake install needs to run to install gcc. You can remedy this by running

Code: Select all

systune ncargs 65536
, which gives you 64K of argument/environment space.

Post-build cleanup
My GCC 4.7.1 has some info on how to clean up a bit after getting it all compiled, but I don't really recommend it as it gets rid of some stuff that are useful if you want to run checks and things like that.

Checking
It is a good idea to run some gcc testsuites. Be warned, though, that these can take quite a long time.

Code: Select all

gmake check-gcc-c
gmake check-target-libgomp
gmake check-gcc-c++
gmake check-target-libstdc++-v3
Click "show" to see how to compile latest OpenSSL stableShow
NOTE: At time of writing, OpenSSL 1.1.0h was the latest stable release.
You need neko_perl from the beta repo for this.
OpenSSL still works perfectly on IRIX as far as I can see, the latest version compiled without a hitch like this:

Code: Select all

./Configure irix64-mips4-gcc --prefix=/opt/local && gmake -j5 && gmake install
Click "show" to see how to compile latest Vim stableShow
NOTE: At time of writing, Vim 8.1 was the latest stable release.
Vim still works well on IRIX as far as I can see, however, if you're going to be using it on a server, you do not want X support as it causes vim to take a long time to start since it tries to hook to a nonexistent X server.

Code: Select all

./configure --prefix=/opt/local --enable-gui=no --without-x && gmake -j5 && gmake install
Older guides:
Click "show" to see how to compile GCC 4.7.1 (soon to be outdate…Show
There was already a thread on Nekochan about compiling 4.6.3 on IRIX, there's also a Chinese webpage that details installing 4.7.1.
Since Nekochan is down, I figured I should make a thread on how to do it here. Also, there are a things I came across that none of those aforementioned guides mentioned. Also, we're going to be compiling this assuming it's going to be packaged for IRISWare.

Prerequisites
neko texinfo, neko m4, neko perl, neko tar, neko wget and at least gcc 4.3.x (all available in Nekoware)
A decently fast machine (took 16+ hours to compile on my 2x 250 MHz Octane)

CFLAGS and CXXFLAGS
IRISWare requires the -O2 flag.

PATH stuff
Obviously make sure the GCC version you're going to be compiling with is in your PATH.
Also, make sure to set LD_LIBRARY_PATH properly, e.g. if you're compiling with 4.3.x and using csh:

Code: Select all

setenv LD_LIBRARY_PATH /usr/nekoware/gcc-4.3/lib:/usr/nekoware/gcc-4.3/lib32
Getting stuff
I'd recommend making a folder called gccbuild or something like that in /var/tmp. After making it, cd there.
Next, open up your favorite editor and save this, chmod +x it, and run it to download everything you need.

Code: Select all

wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2
wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.1.tar.bz2
wget ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.1.tar.bz2
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.1.tar.gz
wget http://www.bugseng.com/products/ppl/download/ftp/releases/0.11/ppl-0.11.tar.gz
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-0.15.11.tar.gz
wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.1/gcc-4.7.1.tar.bz2
tar jxf gmp-5.0.5.tar.bz2 && tar jxf binutils-2.23.1.tar.bz2 && tar jxf mpfr-3.1.1.tar.bz2 && tar zxf mpc-1.0.1.tar.gz && tar zxf ppl-0.11.tar.gz && tar zxf cloog-ppl-0.15.11.tar.gz && tar jxf gcc-4.7.1.tar.bz2
rm *.tar.bz2 *.tar.gz
Building
Unless otherwise stated, to build each project, cd into the directory, run the configure line I've provided, and then make by the use of

Code: Select all

gmake -j[amount of CPUs +1]
. For example, on my Octane I used

Code: Select all

gmake -j3
. I've heard it's a good rule of thumb to use one more CPU than you have as it makes sure they stay fed. This most definitely applies to modern systems, and it won't really hurt here. Also, it is a good idea to run

Code: Select all

gmake -j[amount of CPUs +1] check
after compiling PPL, CLooG-PPL, and binutils, but it is not absolutely necessary if you are willing to live on the edge and go without these checks.

Patches
libgomp must be patched in order to correctly detect the number of CPUs.
Create /opt/local/patches/gcc47-libgomp.patch with this inside:

Code: Select all

diff -urnp libgomp-orig/config/posix/proc.c libgomp/config/posix/proc.c
*** libgomp-orig/config/posix/proc.c    Sat Dec  8 14:57:52 2012
--- libgomp/config/posix/proc.c Sat Dec  8 14:58:43 2012
***************
*** 38,43 ****
--- 38,48 ----
  #endif
  
  
+ #ifdef __sgi
+ #define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
+ #endif
+ 
+ 
  /* At startup, determine the default number of threads.  It would seem
     this should be related to the number of cpus online.  */
Configure lines
After each is done building, you should run gmake install
gmp

Code: Select all

./configure --disable-shared --enable-static --prefix=/opt/local/gcc47 --enable-cxx CPPFLAGS=-fexceptions
IMPORTANT NOTE:
You may experience an error during compilation due to a lack of uint_least32_t for C++ on IRIX. If so, gmake clean then configure again with this command then try building:

Code: Select all

./configure --disable-shared --enable-static --prefix=/opt/local/gcc47 --enable-cxx CPPFLAGS=-fexceptions ac_cv_type_uint_least32_t=no
mpfr

Code: Select all

./configure --disable-shared --enable-static --prefix=/opt/local/gcc47 --with-gmp=/opt/local/gcc47
mpc

Code: Select all

./configure --disable-shared --enable-static --prefix=/opt/local/gcc47 --with-gmp=/opt/local/gcc47 --with-mpfr=/opt/local/gcc47
ppl

Code: Select all

./configure --disable-shared --enable-static --prefix=/opt/local/gcc47 --with-gmp-prefix=/opt/local/gcc47 --without-java --disable-watchdog --disable-ppl_lcdd --disable-ppl_lpsol --disable-ppl_pips CPPFLAGS=-fexceptions
IMPORTANT NOTE: We don't have getopt_long. Before compiling:
* delete D["HAVE_GETOPT_H"]=" 1" line in config.status
* edit config.h + src/ppl.hh.dist to change lines w/ HAVE_GETOPT_H to comments
If you get an error regarding a missing warnings.pm, set the PERL5LIB environment variable to the nekoware perl5 lib folder. Example for csh:

Code: Select all

setenv PERL5LIB /usr/nekoware/lib/perl5/5.8.9
cloog-ppl

Code: Select all

./configure --disable-shared --enable-static --prefix=/opt/local/gcc47 --with-gmp=/opt/local/gcc47 --with-ppl=/opt/local/gcc47
IMPORTANT NOTE:
If the configure line for binutils/gcc is too long, save it in a file first then run it with

Code: Select all

sh filename
.

binutils
Configure & build binutils in a separate directory:

Code: Select all

cd .. && mkdir bu-objs && cd bu-objs

../binutils-2.23.1/configure --prefix=/opt/local/gcc47 --with-gmp=/opt/local/gcc47 --with-mpfr=/opt/local/gcc47 --with-mpc=/opt/local/gcc47 --with-ppl=/opt/local/gcc47 --with-cloog=/opt/local/gcc47 --with-host-libstdcxx=/usr/nekoware/gcc-4.3/lib32/libstdc++.a --disable-libssp --disable-nls --disable-lto --disable-ld --disable-gold --disable-werror --without-docdir
gcc
Also configured & built gcc in a separate directory

Code: Select all

cd ../gcc-4.7.1 && patch < /opt/local/patches/gcc47-libgomp.patch

cd .. && mkdir gcc-objs && cd gcc-objs

../gcc-4.7.1/configure --prefix=/opt/local/gcc47 --with-gmp=/opt/local/gcc47 --with-mpfr=/opt/local/gcc47 --with-mpc=/opt/local/gcc47 --with-cloog=/opt/local/gcc47 --with-ppl=/opt/local/gcc47 --with-as=/opt/local/gcc47/bin/as --with-gnu-as --without-gnu-ld --with-ld=/usr/bin/ld --with-host-libstdcxx=/usr/nekoware/gcc-4.3/lib32/libstdc++.a --disable-libssp --disable-nls --disable-lto --disable-shared --enable-static --enable-threads=posix --enable-libgomp --enable-obsolete --enable-checking=release --enable-languages=c,c++ --with-arch=mips4 --with-abi=n32
IMPORTANT NOTE: There is an issue that rears its head when working with gcc compilation in IRIX which seems to be undocumented in the previous guides. The default IRIX environment space is only 20K, that that is too small for one of the commands gmake install needs to run to install gcc. You can remedy this by running

Code: Select all

systune ncargs 65536
, which gives you 64K of argument/environment space.

Post-build cleanup
You can free up some space after the build by running

Code: Select all

rm -r /opt/local/gcc47/share/doc /opt/local/gcc47/share/aclocal /opt/local/gcc47/share/man/man3 /opt/local/gcc47/share/man/man7 /opt/local/gcc47/share/man/man1/ppl-config.1 /opt/local/gcc47/share/info /opt/local/gcc47/lib/*.{a,la} /opt/local/gcc47/bin/ppl-config /opt/local/gcc47/include/{ansidecl.h,bfd.h,bfdlink.h,cloog,dis-asm.h,gmp.h,gmpxx.h,mpc.h,mpf2mpfr.h,mpfr.h,ppl.hh,ppl_c.h,symcat.h}

strip -s /opt/local/gcc47/bin/* /opt/local/gcc47/mips-sgi-irix6.5/bin/* /opt/local/gcc47/libexec/gcc/mips-sgi-irix6.5/4.7.1/* /opt/local/gcc47/libexec/gcc/mips-sgi-irix6.5/4.7.1/install-tools/fixincl /opt/local/gcc47/libexec/gcc/mips-sgi-irix6.5/4.7.1/plugin/gengtype
Checking
It is a good idea to run some gcc testsuites. Be warned, though, that these can take quite a long time.

Code: Select all

gmake check-gcc-c
gmake check-target-libgomp
gmake check-gcc-c++
gmake check-target-libstdc++-v3
Downloads:
Compiled GCC 4.7.3 build (secure)
Last edited by LarBob on Mon Aug 06, 2018 7:44 pm, edited 10 times in total.
:Octane: Aezora - Octane - 2xR10k 250 MHz - SI Graphics - 1 GB RAM - 6.5.30f
:O2: Kiki - O2 - R5k 180 MHz - 192 MB RAM - Currently dead
:O3x0-2: Calcifer - Origin 300 - 4xR14k 500 MHz - 2 GB RAM - 6.5.30m
:O3x0-2: Tohru - Origin 350 - 4xR16k 800 MHz - 4 GB RAM - 6.5.30m - on loan from Raion
Mirrors

TruHobbyist
Posts: 25
Joined: Tue May 15, 2018 12:04 am

Re: Some compilation info

Post by TruHobbyist » Fri Jul 20, 2018 11:11 am

Thanks!!! Should save a lot of people a lot of time.

User avatar
LarBob
Posts: 62
Joined: Mon Dec 25, 2017 4:08 pm
Location: Kentucky, United States
Contact:

Re: Some compilation info

Post by LarBob » Fri Jul 20, 2018 4:31 pm

TruHobbyist wrote:
Fri Jul 20, 2018 11:11 am
Thanks!!! Should save a lot of people a lot of time.
No problem. I hope to add more things in the future, sorry about the scarcity right now. Currently working on getting a good build of GCC 4.7.3.
:Octane: Aezora - Octane - 2xR10k 250 MHz - SI Graphics - 1 GB RAM - 6.5.30f
:O2: Kiki - O2 - R5k 180 MHz - 192 MB RAM - Currently dead
:O3x0-2: Calcifer - Origin 300 - 4xR14k 500 MHz - 2 GB RAM - 6.5.30m
:O3x0-2: Tohru - Origin 350 - 4xR16k 800 MHz - 4 GB RAM - 6.5.30m - on loan from Raion
Mirrors

User avatar
gijoe77
Posts: 222
Joined: Fri Jun 22, 2018 9:17 pm

Re: Some compilation info

Post by gijoe77 » Sat Jul 21, 2018 9:13 pm

here are my notes for openssl 1.1.0h:
SpoilerShow
gcc version:

#need beta/neko_perl-5.24.0.tardist for this.

Code: Select all

export CC=/usr/nekoware/gcc-4.7/bin/gcc
export CXX=/usr/nekoware/gcc-4.7/bin/g++
export CFLAGS="-std=gnu99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -O2 -mips4"

#Configure script - line 1 change:

Code: Select all

#! /usr/bin/env perl 
#to
#! /usr/bin/env perl5.24.0
# if get error:

Code: Select all

-----> gmake[1]: execvp: /bin/sh: Arg list too long
-----> gmake[1]: *** [depend] Error 127
#to fix this, as root:

Code: Select all

-bash-4.3$ systune ncargs
        ncargs = 20480 (0x5000)

systune -i
ncargs 131072
y
quit
reboot

Code: Select all

./Configure irix64-mips4-gcc --prefix=/usr/local
gmake
-----> many issues,use nekoware versions of pod2* software, make sure nekoware version is first in $PATH

Code: Select all

su -
export PATH=/usr/nekoware/bin:$PATH

gmake install
MIPSpro version:
same fixes as above

Code: Select all

export CC=cc
export CXX=CC
export CFLAGS="-c99 -g0 -O3 -mips4 -n32"
export CXXFLAGS="-g0 -O3 -mips4 -n32"

Code: Select all

./Configure irix64-mips4-cc --prefix=/usr/local
gmake
Last edited by gijoe77 on Sat Jul 21, 2018 9:46 pm, edited 2 times in total.

User avatar
gijoe77
Posts: 222
Joined: Fri Jun 22, 2018 9:17 pm

Re: Some compilation info

Post by gijoe77 » Sat Jul 21, 2018 9:41 pm

my notes on libarchive3.3.2:
SpoilerShow
#install openssl 1.1.0h first, I installed in/with prefix=/usr/local

gcc version:

Code: Select all

export CC=/usr/nekoware/gcc-4.7/bin/gcc
export CXX=/usr/nekoware/gcc-4.7/bin/g++
export CFLAGS="-std=gnu99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -O2 -mips4
./configure --prefix=/usr/local --includedir=/usr/local,/usr/nekoware -disable-bsdtar -disable-bsdcpio -disable-bsdcat
gmake 
MIPSpro version:

Code: Select all

export CC=cc
export CXX=CC
export CFLAGS="-c99 -g0 -O2 -mips4 -I/usr/nekoware/include -I/usr/local/include"
export CXXFLAGS="-g0 -O2 -mips4"

./configure --prefix=/usr/local --includedir=/usr/local,/usr/nekoware -disable-bsdtar -disable-bsdcpio -disable-bsdcat
gmake
#If i leave off "-disable-bsdtar -disable-bsdcpio -disable-bsdcat" I get this error:
with gcc:

Code: Select all

./configure --prefix=/usr/local --includedir=/usr/local,/usr/nekoware
gmake
...
 CCLD     bsdtar
ld32: WARNING 84 : /usr/nekoware/lib/libxml2.so is not used for resolving any symbol.
ld32: ERROR   33 : Unresolved data symbol "dirfd" -- 1st referenced by ./.libs/libarchive.a(archive_read_disk_posix.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved data symbol "HMAC_CTX_new" -- 1st referenced by ./.libs/libarchive.a(archive_hmac.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved data symbol "HMAC_CTX_free" -- 1st referenced by ./.libs/libarchive.a(archive_hmac.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved data symbol "EVP_CIPHER_CTX_reset" -- 1st referenced by ./.libs/libarchive.a(archive_cryptor.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: INFO    152: Output file removed because of error.
collect2: error: ld returned 2 exit status
gmake[1]: *** [bsdtar] Error 1
gmake[1]: Leaving directory `/usr/people/gijoe77/dev/libarchive/libarchive-3.3.2'
gmake: *** [all] Error 2
MIPSpro error:

Code: Select all

./configure --prefix=/usr/local --includedir=/usr/local,/usr/nekoware
  CCLD     bsdtar
ld32: WARNING 84 : /usr/nekoware/lib/libxml2.so is not used for resolving any symbol.
ld32: ERROR   33 : Unresolved text symbol "dirfd" -- 1st referenced by ./.libs/libarchive.a(archive_read_disk_posix.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzDecompressEnd" -- 1st referenced by ./.libs/libarchive.a(archive_read_support_format_7zip.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzDecompressInit" -- 1st referenced by ./.libs/libarchive.a(archive_read_support_format_7zip.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzDecompress" -- 1st referenced by ./.libs/libarchive.a(archive_read_support_format_7zip.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzCompressInit" -- 1st referenced by ./.libs/libarchive.a(archive_write_add_filter_bzip2.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzCompressEnd" -- 1st referenced by ./.libs/libarchive.a(archive_write_add_filter_bzip2.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzCompress" -- 1st referenced by ./.libs/libarchive.a(archive_write_add_filter_bzip2.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzlibVersion" -- 1st referenced by ./.libs/libarchive.a(archive_version_details.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "HMAC_CTX_new" -- 1st referenced by ./.libs/libarchive.a(archive_hmac.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "HMAC_CTX_free" -- 1st referenced by ./.libs/libarchive.a(archive_hmac.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "EVP_CIPHER_CTX_reset" -- 1st referenced by ./.libs/libarchive.a(archive_cryptor.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: INFO    152: Output file removed because of error.
gmake[1]: *** [bsdtar] Error 2
here is the warning from the gcc compiler:

Code: Select all

 CC       libarchive/archive_read_disk_posix.lo
libarchive/archive_read_disk_posix.c: In function 'tree_dir_next_posix':
libarchive/archive_read_disk_posix.c:2367:4: warning: implicit declaration of function 'dirfd' [-Wimplicit-function-declaration]
here are the lines from "libarchive/archive_read_disk_posix.c:2367":

Code: Select all

2349 static int
2350 tree_dir_next_posix(struct tree *t)
2351 {
2352 	int r;
2353 	const char *name;
2354 	size_t namelen;
2355 2350 
2356 	if (t->d == NULL) {
2357 #if defined(USE_READDIR_R)
2358 		size_t dirent_size;
2359 #endif
2360 
2361 #if defined(HAVE_FDOPENDIR)
2362		t->d = fdopendir(tree_dup(t->working_dir_fd));
2363 #else /* HAVE_FDOPENDIR */
2364		if (tree_enter_working_dir(t) == 0) {
2365			t->d = opendir(".");
2366 #if HAVE_DIRFD || defined(dirfd)
2367			__archive_ensure_cloexec_flag(dirfd(t->d));
2368 #endif
2360		}
2370 #endif /* HAVE_FDOPENDIR */
if someone has some insight into these errors that would be great

User avatar
Raion-Fox
Founder
Posts: 199
Joined: Fri Nov 17, 2017 12:23 am
Location: Virginia
Contact:

Re: Some compilation info

Post by Raion-Fox » Sat Jul 21, 2018 10:32 pm

The linker errors are because the IRIX linker is picky about what gets linked when. Perl has some notes on this:
https://fossies.org/linux/perl/hints/irix_6.sh
I'm the manager

Besides irix.cc, I run these sites:

projectkitsune.com

kazuo.io

User avatar
gijoe77
Posts: 222
Joined: Fri Jun 22, 2018 9:17 pm

Re: Some compilation info

Post by gijoe77 » Sat Jul 21, 2018 11:18 pm

Raion-Fox wrote:
Sat Jul 21, 2018 10:32 pm
The linker errors are because the IRIX linker is picky about what gets linked when. Perl has some notes on this:
https://fossies.org/linux/perl/hints/irix_6.sh
yes the IRIX ld is a strange beast, but I'm not sure I was really able to appreciate what you posted - I see some notes and comments about IRIX and various compiler issues, can you help me zero in on what you wanted me to see?

User avatar
Raion-Fox
Founder
Posts: 199
Joined: Fri Nov 17, 2017 12:23 am
Location: Virginia
Contact:

Re: Some compilation info

Post by Raion-Fox » Sun Jul 22, 2018 2:14 am

So I did some more research into the issues and it may not be a link order, so while the document I posted is helpful for some linker and other compiler idiosyncrasies, I think that I found some better info. Please also attach your config.log, if you don't mind gijoe.

For the first unresolved symbol dirfd, I found this: https://bugs.freedesktop.org/show_bug.cgi?id=8754 This was also an issue with dbus.

Comment no. 8 by Steve Johns said this:
I don't believe that there is a problem with the linker, since I have never
had a problem with it in the past. I generally use the native Irix MIPS-Pro
linker, but I just attempted to use the GNU v3.3 linker and still have the
same problem. In doing some research on the problem I have come across a few
references on what sounds to be a similar problem when other packages that use
dirfd and were compiled on Irix, for instance:

* thunar-vfs/thunar-vfs-scandir.c: Workaround missing dirfd()
> definition using the POSIX/XPG API on IRIX. This fixes bug
> #1247.


The workaround was the following:

/* %&§$!# IRIX and Solaris */
#if defined(__sgi__) && !defined(dirfd)
#define dirfd(dp) (((DIR *) (dp))->__dd_fd)
#elif (defined(__sun__) || defined(__sun)) && !defined(dirfd) #define dirfd
(dp) (((DIR *) (dp))->dd_fd) #endif

I will also attach the source file where this was implemented.
The last three are related to OpenSSL - I assume you have OpenSSL installed and working, no?

https://www.openssl.org/docs/man1.1.0/c ... X_new.html
I'm the manager

Besides irix.cc, I run these sites:

projectkitsune.com

kazuo.io

User avatar
LarBob
Posts: 62
Joined: Mon Dec 25, 2017 4:08 pm
Location: Kentucky, United States
Contact:

Re: Some compilation info

Post by LarBob » Tue Jul 24, 2018 12:06 pm

Hey all, I've now updated the post to include a guide on compiling GCC 4.7.3! :D
I am currently running the C test suite and it's going along okay, but not as good as I want. I wouldn't quite recommend using 4.7.3 as your main compiler on IRIX until I get a few more issues ironed out.

EDIT: Here are the results of gmake -j5 check-gcc-c RUNTESTFLAGS="execute.exp"

Code: Select all

                === gcc Summary ===

# of expected passes            20836
/var/tmp/gccbuild/gcc-objs/gcc/xgcc  version 4.7.3 (GCC)
EDIT 2: Results in gcc.sum after gmake -k -j5 check-gcc

Code: Select all

                === gcc Summary ===

# of expected passes            75096
# of unexpected failures        24
# of expected failures          112
# of unsupported tests          1236
/var/tmp/gccbuild/gcc-objs/gcc/xgcc  version 4.7.3 (GCC)
Pretty nice :D
:Octane: Aezora - Octane - 2xR10k 250 MHz - SI Graphics - 1 GB RAM - 6.5.30f
:O2: Kiki - O2 - R5k 180 MHz - 192 MB RAM - Currently dead
:O3x0-2: Calcifer - Origin 300 - 4xR14k 500 MHz - 2 GB RAM - 6.5.30m
:O3x0-2: Tohru - Origin 350 - 4xR16k 800 MHz - 4 GB RAM - 6.5.30m - on loan from Raion
Mirrors

User avatar
gijoe77
Posts: 222
Joined: Fri Jun 22, 2018 9:17 pm

Re: Some compilation info

Post by gijoe77 » Mon Jul 30, 2018 3:53 pm

Raion-Fox wrote:
Sun Jul 22, 2018 2:14 am
So I did some more research into the issues and it may not be a link order, so while the document I posted is helpful for some linker and other compiler idiosyncrasies, I think that I found some better info. Please also attach your config.log, if you don't mind gijoe.

For the first unresolved symbol dirfd, I found this: https://bugs.freedesktop.org/show_bug.cgi?id=8754 This was also an issue with dbus.

Comment no. 8 by Steve Johns said this:
I don't believe that there is a problem with the linker, since I have never
had a problem with it in the past. I generally use the native Irix MIPS-Pro
linker, but I just attempted to use the GNU v3.3 linker and still have the
same problem. In doing some research on the problem I have come across a few
references on what sounds to be a similar problem when other packages that use
dirfd and were compiled on Irix, for instance:

* thunar-vfs/thunar-vfs-scandir.c: Workaround missing dirfd()
> definition using the POSIX/XPG API on IRIX. This fixes bug
> #1247.


The workaround was the following:

/* %&§$!# IRIX and Solaris */
#if defined(__sgi__) && !defined(dirfd)
#define dirfd(dp) (((DIR *) (dp))->__dd_fd)
#elif (defined(__sun__) || defined(__sun)) && !defined(dirfd) #define dirfd
(dp) (((DIR *) (dp))->dd_fd) #endif

I will also attach the source file where this was implemented.
The last three are related to OpenSSL - I assume you have OpenSSL installed and working, no?

https://www.openssl.org/docs/man1.1.0/c ... X_new.html
ok, got past the dirfd issue, here is what I did:
put this line in after all the includes (line 112 specifically) of "libarchive/archive_read_disk_posix.c"

Code: Select all

#define dirfd(dp) (((DIR *) (dp))->__dd_fd)
I do have openSSL 1.1.0h compiled and installed - I haven't actually checked to see if its working. I noticed I did not point the include path to it's include dir "/usr/local/include/openssl", but I'm not sure it that even matters, I'm still reading up on how to check it's actually working :)

although right after the dirfp, next issue is what appear to be bzlib.h problems :

Code: Select all

export CC=cc
export CXX=CC
export CFLAGS="-c99 -g0 -O2 -mips4 -I/usr/nekoware/include -I/usr/local/include -I/usr/local/include/openssl"
export CXXFLAGS="-g0 -O2 -mips4"

./configure --prefix=/usr/local --includedir=/usr/local,/usr/nekoware

<snip>
checking bzlib.h usability... yes
checking bzlib.h presence... no
configure: WARNING: bzlib.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: bzlib.h: proceeding with the compiler's result
checking for bzlib.h... yes
checking for BZ2_bzDecompressInit in -lbz2... no
<snip>

/usr/nekoware/bin/sed -i "s/-Wall -Wformat/-woff all/g" Makefile
gmake

  CCLD     bsdtar
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzDecompressEnd" -- 1st referenced by ./.libs/libarchive.a(archive_read_support_format_7zip.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzDecompressInit" -- 1st referenced by ./.libs/libarchive.a(archive_read_support_format_7zip.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzDecompress" -- 1st referenced by ./.libs/libarchive.a(archive_read_support_format_7zip.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzCompressInit" -- 1st referenced by ./.libs/libarchive.a(archive_write_add_filter_bzip2.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzCompressEnd" -- 1st referenced by ./.libs/libarchive.a(archive_write_add_filter_bzip2.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzCompress" -- 1st referenced by ./.libs/libarchive.a(archive_write_add_filter_bzip2.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "BZ2_bzlibVersion" -- 1st referenced by ./.libs/libarchive.a(archive_version_details.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "HMAC_CTX_new" -- 1st referenced by ./.libs/libarchive.a(archive_hmac.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "HMAC_CTX_free" -- 1st referenced by ./.libs/libarchive.a(archive_hmac.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: ERROR   33 : Unresolved text symbol "EVP_CIPHER_CTX_reset" -- 1st referenced by ./.libs/libarchive.a(archive_cryptor.o).
        Use linker option -v to see when and which objects, archives and dsos are loaded.  
ld32: INFO    152: Output file removed because of error.
gmake[1]: *** [bsdtar] Error 2
so it appears the bzlib.h issue is bitting me. I looked over the config.log (attached), here is what appears to me to be the issue:

Code: Select all

cc-1005 cc: ERROR File = conftest.c, Line = 73
  The source file "bzlib.h" is unavailable.

  #include <bzlib.h>
                    ^

1 catastrophic error detected in the compilation of "conftest.c".
Compilation terminated.
the only bzlib.h on the system is in /usr/nekoware/include, so I guess I'm getting some include path wrong or this "conftest.c" needs to be modifed? I can't seem to find a conftest.c anywhere... this makefile/autoconfig is sooooooo confusing...

Post Reply