flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > High Level Languages > [GCC] Compiler can't create executables

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Fixit



Joined: 22 Nov 2012
Posts: 161
[GCC] Compiler can't create executables
I could not install a Linux program using the package manager.
(Puppy Slacko 5.6.0)

So it was suggested that I compile the source.

It used gcc, so I can not understand this error message.

"Compiler can't create executables"

# ./configure
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.

I am still using fasm and have been looking for some GUI code.

Andy

Thanks scholars, gentlemen, and go-getters. Smile

Andy
Post 18 May 2014, 02:17
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
I'm curious to know whether it means the "linker cannot create executables". Which means that you've some other linker in your system and your PATH variable is set such that it finds the cross-linker (or something like that) before it searches for the linker that is used by your system. Can you confirm that?
Post 18 May 2014, 03:54
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
I do not understand what you are asking.

Take care,
Andy
Post 18 May 2014, 03:58
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Post the config.log. I've only ever seen this with cross compilers, so I don't know what could cause it with a normal compiler.
Post 18 May 2014, 05:36
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
It is attached.

Andy


Description:
Download
Filename: Config_Log.tar
Filesize: 10 KB
Downloaded: 153 Time(s)

Post 19 May 2014, 01:31
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
Lately, I've been using Raspberry PI with GCC and the Geany editor. Very easy to compile a C program:

* On Desktop, right click Create New.. Blank File.. hello.c
* In terminal, enter:

Code:
cd Desktop
gcc hello.c -o hello
./hello


_________________
New FASM Site, Examples, Graphics, Updated Libraries
Post 19 May 2014, 07:10
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore

Fixit wrote:
I do not understand what you are asking.

Take care,
Andy


Hi,
Can you please tell us what you have set as "PATH" in your ~/.bashrc file? You can view it like (assuming you've GNU NANO, or pick your favourite text editor) "nano ~/.bashrc"
You should see something like this:

Quote:

export PATH="usr/bin"


Please tell us what've you got in your PATH environment variable. And yeah like m3ntal said Create a file called envtest.c (or whatever.c) and paste the lines:

Code:

#include <stdio.h>
int main(int argcconst char **argv[])
{
    printf ("Sample Test....\n");
    return 0;
}



Open the terminal, cd to the directory of this file and type:
"cc envtest.c -o envtest.out"
"./envtest.out"
This will test if your compiler and build environment with the standard system libraries are configured properly.
@m3ntal: That's true when your build environment is sane, you've the native system linker but in Fixit's case it looks like the system toolchain isn't configured properly.
EDIT: After looking at your log it looks like you haven't installed "GNU Multi precision Library a.k.a. libmpc.so".

Quote:

/usr/libexec/gcc/i486-slackware-linux/4.7.1/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory


If your distro provides it install it by:
"sudo apt-get install libmpc-dev" (Debian & Ubuntu) or using your package manager a.k.a pacman if you're using ArchLinux. Smile

m3ntal wrote:

......the Geany editor.......


Man, that editor! Much better than vi or Emacs and even gedit! Wink

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 19 May 2014, 14:02
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
I think there was something wrong with the .configure file.

# fasm hello.asm
flat assembler version 1.71.17 (16384 kilobytes memory)
3 passes, 224 bytes.
Post 19 May 2014, 19:39
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
.bashrc file

. /etc/profile

#v1.0.5 need to override TERM setting in /etc/profile...
#export TERM=xterm
# ...v2.13 removed.

#export HISTFILESIZE=2000
#export HISTCONTROL=ignoredups
#...v2.13 removed.

PATH=/usr/lib/qt/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin:/root/my-applications/bin:/usr/games:/usr/lib/kde4/libexec:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/java/jre/bin:/usr/lib/qt/bin

Andy
Post 19 May 2014, 19:42
View user's profile Send private message Reply with quote
gens



Joined: 18 Feb 2013
Posts: 159
/usr/libexec/gcc/i486-slackware-linux/4.7.1/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory

check if you have libmpc installed
it should also be in the linker line

you can do a quick check with
gcc -lmpc

where it complaining only about main means it found the lib

/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/../../../../lib64/crt1.o: In function `_start':
/root/glibc-tmp-9002ff5f792dcd78458cea033de7a2d0/glibc-2.19/csu/../sysdeps/x86_64/start.S:118: undefined reference to `main'
collect2: error: ld returned 1 exit status

PS would you mind using pastebin next time, easier to read
Post 19 May 2014, 21:23
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
# gcc -lmpc
collect2: fatal error: cannot find 'ld'
compilation terminated.

Are you talking about the tar file ?

Andy
Post 19 May 2014, 23:44
View user's profile Send private message Reply with quote
gens



Joined: 18 Feb 2013
Posts: 159
ld is part of binutils

whereis ld
to see if its accessible and where

weird how in configure's test it didn't complain about it

yes, i'm too lazy to untar things Smile
Post 20 May 2014, 00:34
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
No problem

Andy
Post 20 May 2014, 04:45
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore

Fixit wrote:
No problem

Andy


Hi,
That is quite a problem. It seems that you don't have a system linker, the linker does basically what it's name says, it links object files and libraries so that it produces an executable, which you can run on your system.

Quote:

I think there was something wrong with the .configure file.

# fasm hello.asm
flat assembler version 1.71.17 (16384 kilobytes memory)
3 passes, 224 bytes.


Don't confuse FASM and the GNU Toolchain! Smile They're two different things, FASM is an assembler GCC is a compiler. In fact GCC uses it's own assembler called GNU Assembler. GCC and FASM are not related. Can you try the test C program in my previous post?

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 20 May 2014, 08:42
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 790
Location: Jakarta, Indonesia

sid123 wrote:

EDIT: After looking at your log it looks like you haven't installed "GNU Multi precision Library a.k.a. libmpc.so".



MPC is one of the prerequisite to build GCC.
How come it couldn't be loaded?

Weird Confused
Post 20 May 2014, 14:41
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore

TmX wrote:

sid123 wrote:

EDIT: After looking at your log it looks like you haven't installed "GNU Multi precision Library a.k.a. libmpc.so".



MPC is one of the prerequisite to build GCC.
How come it couldn't be loaded?

Weird Confused


Wow you live quite near. Razz
I guess in Fixit's case the system toolchain (gcc, binutils) were precompiled. So he didn't had to install the perquisites of compiling gcc. Not to mention compiling and upgrading the toolchain is a very painful process.

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 20 May 2014, 15:27
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 790
Location: Jakarta, Indonesia

sid123 wrote:
Not to mention compiling and upgrading the toolchain is a very painful process.



Indeed building GCC is a pain in the a**.
That's why I never interested in building it from source, and instead
leave this to the trusty package manager.
That means I get GCC and its dependencies (GMP, MPC, MPFR, etc) installed. Smile

I don't know how Fixit installed the toolchain that GCC doesn't work properly. Blame the packager, maybe?
Why don't he put GCC and it's dependecies together into a single, installable package?

BTW, I did a quick Google search about this Puppy Linux.
"It has high Slackware binary software packages compatibility".

Many years ago, when I didn't have a good internet connection at home,
I had a PC that was running Slackware. How could I install applications, then? I download the binary (.txz) packages at campus, and put them in USB flashdrive. Then you can install them with "installpkg" command, if memory serves me right. There are several Slackware binary repos out there. One of them is http://repository.slacky.eu/

Maybe this way can also be applicable. I'm not sure, though, because I've never tried Slacko before.
Post 20 May 2014, 16:34
View user's profile Send private message Reply with quote
gens



Joined: 18 Feb 2013
Posts: 159
yes, slacko is binary compatible with slackware
so much that it's package manager includes slackware repositories

idk if puppy holds things needed for compiling somewhere in some repo
i know slackware has everything needed in d/
gcc set, binutils, make, automake, kernel headers etc.
has even nasm and yasm, what reminds me that i should try getting fasm there Smile
Post 20 May 2014, 17:48
View user's profile Send private message Reply with quote
Fixit



Joined: 22 Nov 2012
Posts: 161
# cc test.c -o test.out
/usr/libexec/gcc/i486-slackware-linux/4.7.1/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory

I will try to download that library.

Andy
Post 21 May 2014, 00:11
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Is there a reason you're using Slackware? It seems to be a real PITA. Even Gentoo wouldn't leave your system in such a broken state (and that is really saying something). If you want to be 1337 and still get *some* stuff done, try Arch. Personally, I've tried the whole super barebones linux distros thing and found that it really just ends up wasting a lot of time that would be better spent doing things I actually want to do instead of spending most of my time just trying to get packages installed that I want to work with. (Eg on Gentoo I spent 2 days installing scipy/matplotlib/OpenOpt and a few others. It was awful and totally unnecessary. And that's not even mentioning graphics cards and kernel config-ing.) Just go with something simple like Mint or XFCE Ubuntu and then you can focus your efforts on programming stuff you want to be working on.

And it is MPC that is missing. But if you don't have ld, then getting MPC installed isn't going to fix the problem entirely. Sorry for the delay, I don't come here often anymore.
Post 21 May 2014, 05:57
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.