Building GCC

After you run gmake you get a lot of stdout output. I'm actually getting errors trying to build gcc7.3. And in order for me to ask for help I need to know whether all this gmake output gets logged somewhere and, if so, where. Or is it just enough to copy just the last several lines where the word error starts to come up?

Just FYI, gmake runs for a really long time, but at the very end when it appears to be wrapping things up it exits with a #2 error.

I'd really appreciate if you could help me out with this. Thank you in advance.
 
After you run gmake you get a lot of stdout output. I'm actually getting errors trying to build gcc7.3.
Why are you building this from source? We have plenty of versions to choose from:
lang/gcc48 (deprecated), lang/gcc6 (expired), lang/gcc7 (deprecated), lang/gcc8, lang/gcc9, lang/gcc10

And in order for me to ask for help I need to know whether all this gmake output gets logged somewhere and, if so, where.
It doesn't. Learn to use script(1) or shell output redirection.

Or is it just enough to copy just the last several lines where the word error starts to come up?
No, the actual cause of the error may be a lot further up.
 
I'm actually trying to install a chess program. The developer recommends gcc7.3. Version 8 didn't work for him. I tried version 10 and I got an error message that this version is not working.

Now that you mention that, I did run pkg search gcc and I think I just got hits for a couple of versions (8 and 10, IIRC), but definitely not all of the versions that you listed.
 
I recently put together a script to build GCC 9.x

You might find it useful: https://github.com/osen/mdcc/blob/main/build.sh#L81

Just note, unless you are interested in the m68k architecture, you will likely need a few different flags.

Edit: Also, there is usually a script to bootstrap all the little GNU dependencies needed to build it. I downloaded them manually and added them to the repo. Likely your build is failing because you are missing these. The part of the script that extracts them is here.
 
I did run pkg search gcc and I think I just got hits for a couple of versions (8 and 10, IIRC), but definitely not all of the versions that you listed.
Everything except GCC 6 is still be available, 4.8 and 7 are deprecated (not supported upstream anymore and may be removed soon) but should still be available.
 
Could the host platform make a difference. For example, GCC cross-compiled for MSYS on windows may have patches for that environment that make the application flaky in a better system.
 
I figured it out. It was just a matter of linking to the right gcc version from /usr/bin. I did try that earlier, but from so much trying with different versions I got confused and never did try linking to the old gcc 4.8.

Thank you for all your help, though.
 
Bash:
pkg install gcc6-aux-20180516_2,1
cd /to/src/of/Scidb
export PATH="$PATH:/usr/local/gcc6-aux/bin"

For other gcc Version use the following Variables Set them before ./configure runs.

Bash:
export CC=gcc9
export CXX=g++9
export AR=gcc-ar9

./configure --help

Shows more Environmental Variables that can be set, btw.



Most likely you will also need to set

Bash:
export CXXFLAGS=-fpermissive
export CPATH=/usr/src/sys/cddl/contrib/opensolaris/uts/common:/usr/src/contrib/ofed/include:/usr/src/cddl/compat/opensolaris/include

Anyway, for me compiling Scidb[1] ends in

C++:
Compiling m_file.cpp                      [-fpermissive -g]                                                                                                                         
m_file.cpp: In destructor 'virtual mstl::bits::file::~file()':                       
m_file.cpp:50:27: error: cannot convert '_IO_FILE*' to 'FILE* {aka __sFILE*}' for argument '1' to 'int fileno(FILE*)'                                                               
  if (m_open && fileno(m_fp) > 2)                                                                                                                                                   
                           ^

with gcc7.5, gcc10, gcc4.8, gcc9.

So ... Good luck. Maybe it would compile on GNU/Linux Distro of your choice and then run it with Linuxlator?

[1] http://scidb.sourceforge.net/index.html
 
That was an awesome reply, thank you. I'll definitely try that.

Question #1: So, you don't think I'll be able to set up on a FreeBSD system?

Question #2: configure starts out by displaying the Tcl/Tk version (8.6). Later it lists the locations of both tcl.h and tk.h as not found. Also, Tcl and Tk libraries are listed as blank and not found, respectively.

I ran locate and found them easily in /usr/local/include/tk8.7 and /usr/.../tcl8.7.

locate also revealed that in /path/to/Scicdb/src/tk/tcl8.7 there are some header files, but tcl.h and tk.h are missing.

What does this all mean?

Question #3: configure complains that freetype2 is missing, but pkg says that "the most recent versions of packages are already installed".

whereis finds freetype2 in /usr/ports/print/freetype2.

So, my question is the same, what does this all mean? Is it the way FreeBSD is set up?

Thank you in advance!

:-)
 
Question #2: configure starts out by displaying the Tcl/Tk version (8.6). Later it lists.....

First, you should start with unpacking the source archive again, so you can work in a "clean" environment.

Then set the Compiler Variables and then run ./configure. You will also need some C Headers that are found in
/usr/src - so download and extract src.txz from the FTP Server if don't have them already.

Question #1: So, you don't think I'll be able to set up on a FreeBSD system?

I couldn't. Best would be to forward the final error message to the dev, maybe he/she can provide a patch.

Also, don't forget that you have to use gmake instead of make to start the build.
 
Question #2: configure starts out by displaying the Tcl/Tk version (8.6). Later it lists the locations of both tcl.h and tk.h as not found. Also, Tcl and Tk libraries are listed as blank and not found, respectively.

I ran locate and found them easily in /usr/local/include/tk8.7 and /usr/.../tcl8.7.
I think you'll need the -I (i for igloo) and -L options to tell the compiler and linker where to find headers (I for include) and libraries (L for libraries). I'm a bit rusty.

Code:
       -I<directory>
              Add the specified directory to the search path for include
              files.

Code:
     -L dir, --library-path=dir
             Add a directory to the library search path.

Source code for other OSs will assume certain locations, so if compiling on FreeBSD you need to give more clues to the compiler/linker.

See section 13.10 https://docs.freebsd.org/en/books/porters-handbook/porting-dads/#dads-cflags - just has examples of those two flags.
 
I got it to compile with clang from base, but it was fairly unpleasant and required some code changes. I can throw these up somewhere if you like. To give you a flavor of the unpleasantness, this is the configure command line I had to use
Code:
SYS_LDFLAGS="-L/usr/local/lib -lexecinfo -lcompat" SYS_CFLAGS="-I/usr/local/include" SYS_CXXFLAGS="-D__BSD__ -D_LIBCPP_STDLIB_INCLUDE_NEXT -I/usr/local/include -I/usr/src/contrib/ofed/include -I/usr/src/sys/cddl/contrib/opensolaris/uts/common" ./configure --gcc-version=clang
 
To give you a flavor of the unpleasantness
That still looks somehow "clear" ;)

At some time in the past, I needed to build a GCC5 targeting Linux to get a correctly working MakeMKV, which looked like this:
Yes, three steps with parts of glibc in between ?

GCC is often a beast to build. It's nice to have ports where everything is already figured out; if you just need a GCC targeting FreeBSD, use these ;)

Side note: Code that needs a specific compiler (as opposed to a specific version of standard C or C++) should be forbidden. Code that works with an older version of a compiler, but not a newer one, is likely broken and should be fixed…
 
Oh, this one is a doozy. I stopped counting the warnings. It rewarded my efforts of getting it to compile with linker errors, natch. I'm still not exactly sure how I got it to link, and I'm not at all sure it runs (gives me prompt that doesn't know about "help" or "usage"), but something does run. The Tk version launches an empty window and the inscrutable prompt.
 
Its odd, GCC 9 I found compiled quite straight forward with CC=clang

Granted, I disable as much as I can ;)

Code:
  ../configure \
    --target=m68k-elf \
    --prefix="$PREFIX" \
    --with-newlib \
    --disable-libssp \
    --disable-tls \
    --enable-threads=single \
    --enable-languages=c \
    --disable-lto \
    --with-cpu=m68000 \
    --disable-werror \
    --disable-nls \
    --disable-multilib

Disabling LTO was purely to avoid longish compile times for Mega Drive games that really don't need it!

Painful amount of warnings however...
 
I think you'll need the -I (i for igloo) and -L options to tell the compiler and linker where to find headers (I for include) and libraries (L for libraries). I'm a bit rusty.

Code:
       -I<directory>
              Add the specified directory to the search path for include
              files.

Code:
     -L dir, --library-path=dir
             Add a directory to the library search path.

Source code for other OSs will assume certain locations, so if compiling on FreeBSD you need to give more clues to the compiler/linker.

See section 13.10 https://docs.freebsd.org/en/books/porters-handbook/porting-dads/#dads-cflags - just has examples of those two flags.
richardtoohey2 but if there are header files in /path/to/Scicdb/src/tk/tcl8.7, how come the tcl.h and tk.h are missing? Are they supposed to not be in such directory?
 
richardtoohey2 but if there are header files in /path/to/Scicdb/src/tk/tcl8.7, how come the tcl.h and tk.h are missing? Are they supposed to not be in such directory?
I was replying to this bit of your post - so it sounded like it couldn't find include files or libraries - so -I and -L might help:

Later it lists the locations of both tcl.h and tk.h as not found. Also, Tcl and Tk libraries are listed as blank and not found, respectively.

I ran locate and found them easily in /usr/local/include/tk8.7 and /usr/.../tcl8.7.
 
There is no option listed in the configure help file to give it the path to freetype2 and inotify. What does one do in this situation?
 
Yeah, I meant, if there's no option for freetype2 (like there's for Tcl/Tk), how do you help ./configure find freetype2 (that you have installed from packages).
 
Sort of unbelievable - how come other people didn't come across this bug? :-/ But, thank you for that! I'll try this bug fix as soon as I get back from work.
 
Sort of unbelievable - how come other people didn't come across this bug? :-/ But, thank you for that! I'll try this bug fix as soon as I get back from work.
It gives me the heebie-jeebies too... Also, it's building differently now. It has decided to update some files in the man directory, and I think it's building a different set of binaries. I'll confirm the latter if I get time.
 
Back
Top