parasyte / alt64

Alternate Everdrive64 Menu. Original release from: http://krikzz.com/forum/index.php?topic=816.0
69 stars 38 forks source link

Compilation error: impossible constraint in 'asm' #5

Closed joeydumont closed 7 years ago

joeydumont commented 7 years ago

I have tried to compile alt64 on Arch Linux after installing libdragon-git and libdragon-tools-git from the AUR. However, trying make yields the following errors:

valandil ~/Dropbox/Everdrive/alt64 $ make
/usr/bin/mips64-elf-gcc -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I/usr/include -I/usr/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE   -c -o menu.o menu.c
In file included from /usr/include/math.h:472:0,
                 from menu.c:13:
stb_truetype.h: In function 'stbtt__rasterize_sorted_edges':
/usr/include/bits/mathinline.h:751:3: error: impossible constraint in 'asm'
   __asm __volatile ("fnstcw %3\n\t"           \
   ^
/usr/include/bits/mathinline.h:503:5: note: in definition of macro '__inline_mathcodeNP_'
     code;              \
     ^~~~
/usr/include/bits/mathinline.h:746:1: note: in expansion of macro '__inline_mathcodeNP'
 __inline_mathcodeNP (floor, __x, \
 ^~~~~~~~~~~~~~~~~~~
/usr/include/bits/mathinline.h:751:3: error: impossible constraint in 'asm'
   __asm __volatile ("fnstcw %3\n\t"           \
   ^
/usr/include/bits/mathinline.h:503:5: note: in definition of macro '__inline_mathcodeNP_'
     code;              \
     ^~~~
/usr/include/bits/mathinline.h:746:1: note: in expansion of macro '__inline_mathcodeNP'
 __inline_mathcodeNP (floor, __x, \
 ^~~~~~~~~~~~~~~~~~~
/usr/include/bits/mathinline.h:751:3: error: impossible constraint in 'asm'
   __asm __volatile ("fnstcw %3\n\t"           \
   ^
/usr/include/bits/mathinline.h:503:5: note: in definition of macro '__inline_mathcodeNP_'
     code;              \
     ^~~~
/usr/include/bits/mathinline.h:746:1: note: in expansion of macro '__inline_mathcodeNP'
 __inline_mathcodeNP (floor, __x, \
 ^~~~~~~~~~~~~~~~~~~
make: *** [<builtin>: menu.o] Error 1

I'm not really well versed in assembly, so I really have no clue of what the issue might be. Any ideas?

parasyte commented 7 years ago

That's libm (part of glibc) ... Your compiler is trying to include the x86 runtime libraries. The -I/usr/include cli argument does not seem right. The Arch package does expect it to be the correct installation directory, though.

I'll admit, I haven't tried to build on Arch against the libdragon packages provided. I always just built the entire toolchain myself (on Ubuntu).

The only thing I can think of is ensuring your N64_INST variable has been exported correctly. The Arch package expects export N64_INST=/usr, but that seems to be dangerous.

joeydumont commented 7 years ago

Ok, so what version of bits/mathinline.h should in be #included? The only version I seem to have on my computer is the x86 one, located under /usr/include/bits/mathinline.h.

I have moved -I$(ROOTDIR)/mips64-elf/include before -I$(ROOTDIR)/include in the Makefile to make sure that it searched for, to no avail.

UPDATE: Before going any further with this, I'll try installing the whole toolchain by hand like you suggest.

parasyte commented 7 years ago

It should only be including the headers and libs from libdragon, which contains newlib; that's where you'll find all the C runtime libs and headers.

networkfusion commented 7 years ago

Take a look at my build script at: http://krikzz.com/forum/index.php?topic=5880.0 it is for my fork of this project but should give you some good hints...

parasyte commented 7 years ago

@networkfusion Nice fork :+1:

joeydumont commented 7 years ago

Thanks @networkfusion, that gave me a boost in the right direction. It was a case of a broken cross-compiler configuration. I used the following AUR packages:

and used your forks of libmikmod and libmad to succesfully compile alt64, as I failed to compile them by modifying the PKGBUILD to use mips64-elf-gcc. If I'm able to pull that off though, I will create a AUR package for alt64. For the time being, my manual solution suffices.

Cheers,