Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TCH68k opened this issue Mar 2, 2020 · 19 comments

Comments

@TCH68k
Copy link

TCH68k commented Mar 2, 2020

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
Copy link
Owner

bebbo commented Mar 2, 2020

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

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2020

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
Copy link
Owner

bebbo commented Mar 2, 2020

then add the missing lib to libs:

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2020

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

@bebbo
Copy link
Owner

bebbo commented Mar 2, 2020

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

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2020

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
Copy link
Author

TCH68k commented Mar 2, 2020

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
Copy link
Author

TCH68k commented Mar 2, 2020

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
Copy link

SamuraiCrow commented Mar 2, 2020 via email

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2020

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

Same error messages.

@SamuraiCrow
Copy link

SamuraiCrow commented Mar 2, 2020 via email

@TCH68k
Copy link
Author

TCH68k commented Mar 2, 2020

Nope, did not change anything.

@bebbo
Copy link
Owner

bebbo commented Mar 3, 2020

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 bebbo transferred this issue from bebbo/amiga-gcc Mar 3, 2020
@bebbo
Copy link
Owner

bebbo commented Mar 3, 2020

see af4270f

@TCH68k
Copy link
Author

TCH68k commented Mar 3, 2020

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
Copy link
Owner

bebbo commented Mar 3, 2020

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
Copy link
Author

TCH68k commented Mar 3, 2020

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
Copy link
Owner

bebbo commented Mar 9, 2020

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
Copy link
Author

TCH68k commented Mar 11, 2020

It works, thank you.

@TCH68k TCH68k closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants