www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Build for i586

reply Alexander Zhirov <azhirov1991 gmail.com> writes:
I did a topic a [little 
earlier](https://forum.dlang.org/thread/hfzsnagofrnlmynyzymp forum.dlang.org)
about compiling a compiler for processor Geode LX800.
The bottom line is that I have a processor on which I want to 
compile the program, is an i586 architecture.

The [official 
documentation](https://www.amd.com/system/files/TechDocs/332
4H_LX_databook.pdf) says that "*... the core is a combination of Intel Pentium
® processor, AMD Athlon™ processor, and AMD Geode LX processor specific
instructions.*" - this means that the processor architecture is **<** `i686`.
And judging by the fact that Linux gives a description when calling `uname`:

```sh

i586
```

This suggests that the processor is CLEARLY `i586`.
The problem is that I can't assemble the software I need for this 
processor, since it is automatically assembled for `i686`.
What have I done?
I built an `ldc` compiler on this machine:

```sh

LDC - the LLVM D compiler (1.30.0-git-32f5a35):
   based on DMD v2.100.1 and LLVM 10.0.1
   built with DMD32 D Compiler v2.086.1
   Default target: i686-pc-linux-gnu
   Host CPU: geode
   http://dlang.org - http://wiki.dlang.org/LDC

   Registered Targets:
     x86    - 32-bit X86: Pentium-Pro and above
     x86-64 - 64-bit X86: EM64T and AMD64
```

And when I try to compile the program through it, I create a 
binary file, but when I start it outputs **Illegal instruction**:

```sh


Illegal instruction
```

Here's using the `mcpu` flag:

```sh

binary    /mnt/disc/sdb/part1/program/ldc/1.30/install/bin/ldc2
version   1.30.0-git-32f5a35 (DMD v2.100.1, LLVM 10.0.1)
config    
/mnt/disc/sdb/part1/program/ldc/1.30/install/etc/ldc2.conf 
(i686-pc-linux-gnu)
predefs   LDC all D_Version2 assert D_PreConditions 
D_PostConditions D_Invariants D_ModuleInfo D_Exceptions 
D_TypeInfo X86 D_InlineAsm_X86 D_HardFloat LittleEndian D_PIC 
linux Posix CRuntime_Glibc CppRuntime_Gcc LDC_LLVM_1000
parse     app
importall app
import    object    
(/root/usr/program/ldc/1.30/install/include/d/object.d)
import    core.attribute    
(/root/usr/program/ldc/1.30/install/include/d/core/attribute.d)
import    ldc.attributes    
(/root/usr/program/ldc/1.30/install/include/d/ldc/attributes.d)
import    core.internal.hash    
(/root/usr/program/ldc/1.30/install/include/d/core/internal/hash.d)
import    core.internal.traits  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/traits.d)
import    core.internal.entrypoint  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/entrypoint.d)
import    core.internal.array.appending 
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/appending.d)
import    core.internal.array.comparison    
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/comparison.d)
import    core.internal.array.equality  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/equality.d)
import    core.internal.array.casting   
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/casting.d)
import    core.internal.array.concatenation 
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/concatenation.d)
import    core.internal.array.construction  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/construction.d)
import    core.internal.array.capacity  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/capacity.d)
import    core.internal.dassert 
(/root/usr/program/ldc/1.30/install/include/d/core/internal/dassert.d)
import    core.atomic   
(/root/usr/program/ldc/1.30/install/include/d/core/atomic.d)
import    core.internal.attributes  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/attributes.d)
import    core.internal.atomic  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/atomic.d)
import    ldc.intrinsics    
(/root/usr/program/ldc/1.30/install/include/d/ldc/intrinsics.di)
import    core.internal.destruction 
(/root/usr/program/ldc/1.30/install/include/d/core/internal/destruction.d)
import    core.internal.moving  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/moving.d)
import    core.internal.postblit    
(/root/usr/program/ldc/1.30/install/include/d/core/internal/postblit.d)
import    core.internal.switch_ 
(/root/usr/program/ldc/1.30/install/include/d/core/internal/switch_.d)
import    core.lifetime 
(/root/usr/program/ldc/1.30/install/include/d/core/lifetime.d)
import    core.builtins 
(/root/usr/program/ldc/1.30/install/include/d/core/builtins.d)
semantic  app
entry     main          app.d
semantic2 app
semantic3 app
import    std.stdio 
(/root/usr/program/ldc/1.30/install/include/d/std/stdio.d)
import    core.stdc.stddef  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/stddef.d)
import    std.algorithm.mutation    
(/root/usr/program/ldc/1.30/install/include/d/std/algorithm/mutation.d)
import    std.traits    
(/root/usr/program/ldc/1.30/install/include/d/std/traits.d)
import    std.meta  
(/root/usr/program/ldc/1.30/install/include/d/std/meta.d)
import    std.range.primitives  
(/root/usr/program/ldc/1.30/install/include/d/std/range/primitives.d)
import    std.typecons  
(/root/usr/program/ldc/1.30/install/include/d/std/typecons.d)
import    std.format.spec   
(/root/usr/program/ldc/1.30/install/include/d/std/format/spec.d)
import    std.format.write  
(/root/usr/program/ldc/1.30/install/include/d/std/format/write.d)
import    std.format.internal.write 
(/root/usr/program/ldc/1.30/install/include/d/std/format/internal/write.d)
import    std.internal.attributes   
(/root/usr/program/ldc/1.30/install/include/d/std/internal/attributes.d)
import    std.range 
(/root/usr/program/ldc/1.30/install/include/d/std/range/package.d)
import    std.array 
(/root/usr/program/ldc/1.30/install/include/d/std/array.d)
import    std.functional    
(/root/usr/program/ldc/1.30/install/include/d/std/functional.d)
import    std.conv  
(/root/usr/program/ldc/1.30/install/include/d/std/conv.d)
import    std.ascii 
(/root/usr/program/ldc/1.30/install/include/d/std/ascii.d)
import    std.range.interfaces  
(/root/usr/program/ldc/1.30/install/include/d/std/range/interfaces.d)
import    core.stdc.stdio   
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/stdio.d)
import    core.stdc.stdint  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/stdint.d)
import    core.stdc.config  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/config.d)
import    core.stdc.signal  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/signal.d)
import    core.stdc.wchar_  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/wchar_.d)
import    core.stdc.stdarg  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/stdarg.d)
import    core.stdc.time    
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/time.d)
import    core.sys.posix.stdc.time  
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/stdc/time.d)
import    core.sys.posix.sys.types  
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/sys/types.d)
import    core.sys.posix.config 
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/config.d)
import    core.sys.posix.stdio  
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/stdio.d)
import    std.exception 
(/root/usr/program/ldc/1.30/install/include/d/std/exception.d)
import    core.stdc.errno   
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/errno.d)
import    std.utf   
(/root/usr/program/ldc/1.30/install/include/d/std/utf.d)
import    core.exception    
(/root/usr/program/ldc/1.30/install/include/d/core/exception.d)
import    core.internal.string  
(/root/usr/program/ldc/1.30/install/include/d/core/internal/string.d)
import    std.algorithm.comparison  
(/root/usr/program/ldc/1.30/install/include/d/std/algorithm/comparison.d)
import    core.stdc.string  
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/string.d)
import    std.format    
(/root/usr/program/ldc/1.30/install/include/d/std/format/package.d)
import    std.format.read   
(/root/usr/program/ldc/1.30/install/include/d/std/format/read.d)
import    std.format.internal.read  
(/root/usr/program/ldc/1.30/install/include/d/std/format/internal/read.d)
import    std.algorithm.searching   
(/root/usr/program/ldc/1.30/install/include/d/std/algorithm/searching.d)
import    std.bitmanip  
(/root/usr/program/ldc/1.30/install/include/d/std/bitmanip.d)
import    std.system    
(/root/usr/program/ldc/1.30/install/include/d/std/system.d)
import    core.bitop    
(/root/usr/program/ldc/1.30/install/include/d/core/bitop.d)
import    core.memory   
(/root/usr/program/ldc/1.30/install/include/d/core/memory.d)
import    core.time 
(/root/usr/program/ldc/1.30/install/include/d/core/time.d)
import    core.sys.posix.time   
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/time.d)
import    core.sys.posix.signal 
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/signal.d)
import    core.sys.posix.sys.time   
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/sys/time.d)
import    core.sys.posix.sys.select 
(/root/usr/program/ldc/1.30/install/include/d/core/sys/posix/sys/select.d)
import    core.sys.linux.sys.time   
(/root/usr/program/ldc/1.30/install/include/d/core/sys/linux/sys/time.d)
import    core.sys.linux.config 
(/root/usr/program/ldc/1.30/install/include/d/core/sys/linux/config.d)
import    core.internal.array.utils 
(/root/usr/program/ldc/1.30/install/include/d/core/internal/array/utils.d)
import    core.checkedint   
(/root/usr/program/ldc/1.30/install/include/d/core/checkedint.d)
import    std.string    
(/root/usr/program/ldc/1.30/install/include/d/std/string.d)
import    std.uni   
(/root/usr/program/ldc/1.30/install/include/d/std/uni/package.d)
import    std.internal.unicode_tables   
(/root/usr/program/ldc/1.30/install/include/d/std/internal/unicode_tables.d)
import    core.internal.lifetime    
(/root/usr/program/ldc/1.30/install/include/d/core/internal/lifetime.d)
import    std.format.internal.floats    
(/root/usr/program/ldc/1.30/install/include/d/std/format/internal/floats.d)
import    std.math.operations   
(/root/usr/program/ldc/1.30/install/include/d/std/math/operations.d)
import    std.math  
(/root/usr/program/ldc/1.30/install/include/d/std/math/package.d)
import    std.math.algebraic    
(/root/usr/program/ldc/1.30/install/include/d/std/math/algebraic.d)
import    core.math 
(/root/usr/program/ldc/1.30/install/include/d/core/math.d)
import    core.stdc.math    
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/math.d)
import    std.math.constants    
(/root/usr/program/ldc/1.30/install/include/d/std/math/constants.d)
import    std.math.exponential  
(/root/usr/program/ldc/1.30/install/include/d/std/math/exponential.d)
import    std.math.hardware 
(/root/usr/program/ldc/1.30/install/include/d/std/math/hardware.d)
import    core.stdc.fenv    
(/root/usr/program/ldc/1.30/install/include/d/core/stdc/fenv.d)
import    core.cpuid    
(/root/usr/program/ldc/1.30/install/include/d/core/cpuid.d)
import    std.math.remainder    
(/root/usr/program/ldc/1.30/install/include/d/std/math/remainder.d)
import    std.math.rounding 
(/root/usr/program/ldc/1.30/install/include/d/std/math/rounding.d)
import    std.math.traits   
(/root/usr/program/ldc/1.30/install/include/d/std/math/traits.d)
import    std.math.trigonometry 
(/root/usr/program/ldc/1.30/install/include/d/std/math/trigonometry.d)
import    std.internal.unicode_grapheme 
(/root/usr/program/ldc/1.30/install/include/d/std/internal/unicode_grapheme.d)
GC stats  0M used, 5M free, 5M total
code      app
/root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app 
-L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc 
-ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32
```

The GCC compiler is built on `i686`:

```sh

cc (GCC) 9.5.0
```

At first I thought that I needed to rebuild the `GCC` compiler 
for the `i586` architecture. I downloaded GCC 9.5.0 and started 
the installation:

```sh


gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.



i586-pc-linux-gnu

--enable-shared --enable-threads=posix --enable-__cxa_atexit 
--enable-clocale=gnu --enable-languages=c,c++,d 
--target=i586-pc-linux-gnu --disable-multilib 
--with-multilib-list=m32
...

...
```

But during the installation process I got an error:

```sh
...
checking for suffix of object files... mv -f .deps/findcomp.Tpo 
.deps/findcomp.Plo
configure: error: in 
`/root/source/gcc/9.5.0/build/i586-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot 
compile
See `config.log' for more details
Makefile:14150: recipe for target 'configure-target-libgcc' failed
make[1]: *** [configure-target-libgcc] Error 1
make[1]: *** Waiting for unfinished jobs....
...
```

If I do it without a flag `--target=i586-pc-linux-gnu`, then 
everything is assembled without errors.

I'm at a dead end, please help, guys.
Jul 27 2022
next sibling parent reply Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov wrote:
 ```sh
 /root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app 
 -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc 
 -ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32
 ```
Even tried with such a flag separately, it still doesn't work: ```sh -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc -ldrun time-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32 -march=geode Illegal instruction ``` I also tried with `i586` and `pentium` - the result is the same.
Jul 27 2022
next sibling parent reply user1234 <user1234 12.de> writes:
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov wrote:
 On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov
 x86    - 32-bit X86: Pentium-Pro and above
I also tried with `i586` and `pentium` - the result is the same.
Pentium Pro and above means at least i686. i586 is Pentium1 which is less featured. That means that you cant do much, however you can try to tune the i686 target and disable emiting of the instructions that were added from the Pentium Pro. Maybe that the produced instruction will then be compatible. that would be something like `--mcpu=i686 --mattrs=-mmx,-sse` and maybe more to be sure. Other things: "Registered Targets: ... " means that maybe the LDC developers could add the i586 target but did not consider useful to add this is old processor (e.g Pentium1). For that you should ask them if you can and how activate the target when you build ldc2 on your old Geode.
Jul 28 2022
next sibling parent user1234 <user1234 12.de> writes:
On Thursday, 28 July 2022 at 07:16:13 UTC, user1234 wrote:
 On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov 
 wrote:
 [...]
Pentium Pro and above means at least i686. i586 is Pentium1 which is less featured. That means that you cant do much, however you can try to tune the i686 target and disable emiting of the instructions that were added from the Pentium Pro. Maybe that the produced instruction will then be compatible. that would be something like `--mcpu=i686 --mattrs=-mmx,-sse` and maybe more to be sure. Other things: "Registered Targets: ... " means that maybe the LDC developers could add the i586 target but did not consider useful to add this is old processor (e.g Pentium1). For that you should ask them if you can and how activate the target when you build ldc2 on your old Geode.
ask here https://forum.dlang.org/group/ldc for better answers
Jul 28 2022
prev sibling parent Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 07:16:13 UTC, user1234 wrote:
 that would be something like `--mcpu=i686 --mattrs=-mmx,-sse` 
 and maybe more to be sure.
Fails... ```sh Illegal instruction ```
Jul 28 2022
prev sibling parent reply kdevel <kdevel vogtner.de> writes:
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov wrote:
 On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov 
 wrote:
 ```sh
 /root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app 
 -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc 
 -ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32
 ```
So you eventually built GCC 9.5.0? I have used the ``` --with-arch-32=pentium3 ``` option in the configure step for compiling GCC 12.1.0. The build gdc generates codes which successfully runs on my Pentium III.
Jul 28 2022
next sibling parent reply Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 10:26:36 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov 
 wrote:
 On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov 
 wrote:
 ```sh
 /root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app 
 -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc 
 -ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32
 ```
So you eventually built GCC 9.5.0? I have used the ``` --with-arch-32=pentium3 ``` option in the configure step for compiling GCC 12.1.0. The build gdc generates codes which successfully runs on my Pentium III.
I don't understand what I need to do.
Jul 28 2022
parent reply kdevel <kdevel vogtner.de> writes:
On Thursday, 28 July 2022 at 10:39:06 UTC, Alexander Zhirov wrote:
[...]
 I don't understand what I need to do.
You wrote At first I thought that I needed to rebuild the GCC compiler for the i586 architecture. I downloaded GCC 9.5.0 and started the installation: Then you wrote that this process failed. In your next post you quoted some code from the shell: ``` -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc -ldrun time-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32 -march=geode Illegal instruction ``` I read this as if you eventually succeeded in compiling your GCC 9.5.0. If you repeat that build but use the switch ``` --with-arch-32=pentium3 ``` in the configure command your generated GCC 9.5.0 will compile 32-Bit code for the pentium3. I mean instead of ``` --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,d --target=i586-pc-linux-gnu --disable-multilib --with-multilib-list=m32 ``` type ``` --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,d --target=i586-pc-linux-gnu --disable-multilib --with-multilib-list=m32 --with-arch-32=pentium3 ```
Jul 28 2022
parent reply Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 11:40:09 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 10:39:06 UTC, Alexander Zhirov 
 wrote:
 [...]
 I don't understand what I need to do.
You wrote At first I thought that I needed to rebuild the GCC compiler for the i586 architecture. I downloaded GCC 9.5.0 and started the installation: Then you wrote that this process failed. In your next post you quoted some code from the shell: ``` -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc -ldrun time-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32 -march=geode Illegal instruction ``` I read this as if you eventually succeeded in compiling your GCC 9.5.0. If you repeat that build but use the switch ``` --with-arch-32=pentium3 ``` in the configure command your generated GCC 9.5.0 will compile 32-Bit code for the pentium3. I mean instead of ``` --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,d --target=i586-pc-linux-gnu --disable-multilib --with-multilib-list=m32 ``` type ``` --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,d --target=i586-pc-linux-gnu --disable-multilib --with-multilib-list=m32 --with-arch-32=pentium3 ```
I have already downloaded the latest GCC sources, nothing compiles anyway. Everything falls on the same error. ```sh checking for suffix of object files... configure: error: in `/home/thinstation/source/gcc/12.1.0/build/i586-pc-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details make[1]: *** [Makefile:16026: configure-target-libgcc] Error 1 make[1]: *** Waiting for unfinished jobs.... ```
Jul 28 2022
parent reply kdevel <kdevel vogtner.de> writes:
On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov wrote:
[...]
 I have already downloaded the latest GCC sources, nothing 
 compiles anyway.
How did you manage to get hold of this compiler? ``` /root/usr/program/gcc/9.5.0/install/bin/cc ```
 Everything falls on the same error.

 ```sh
 checking for suffix of object files... configure: error: in 
 `/home/thinstation/source/gcc/12.1.0/build/i586-pc-linux-gnu/libgcc':
 configure: error: cannot compute suffix of object files: cannot 
 compile
 See `config.log' for more details
Have you looked into config.log? The errors are frequently located in the second half of the output.
Jul 28 2022
parent reply Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 13:16:26 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov 
 wrote:
 [...]
 I have already downloaded the latest GCC sources, nothing 
 compiles anyway.
How did you manage to get hold of this compiler? ``` /root/usr/program/gcc/9.5.0/install/bin/cc ```
 Everything falls on the same error.

 ```sh
 checking for suffix of object files... configure: error: in 
 `/home/thinstation/source/gcc/12.1.0/build/i586-pc-linux-gnu/libgcc':
 configure: error: cannot compute suffix of object files: 
 cannot compile
 See `config.log' for more details
Have you looked into config.log? The errors are frequently located in the second half of the output.
In general, nothing happened. I've already tried everything. Here is the result, posted [here](https://pastebin.com/76gnneKZ).
Jul 28 2022
next sibling parent reply kdevel <kdevel vogtner.de> writes:
On Thursday, 28 July 2022 at 15:25:00 UTC, Alexander Zhirov wrote:
 On Thursday, 28 July 2022 at 13:16:26 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov 
 wrote:
 [...]
 I have already downloaded the latest GCC sources, nothing 
 compiles anyway.
How did you manage to get hold of this compiler? ``` /root/usr/program/gcc/9.5.0/install/bin/cc ```
Where does this compiler come from?
Jul 28 2022
parent reply Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 16:02:11 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 15:25:00 UTC, Alexander Zhirov 
 wrote:
 On Thursday, 28 July 2022 at 13:16:26 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov 
 wrote:
 [...]
 I have already downloaded the latest GCC sources, nothing 
 compiles anyway.
How did you manage to get hold of this compiler? ``` /root/usr/program/gcc/9.5.0/install/bin/cc ```
Where does this compiler come from?
This is an unpacked archive from an official source from the GNU website https://ftp.mpi-inf.mpg.de/mirrors/gnu/mirror/gcc.gnu.org/pub/gcc/releases/gcc-9.5.0/
Jul 28 2022
parent kdevel <kdevel vogtner.de> writes:
On Thursday, 28 July 2022 at 16:03:46 UTC, Alexander Zhirov wrote:
[...]
 How did you manage to get hold of this compiler?

 ```
 /root/usr/program/gcc/9.5.0/install/bin/cc
 ```
Where does this compiler come from?
This is an unpacked archive from an official source from the GNU website https://ftp.mpi-inf.mpg.de/mirrors/gnu/mirror/gcc.gnu.org/pub/gcc/releases/gcc-9.5.0/
The archive `gcc-9.5.0.tar.gz` I found in that directory does not contain any binary compiler. The only "file" named "cc" is the directory ``` ./gcc/testsuite/ada/acats/tests/cc ```
Jul 28 2022
prev sibling parent kdevel <kdevel vogtner.de> writes:
On Thursday, 28 July 2022 at 15:25:00 UTC, Alexander Zhirov wrote:
[...]
 Everything falls on the same error.

 ```sh
 checking for suffix of object files... configure: error: in 
 `/home/thinstation/source/gcc/12.1.0/build/i586-pc-linux-gnu/libgcc':
 configure: error: cannot compute suffix of object files: 
 cannot compile
 See `config.log' for more details
Have you looked into config.log? The errors are frequently located in the second half of the output.
In general, nothing happened. I've already tried everything. Here is the result, posted [here](https://pastebin.com/76gnneKZ).
In such cases I usually take the error message, here `` configure: error: cannot compute suffix of object files: `` and search with google for it. Google points me to stackoverflow: <https://stackoverflow.com/questions/11502045/gcc-compilation-cannot-compute-suffix-of-object-files-cannot-compile> ``` This issue is caused by dyanmic link library path issue when the test programs try to link against libmpc/libmpfr/libgmp. Append below environment variable to allow ld link against the correct so file: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/ Then try build gcc again. ``` Does this help?
Jul 28 2022
prev sibling parent Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 10:26:36 UTC, kdevel wrote:
 On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov 
 wrote:
 On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov 
 wrote:
 ```sh
 /root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app 
 -L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc 
 -ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m32
 ```
So you eventually built GCC 9.5.0? I have used the ``` --with-arch-32=pentium3 ``` option in the configure step for compiling GCC 12.1.0. The build gdc generates codes which successfully runs on my Pentium III.
The only thing I did (but it still didn't work) was I [built](https://wiki.dlang.org/Building_under_Posix#Building_DMD) a `dmd` compiler: ```sh DMD32 D Compiler v2.100.1-3-g76e3b4137 Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved written by Walter Bright predefs DigitalMars LittleEndian D_Version2 all Posix ELFv1 linux CRuntime_Glibc CppRuntime_Gcc D_InlineAsm D_InlineAsm_X86 X86 D_PIC assert D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binary dmd version v2.100.1-3-g76e3b4137 config /root/usr/program/dmd/2.100.1/usr/bin/dmd.conf DFLAGS -I/root/usr/program/dmd/2.100.1/usr/bin/../include/dmd/druntime/import -I/root/usr/program/dmd/2.100.1/usr/bin/../include/dmd/phobos -L-L/root/usr/program/dmd/2.100.1/usr/bin/../lib -L--export-dynamic -fPIC parse app importall app import object (/root/usr/program/dmd/2.100.1/usr/bin/../include/dmd/druntime/import/object.d) ... function std.typecons.Tuple!(uint, "data", uint, "count").Tuple.opCmp!(const(Tuple!(uint, "data", uint, "count"))).opCmp cc app.o -o app -m32 -Xlinker --export-dynamic -L/root/usr/program/dmd/2.100.1/usr/bin/../lib -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread -lm -lrt -ldl Illegal instruction ```
Jul 28 2022
prev sibling next sibling parent dd <dd dax.moe> writes:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov wrote:
 I'm at a dead end, please help, guys.
1. Can you try with `ldc2 --march=32bit-mode`? The march list (--march=help) details this as "32-bit mode (80386)". 2. Can you try with `ldc2 --march=i586 -betterC` with a simple BetterC program? (Like `import core.stdc.stdio; extern(C) void main() { puts("test");}`) 3. Otherwise, can you try checking which instruction is illegal under a debugger? The i686 introduced the CMOVcc instruction which I think both compilers emit regardless of march (Default target: i686-pc-linux-gnu), since I think it's the default baseline, but I could be wrong.
Jul 28 2022
prev sibling parent Alexander Zhirov <azhirov1991 gmail.com> writes:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov wrote:
 I did a topic a [little 
 earlier](https://forum.dlang.org/thread/hfzsnagofrnlmynyzymp forum.dlang.org)
about compiling a compiler for processor Geode LX800.
 The bottom line is that I have a processor on which I want to 
 compile the program, is an i586 architecture.
Yes, I did it! I have an `i686` host with a `GCC 5.3.0` compiler. The build path is `/root/source`. 1. Using `GCC 5.3.0`, I built `GCC 9.5.0` in an `i686` environment ```sh mkdir /root/source/gcc && cd /root/source/gcc wget https://ftp.mpi-inf.mpg.de/mirrors/gnu/mirror/gcc.gnu.org/pub/gcc/releases/gcc-9.5.0/gcc-9.5.0.tar.gz tar xf gcc-9.5.0.tar.gz -C source cd source ./contrib/download_prerequisites mkdir /root/source/gcc/build && cd /root/source/gcc/build ../source/configure --prefix=$PWD/../install --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ make -j16 make install ``` 2. Using `GCC 9.5.0`, I built `LLVM 10.0.1` in an `i686` environment ```sh mkdir /root/source/llvm && cd /root/source/llvm wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/llvm-project-10.0.1.tar.xz tar xf llvm-project-10.0.1.tar.xz -C source mkdir /root/source/llvm/build && cd /root/source/llvm/build export CC=/root/source/gcc/install/bin/gcc export CXX=/root/source/gcc/gcc-install/bin/g++ cmake ../source -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DLLVM_TARGETS_TO_BUILD='X86' -DCOMPILER_RT_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF make -j16 make install ``` 3. Downloaded the `DMD 2.086.1` compiler (since this version runs on the `Geode LX800` processor without any problems) 4. Copied all this to an external HDD and connected it to my `Geode LX800 i586` 5. Using `GCC 9.5.0`, `LLVM 10.0.1` and `DMD 2.086.1`, I built `LDC 2.100.1` on `Geode LX800 i586` ```sh mkdir -p ~/ldc/build && cd ~/ldc git clone --recursive https://github.com/ldc-developers/ldc.git source cd build export PATH=<PATH_TO_GCC_BIN>:$PATH cmake ../source -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DLLVM_ROOT_DIR=<PATH_TO_LLVM_INSTALL> -DD_COMPILER=<PATH_TO_DMD_COMPILER_X32> make make install ``` 6. Then, through `ldc-build-runtime`, I rebuilt the libraries for `i586` ```sh ldc-build-runtime --dFlags="-mcpu=i586" --cFlags="-march=i586" ``` When performing the actions, I may have connected the necessary paths to `LD_LIBRARY_PATH` (I don't remember 😁). Now `LDC` with the flag `-mcpu=i586` compiles the binaries I need at the output and the architecture fully supports them! ```sh LDC - the LLVM D compiler (1.30.0-git-32f5a35): based on DMD v2.100.1 and LLVM 10.0.1 built with DMD32 D Compiler v2.086.1 Default target: i686-pc-linux-gnu Host CPU: geode http://dlang.org - http://wiki.dlang.org/LDC Registered Targets: x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 ``` Thank you so much for your help! **As a result, the reassembly of the `runtime` and `phobos` libraries helped. Would it be cool to figure out how to rebuild the `DMD` library for `i586`?**
Jul 29 2022