WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: C compiler cannot create executables  (Read 199 times)

Offline nitram

  • Jr. Member
  • **
  • Posts: 93
C compiler cannot create executables
« on: April 02, 2015, 09:47:11 PM »
Noob alert, new to compiling anything more than hello world type stuff.

First attempt at creating a TC extension from source, running 6.1rc3:
rogue.rogueforge.net/rogue-5-4/
Rogue 5.4.4 Source Code

Encounter the following error:
configure: error: C compiler cannot create executables

config.log indicates:
configure: exit 77

Will google more tomorrow. All pointers and feedback appreciated. Thanks - nitram

************************************************************************************

Default .ashrc with following added: export CFLAGS CXXFLAGS LDFLAGS

tce-status -i includes:
autoconf
automake
compiletc

Program files copied to /tmp/rogue54:
Code: [Select]
LICENSE.TXT       config.sub        init.c            move.c            rogue.cat.in      rogue54.vcproj    weapons.c
Makefile.in       configure         install-sh        new_level.c       rogue.desktop     rooms.c           wizard.c
Makefile.std      configure.ac      io.c              options.c         rogue.doc.in      save.c            xcrypt.c
armor.c           configure.lineno  list.c            pack.c            rogue.h           score.h
chase.c           daemon.c          mach_dep.c        passages.c        rogue.html.in     scrolls.c
command.c         daemons.c         main.c            potions.c         rogue.me.in       state.c
config.guess      extern.c          mdport.c          rings.c           rogue.png         sticks.c
config.h.in       extern.h          misc.c            rip.c             rogue.spec        things.c
config.log        fight.c           monsters.c        rogue.6.in        rogue54.sln       vers.c

./configure --help:
Code: [Select]
root@box:/tmp/rogue54# ./configure --help
`configure' configures Rogue 5.4.4 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR          info documentation [DATAROOTDIR/info]
  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR           man documentation [DATAROOTDIR/man]
  --docdir=DIR           documentation root [DATAROOTDIR/doc/rogue]
  --htmldir=DIR          html documentation [DOCDIR]
  --dvidir=DIR           dvi documentation [DOCDIR]
  --pdfdir=DIR           pdf documentation [DOCDIR]
  --psdir=DIR            ps documentation [DOCDIR]

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-setgid=NAME    install executable as setgid with group ownership of
                          NAME [default=no]]
  --enable-scorefile=SCOREFILE
                          enable scoreboard with given filename
  --enable-lockfile=LOCKFILE
                          enable scoreboard lockfile with given filename
  --enable-wizardmode     enable availability of wizard mode [default=no]
  --enable-allscores      enable scoreboard to show top scores, not just top
                          players [default=yes]
  --enable-checktime      enable checktime [default=no]
  --enable-maxload        enable maxload [default=no]
  --enable-maxusers       enable maxuser [default=no]
  --enable-numscores      number of scores to store in scoreboard [default=10]
  --enable-numname        word for number of scores to store in scoreboard
                          [default=Ten]
  --enable-loadav=NAMELIST
                          use program's load average function (unlikely to
                          work) [default=no]
  --enable-ucount=UTMPFILE
                          use program's own function to count users (unlikely
                          to work) [default=no]

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-ncurses          Force the use of ncurses over curses
  --with-program-name=NAME
                          alternate executable name

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <yendor@rogueforge.net>.

./configure --prefix=/usr/local output:
Code: [Select]
root@box:/tmp/rogue54# ./configure --prefix=/usr/local
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.

config.log:
Code: [Select]
root@box:/tmp/rogue54# cat config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by Rogue configure 5.4.4, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure --prefix=/usr/local

## --------- ##
## Platform. ##
## --------- ##

hostname = box
uname -m = i686
uname -r = 3.16.6-tinycore
uname -s = Linux
uname -v = #777 SMP Thu Oct 16 09:42:42 UTC 2014

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /home/tc/.local/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /apps/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /etc/sysconfig/tcedir/ondemand


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1786: checking build system type
configure:1804: result: i686-pc-linux-gnu
configure:1826: checking host system type
configure:1841: result: i686-pc-linux-gnu
configure:1863: checking target system type
configure:1878: result: i686-pc-linux-gnu
configure:1956: checking for gcc
configure:1972: found /usr/local/bin/gcc
configure:1983: result: gcc
configure:2221: checking for C compiler version
configure:2228: gcc --version >&5
gcc (GCC) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2231: $? = 0
configure:2238: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
Target: i486-pc-linux-gnu
Configured with: ../gcc-4.9.1/configure --prefix=/usr/local --enable-shared --libexecdir=/usr/local/lib --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-system-zlib --enable-frame-pointer --enable-lto --with-mpfr=/usr/local --with-gmp=/usr/local --with-cloog=/usr/local --with-isl=/usr/local --with-arch=i486 --with-tune=i686
Thread model: posix
gcc version 4.9.1 (GCC)
configure:2241: $? = 0
configure:2248: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2251: $? = 1
configure:2274: checking for C compiler default output file name
configure:2301: gcc    conftest.c  >&5
gcc: error trying to exec 'cc1': execvp: No such file or directory
configure:2304: $? = 1
configure:2342: result:
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "Rogue"
| #define PACKAGE_TARNAME "rogue"
| #define PACKAGE_VERSION "5.4.4"
| #define PACKAGE_STRING "Rogue 5.4.4"
| #define PACKAGE_BUGREPORT "yendor@rogueforge.net"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2348: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build='i686-pc-linux-gnu'
ac_cv_env_CC_set=''
ac_cv_env_CC_value=''
ac_cv_env_CFLAGS_set=''
ac_cv_env_CFLAGS_value=''
ac_cv_env_CPPFLAGS_set=''
ac_cv_env_CPPFLAGS_value=''
ac_cv_env_CPP_set=''
ac_cv_env_CPP_value=''
ac_cv_env_LDFLAGS_set=''
ac_cv_env_LDFLAGS_value=''
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_build_alias_set=''
ac_cv_env_build_alias_value=''
ac_cv_env_host_alias_set=''
ac_cv_env_host_alias_value=''
ac_cv_env_target_alias_set=''
ac_cv_env_target_alias_value=''
ac_cv_host='i686-pc-linux-gnu'
ac_cv_prog_ac_ct_CC='gcc'
ac_cv_target='i686-pc-linux-gnu'

## ----------------- ##
## Output variables. ##
## ----------------- ##

CC='gcc'
CFLAGS=''
COLCRT=''
CPP=''
CPPFLAGS=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GREP=''
GROFF=''
GROUPOWNER=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LOCKFILE=''
LTLIBOBJS=''
NROFF=''
OBJEXT=''
PACKAGE_BUGREPORT='yendor@rogueforge.net'
PACKAGE_NAME='Rogue'
PACKAGE_STRING='Rogue 5.4.4'
PACKAGE_TARNAME='rogue'
PACKAGE_VERSION='5.4.4'
PATH_SEPARATOR=':'
PROGRAM=''
SCOREFILE=''
SED=''
SHELL='/bin/sh'
TARGET=''
TBL=''
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build='i686-pc-linux-gnu'
build_alias=''
build_cpu='i686'
build_os='linux-gnu'
build_vendor='pc'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='i686-pc-linux-gnu'
host_alias=''
host_cpu='i686'
host_os='linux-gnu'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='i686-pc-linux-gnu'
target_alias=''
target_cpu='i686'
target_os='linux-gnu'
target_vendor='pc'

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME "Rogue"
#define PACKAGE_TARNAME "rogue"
#define PACKAGE_VERSION "5.4.4"
#define PACKAGE_STRING "Rogue 5.4.4"
#define PACKAGE_BUGREPORT "yendor@rogueforge.net"

configure: exit 77

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 7063
Re: C compiler cannot create executables
« Reply #1 on: April 02, 2015, 10:06:38 PM »
what did you put for "export CFLAGS CXXFLAGS LDFLAGS"?

Offline nitram

  • Jr. Member
  • **
  • Posts: 93
Re: C compiler cannot create executables
« Reply #2 on: April 02, 2015, 10:25:16 PM »
Thanks for trying to help Juanito.

Working through 3 pages of similar error messages archived on the forum and the most useful answer was always ensure compiletz is installed, which it is.

export CFLAGS CXXFLAGS LDFLAGS is in my .ashrc:
Code: [Select]
# ~/.ashrc: Executed by SHells.
#
. /etc/init.d/tc-functions
if [ -n "$DISPLAY" ]
then
`which editor >/dev/null` && EDITOR=editor || EDITOR=vi
else
EDITOR=vi
fi
export EDITOR

# Alias definitions.
#
alias df='df -h'
alias du='du -h'

alias ls='ls -p'
alias ll='ls -l'
alias la='ls -la'

# Avoid errors... use -f to skip confirmation.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'

alias d='dmenu_run &'
alias ce='cd /etc/sysconfig/tcedir'

###-- GCC compiler variables
#
### If compiling kernel:
#CFLAGS=""
#CXXFLAGS=""
#LDFLAGS=""
#
### Recommended if submitting extensions:
#CFLAGS="-march=i486 -mtune=i686 -Os -pipe"
#CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe"
#LDFLAGS="-Wl,-O1"
#
### For apps that need speed (math library or so), you can use "-O2" flag instead of "-Os" flag.
#CFLAGS="-march=i486 -mtune=i686 -O2 -pipe"
#CXXFLAGS="-march=i486 -mtune=i686 -O2 -pipe"
#LDFLAGS="-Wl,-O1"
#
### Flags Not-allowed (good performance, but likely won't work on other machines): "-march=native -mtune=native".
#CFLAGS="-march=native -mtune=native -O2 -pipe"
#CXXFLAGS="-march=native -mtune=native -O2 -pipe"
#
### If you wish to try to get a lower sized C++ app, you can try adding "-fno-exceptions -fno-rtti" to CXXFLAGS. Use only on C++ applications, libraries should use the same flags as in CFLAGS above.
#CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
#
### Potential increase of performance but makes debugging impossible.
#CFLAGS="${CFLAGS} -fomit-frame-pointer"
#CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"

export CFLAGS CXXFLAGS LDFLAGS

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 7063
Re: C compiler cannot create executables
« Reply #3 on: April 02, 2015, 10:31:30 PM »
..but everything is commented out?

If you try this:
Code: [Select]
$ unset CFLAGS CXXFLAGS LDFLAGS
$ CC="gcc -march=i486 -mtune=i686 -Os -pipe" CXX="g++ -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var
..what do you get?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 8303
Re: C compiler cannot create executables
« Reply #4 on: April 03, 2015, 12:18:26 AM »
Something seems broken in your system, tce-status should also list all the dependencies of compiletc?
The only barriers that can stop you are the ones you create yourself.

Offline nitram

  • Jr. Member
  • **
  • Posts: 93
Re: C compiler cannot create executables
« Reply #5 on: April 25, 2015, 07:41:56 PM »
Haven't had a chance to work with TC for a while. Your responses @Juanito and @curaga are appreciated. If i don't immediately respond, life got in the way. Thanks also to @Misalf for the tutorial.

I have now successfully compiled Rogue v5.4 and created my first extension (rogue54.tcz) - very exciting ;D

compiletc loaded great, as did autoconf, automake and squashfs-tools. I believe i messed up my environment on the previous attempt, which was fixed once i reset .ashrc to default and rebooted. Rogue also needed ncurses-dev loaded to compile. No custom environment was utilized, just ran ./configure and make, uneventful once automake was installed. As per the manual, sudo strip -g * and mksquashfs was also utilized.

Outstanding issues and much to learn. Any feedback is appreciated, otherwise i'll just keep digging:

- I still need to confirm rogue54.tcz loads and works on a reboot. Not yet sure how ncurses hooks up with rogue54, if it automagically loads or if i need to load seperate. I will try without first and see. Since i don't have any applications dependent on ncurses in my onboot.lst, but ncurses is a rogue54 dependency, shouldn't it now auto-install when installing rogue54?

- As i did not specify any environment variables when compiling (CFLAGS CXXFLAGS LDFLAGS), does this mean it's not a valid TC extension for submission? I know nothing of these variables - foreign language. Still don't know how to properly specify these variables, especially without .ashrc, as adding variables to .ashrc appeared to break my Debian environment (fixed).

- I forgot to specify --prefix=/usr/local when configuring, but thankfully rogue54 defaulted to this directory.

- Not yet sure how to add the Apps info, files, depends and size information for submission. Will read up on how to submit a proper extension and investigate further.

- As per the manual, i removed the man page and docs before running squashfs. In hindsight, maybe i should have left these installed since the total extension size is so small and i notice other games, such as nethack and elemines, left them installed.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 7063
Re: C compiler cannot create executables
« Reply #6 on: April 25, 2015, 09:41:12 PM »
I have now successfully compiled Rogue v5.4 and created my first extension (rogue54.tcz)
'Good to hear you're making progress - for final submission, it would probably be better that the extension is called rogue.tcz rather than rogue54.tcz - that way updates will automatically replace the existing extension.

Quote
As per the manual, sudo strip -g * and mksquashfs was also utilized.
It's not a big deal, but if you want to really minimise the size of your extension, you can use:

"strip --strip-all" or "sstrip": executables (files in bin, sbin, libexec)
"strip --strip-unneeded": dynamic libraries (*.so* files in lib)
"strip --strip-debug" or "strip -g": static libraries (*.a files in lib)

Quote
Not yet sure how ncurses hooks up with rogue54, if it automagically loads or if i need to load seperate
Create a dep text file, rogue.tcz.dep with "ncurses.tcz" as its contents and it will be loaded with the rogue extension.

Quote
As i did not specify any environment variables when compiling (CFLAGS CXXFLAGS LDFLAGS), does this mean it's not a valid TC extension for submission?
If you're using an i486 or i686 cpu it's probably OK, but with other cpus, it would probably be better to recompile. You can enter the environment variables with the ./configure switches, like this:
Code: [Select]
$ CC="gcc -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var
Quote
Not yet sure how to add the Apps info, files, depends and size information for submission. Will read up on how to submit a proper extension and investigate further.
You can copy an existing *tcz.info file and modify to suit. You can get the contents of your rogue extension like this:
Code: [Select]
$ unsquashfs -l rogue.tcz > rogue.tcz.list..where you will need to edit the contents of the *list file to remove squashfs root and duplicated folder names like "/usr/local/bin"

For the dep file, you can use "ldd `which rogue`" or "ldd /usr/local/lib/librogue.so" to show dependencies.

Quote
As per the manual, i removed the man page and docs before running squashfs. In hindsight, maybe i should have left these installed since the total extension size is so small and i notice other games, such as nethack and elemines, left them installed.
You did the right thing - the aim is to make the extension as small as possible and include docs in a separate extension if required.

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4457
Re: C compiler cannot create executables
« Reply #7 on: April 26, 2015, 06:14:54 AM »
Hi Juanito
Quote
If you're using an i486 or i686 cpu it's probably OK, ...
I'd like to question that statement. I'm running a Pentium III (Coppermine) which I think qualifies as an i686. Under flags it lists  cmov
which I know is problematic for i486. If the compiler defaults to  -march=native  it could include instructions the i486 can't handle.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 7063
Re: C compiler cannot create executables
« Reply #8 on: April 26, 2015, 08:03:12 AM »
good point - I did say probably  ;)