flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Linux > Installing FASM on a modern 64-bit Linux | 
  
| Author | 
  | 
              
| 
                  
                   revolution 15 Jun 2016, 03:46 
                  Set your linker to output a 32-bit executable. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 03:55 
                  tried:
 
                  
                Quote: gcc -m32 fasm.o -o fasm  | 
              |||
                  
  | 
              
| 
                  
                   revolution 15 Jun 2016, 04:16 
                  You need to install the 32-bit libraries. Check with your OS documentation for how to do that. It's probably something like glibc-devel.i386 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 04:35 
                  I've been trying.  I am using Xubuntu 14.04.  ia32-libs used to do it, I think, but it was phased out.  libc6-i386 has been installed, also multilib support for gcc and g++ (I have 5.3).
 
                  
                lnterestingly, Code: gcc -m32 -L/usr/lib32/ fasm.o -o fasm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/libgcc.a when searching for -lgcc /usr/bin/ld: cannot find -lgcc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: cannot find -lgcc_s collect2: error: ld returned 1 exit status Still searches the 64-bit libs, in spite of -L/usr/lib32/ It must be something really dumb...  | 
              |||
                  
  | 
              
| 
                  
                   revolution 15 Jun 2016, 04:39 
                  Perhaps using LD directly (without going through GCC) will help? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 04:42 
                  Another failed attempt:
 
                  
                Code: ld -m elf_i386 fasm.o /usr/lib32/libgcc_s.so.1 -o fasm ld: fasm.o: undefined reference to symbol 'exit@@GLIBC_2.0' //lib/i386-linux-gnu/libc.so.6: error adding symbols: DSO missing from command line . Do you know what libraries I should link against - it appears I have to manually list them (similar discussion found elsewhere here in Unix messages.  | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 05:14 
                  Code: ld -m elf_i386 fasm.o /usr/lib32/libgcc_s.so.1 /usr/lib32/crtn.o /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/libc.so -L/usr/lib32 -o fasm This actually links, but the executable is wacky: Code: ./fasm bash: ./fasm: No such file or directory even though the file is there... [/quote][/code]  | 
              |||
                  
  | 
              
| 
                  
                   revolution 15 Jun 2016, 05:20 
                  Have you marked it as executable? I'm not sure if LD does this automatically or not. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 07:09 
                  It's executable:
 
                  
                Code: stacksmith@eli:~/src/fasm$ ls -al total 548 drwxrwxr-x 5 stacksmith stacksmith 4096 Jun 15 00:06 . drwxrwxr-x 29 stacksmith stacksmith 4096 Jun 14 19:26 .. drwxrwxr-x 3 stacksmith stacksmith 4096 Jun 9 04:57 examples -rwxrwxr-x 1 stacksmith stacksmith 109393 Jun 15 00:06 fasm -rw-rw-r-- 1 stacksmith stacksmith 134138 Jun 9 04:53 fasm.o -rw-rw-r-- 1 stacksmith stacksmith 265836 Jun 9 04:57 fasm.txt -rw-rw-r-- 1 stacksmith stacksmith 1783 Jun 9 04:57 license.txt -rw-rw-r-- 1 stacksmith stacksmith 260 Jun 9 04:57 readme.txt drwxrwxr-x 6 stacksmith stacksmith 4096 Jun 9 02:59 source drwxrwxr-x 5 stacksmith stacksmith 4096 Jun 9 04:57 tools -rw-rw-r-- 1 stacksmith stacksmith 19411 Jun 9 04:57 whatsnew.txt stacksmith@eli:~/src/fasm$ ./fasm bash: ./fasm: No such file or directory Also, Code: stacksmith@eli:~/src/fasm$ objdump fasm -x fasm: file format elf32-i386 fasm architecture: i386, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x08048560 I think I may be linking against wrong libraries, or in the wrong order or something like that... Any ideas?  | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 15 Jun 2016, 08:23 
                  stacksmith wrote: I think I may be linking against wrong libraries, or in the wrong order or something like that... Any ideas?  | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 16:02 
                  I've used the same system with older versions of fasm a year ago.  The new distribution of fasm does not seem to have an executable (to my surprise) and the instructions suggest just linking the fasm.o with gcc.
 
                  
                I vaguely remember going through a similar exercise a few years back. I should've kept notes.. Not that it would've helped - the 32-bit compatibility libraries have been changed. I've used fasm for many years without issues. On the other hand, my system is not at all remarkable - a 64-bit ubuntu with up-to-date gcc. I can't believe others haven't come acrosss this. Perhaps someone could statically link fasm on Ubuntu and post a binary... As a command-line tool, it does not use strange libraries, and should run on at least debian systems. I am at a bit of a loss (will investigate deeper today). Just when I started feeling good about the state of linux and fasm (deleting expletives and disparaging thoughts...) Thanks for your help.  | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 15 Jun 2016, 17:02 
                  stacksmith wrote: The new distribution of fasm does not seem to have an executable (to my surprise) and the instructions suggest just linking the fasm.o with gcc.  | 
              |||
                  
  | 
              
| 
                  
                   stacksmith 15 Jun 2016, 18:20 
                  Looks like I goofed somehow.  Thanks. 
                  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.