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 > Linux > Error when linking fasm.o to create fasm

Author
Thread Post new topic Reply to topic
stevenyhw



Joined: 17 Oct 2015
Posts: 4
Error when linking fasm.o to create fasm
I just downloaded "flat assembler 1.71.39 for Unix/libc". I tried to link fasm.o to create the fasm executable with gcc but I got an error:

fasm.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status


The command I used was:
gcc fasm.o -o fasm

My operating system is CentOS 6.6 (x86_64) with gcc 4.4.7. Can anyone give me some pointer on how to fix this issue? Thanks.
Post 17 Oct 2015, 20:20
View user's profile Send private message Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 196
Aren't you using x64 gcc? The fasm.o file is 32-bit ELF. You may need to install gcc for x86.
Post 17 Oct 2015, 22:59
View user's profile Send private message Reply with quote
stevenyhw



Joined: 17 Oct 2015
Posts: 4
Yes, I think the gcc bundled with CentOS is x64 gcc. Is there a way to generate an fasm.o in 64-bit ELF format? Thanks.
Post 17 Oct 2015, 23:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14505
Location: WTC Building 7

Code:
format elf64 ...

Post 18 Oct 2015, 00:01
View user's profile Send private message Visit poster's website Reply with quote
stevenyhw



Joined: 17 Oct 2015
Posts: 4
Thanks. I changed that line and I also tried to convert "esp" to "rsp" and "ebp" to "rbp" in the file libc/fasm.asm, but then I got a further error "pushd arg error: illegal instruction". I have never learned assembly before, so this is really challenging for me. I guess I have to read the manual and figure what how to covert a 32-bit assembly code to the 64bit version.
Post 18 Oct 2015, 01:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14505
Location: WTC Building 7
If you are trying to convert fasm (the entire source) to 64-bit then you are in for a lot of work.

Perhaps better if you can get your system to run 32-bit executables first.
Post 18 Oct 2015, 01:11
View user's profile Send private message Visit poster's website Reply with quote
stevenyhw



Joined: 17 Oct 2015
Posts: 4
Okay. Thanks for the advice.
Post 18 Oct 2015, 01:22
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria

revolution wrote:
Perhaps better if you can get your system to run 32-bit executables first.



AFAIK, every 64 bit Linux can run 32 bit executables. The problem is with the missing libraries. But FASM for Linux uses only system calls, so it should work like a charm. But yes, linking the libc version will need 32 bit compiler and 32 bit libraries.

Anyway, it is very strange, why one will need to link FASM for libc on Linux? There is normally working version FASM for Linux. IMO, the libc version is only for systems different than Linux. A fall-back, that gives additional level of portability.

_________________
Tox ID: A48DEF727DF44C3B5C2E576B65021F1A45D8FA52E2F8E257F1CAE148BBADB162FDF7820BD1F9
Post 18 Oct 2015, 07:32
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
alkap



Joined: 18 Feb 2015
Posts: 34
Location: Dnipro, Ukraine
Do you have the package below installed?

Quote:

glibc.i686


If not, you may want to try installing it. The folks on the CentOS forum suggest installing it. See the link below.

https://www.centos.org/forums/viewtopic.php?t=14169
Post 18 Oct 2015, 08:03
View user's profile Send private message Send e-mail Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 208
Location: Budapest, Hungary
After you have installed the i386 development environment just issue

Code:
gcc -m32 fasm.o -o fasm



Edit: I forgot to mention that although it works for me in this way, but I'm on Linux Mint 17.2.
Post 18 Oct 2015, 15:49
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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.