bebbo / libnix

libnix (v4): a C link library for AmigaOS/m68k
14 stars 9 forks source link

Compiling with FPU support, exe fails to run without mathieeedoubtrans.library #32

Closed TCH68k closed 4 years ago

TCH68k commented 4 years ago

I've compiled the program like this:

m68k-amigaos-gcc -mcrt=nix20 -mcpu=68030 -march=68030 -m68881 -lm main.c -o main

But the program fails to start; it says, it needs mathieeedoubtrans.library. Did i something wrong, or is this a bug?

The host system is Linux AMD64.

bebbo commented 4 years ago

you have to add '-mhard-float' to avoid this.

TCH68k commented 4 years ago

Now i tried that way:

m68k-amigaos-gcc -mcrt=nix20 -mcpu=68030 -march=68030 -m68881 -mhard-float -lm main.c -o main

It is still fails to start with the same error message.

bebbo commented 4 years ago

then add the missing lib to libs:

TCH68k commented 4 years ago

That's not the point. This executable should work without the math*.library files.

bebbo commented 4 years ago

Then use a lib which does not use math*.libararies. libnix does.

TCH68k commented 4 years ago

I figured it out right this moment, that it was the -mcrt=nix20 option what caused the problem, but i did not know why; now it makes sense. Thanks.

TCH68k commented 4 years ago

However without that option, my program does not do anything. Just gives back the prompt. Even the first printf("KECSKE\n"); does not work. What can i use instead of nix20?

TCH68k commented 4 years ago

If i use clib2

m68k-amigaos-gcc -mcrt=clib2 -mcpu=68030 -march=68030 -m68881 -mhard-float -lm main.c -o main

Then i get back a bunch of error messages:

/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `AmigaBlitterDrawPolygon2D':
/tmp/ccKm1gc0.o:(.text+0x126c): undefined reference to `SetDrMd'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x128c): undefined reference to `InitArea'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x12b2): undefined reference to `AreaMove'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x12e6): undefined reference to `AreaDraw'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x1308): undefined reference to `AreaEnd'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `new_screen':
/tmp/ccKm1gc0.o:(.text+0x13aa): undefined reference to `OpenScreen'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `speccy_palette':
/tmp/ccKm1gc0.o:(.text+0x1442): undefined reference to `SetRGB4'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `RasterBufInit':
/tmp/ccKm1gc0.o:(.text+0x1554): undefined reference to `InitTmpRas'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `AmigaBlitterDrawPolygon2D':
/tmp/ccKm1gc0.o:(.text+0x123e): undefined reference to `SetAPen'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `main':
/tmp/ccKm1gc0.o:(.text+0x175a): undefined reference to `CloseScreen'
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function `AmigaBlitterDrawPolygon2D':
/tmp/ccKm1gc0.o:(.text+0x125c): undefined reference to `SetBPen'
collect2: error: ld returned 1 exit status
SamuraiCrow commented 4 years ago

Try it with -lamiga to bind to the libraries.

On Mon, Mar 2, 2020 at 2:09 PM, TCH68knotifications@github.com wrote:
If i use clib2 m68k-amigaos-gcc -mcrt=clib2 -mcpu=68030 -march=68030 -m68881 -mhard-float -lm main.c -o main

Then i get back a bunch of error messages: /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function AmigaBlitterDrawPolygon2D': /tmp/ccKm1gc0.o:(.text+0x126c): undefined reference toSetDrMd' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x128c): undefined reference to InitArea' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x12b2): undefined reference toAreaMove' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x12e6): undefined reference to AreaDraw' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o:(.text+0x1308): undefined reference toAreaEnd' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function new_screen': /tmp/ccKm1gc0.o:(.text+0x13aa): undefined reference toOpenScreen' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function speccy_palette': /tmp/ccKm1gc0.o:(.text+0x1442): undefined reference toSetRGB4' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function RasterBufInit': /tmp/ccKm1gc0.o:(.text+0x1554): undefined reference toInitTmpRas' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function AmigaBlitterDrawPolygon2D': /tmp/ccKm1gc0.o:(.text+0x123e): undefined reference toSetAPen' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function main': /tmp/ccKm1gc0.o:(.text+0x175a): undefined reference toCloseScreen' /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /tmp/ccKm1gc0.o: in function AmigaBlitterDrawPolygon2D': /tmp/ccKm1gc0.o:(.text+0x125c): undefined reference toSetBPen' collect2: error: ld returned 1 exit status

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

TCH68k commented 4 years ago
m68k-amigaos-gcc -mcrt=clib2 -mcpu=68030 -march=68030 -m68881 -mhard-float -lm -lamiga main.c -o main

Same error messages.

SamuraiCrow commented 4 years ago

Order is significant.  Try putting main.c before the linking commands.

On Mon, Mar 2, 2020 at 2:15 PM, TCH68knotifications@github.com wrote: m68k-amigaos-gcc -mcrt=clib2 -mcpu=68030 -march=68030 -m68881 -mhard-float -lm -lamiga main.c -o main

Same error messages.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe.

TCH68k commented 4 years ago

Nope, did not change anything.

bebbo commented 4 years ago

I modified the libnix Makefile.gcc6 to apply -mhard-float to the libs for 68881. Rebuild your libnix libs once this is live and try again with libnix.

bebbo commented 4 years ago

see af4270f

TCH68k commented 4 years ago

I've rebuilt the entire SDK (it was long overdue anyway):

git clone https://github.com/bebbo/amiga-gcc
cd amiga-gcc
make update
make all -j7

And then i compiled:

m68k-amigaos-gcc -mcrt=nix20 -mcpu=68030 -march=68030 -m68881 -mhard-float -lm -lamiga main.c -o main

Nothing has changed. Still requires mathieeedoubtrans.library. It does not change things if i omit the option -lamiga or -m68881 or both.

bebbo commented 4 years ago

Rebuild your libnix libs once this is live and try again with libnix.

you could modify Makefile.gcc6 manually and replace -m68881 with -m68881 -mhard-float in projects/libnix. Note that this will break future git pulls ...

Then do make clean-libnix and make libnix

TCH68k commented 4 years ago

Sorry, i thought the commit you linked in meant that it is live. When will it be then?

I'd rather stick to the upstream version of everything, i do not want to break anything.

bebbo commented 4 years ago

it's live:

cat >nix32.c <<EOF
#include <stdio.h>
int main(int argc, char ** argv) {
        printf("%e\n", 3.14159d * (double)argc);
        return 0;
}
EOF
m68k-amigaos-gcc nix32.c -o nix32 -Os -noixemul -m68020 -m68881 -mhard-float -lm
vamos -C40 nix32
3.141590e+00
TCH68k commented 4 years ago

It works, thank you.