Closed asr closed 8 years ago
Any comment about this issue?
@asr It's probably easiest to just disable the float equality primitive in the UHC backend (for now). I can do that if you don't mind?
OK. Please file an Agda issue about it.
If the extracted/unpacked sources from the ieee746 package are on the search path of UHC then both .hs and .c should be picked up and compiled. C compilation is integrated into UHC for the 'bc' (default) backend.
I downloaded the ieee754 package on the ~/tmp-asr/ieee754-0.7.8
directory using cabal get ieee754
.
Now adding the -i
command-line option I got the following error:
$ uhc -i ~/tmp-asr/ieee754-0.7.8/ Test.hs
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3797:16: error: ‘feqrelf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3799:16: error: ‘mknan’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3801:16: error: ‘ieeemeanf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3803:16: error: ‘mknanf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3805:16: error: ‘nextdownf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3807:16: error: ‘nextup’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3809:16: error: ‘getnanf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3811:16: error: ‘ieeemean’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3813:16: error: ‘getnan’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3815:16: error: ‘feqrel’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3817:16: error: ‘nextupf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3819:16: error: ‘nextdown’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3820:16: error: ‘identicalf’ undeclared here (not in a function)
/home/asr/tmp-asr/ieee754-0.7.8//Numeric/IEEE.c:3822:16: error: ‘identical’ undeclared here (not in a function)
Note that the IEEE.c:
file is generated by UHC.
Note also I fixed a typo in the OP: ieee746 -> ieee754
Am I missing something?
UHC does not know which .c files to compile, i.e. there is not a real import mechanism like in Haskell nor a cabal spec & mechanism. .c files of which the .h file is used still have to be explicitly specified on the commandline invocation of UHC.
A MVE:
$ cat Test.hs
module Main where
foreign import ccall "id" c_id :: Double -> Double
main = print (c_id 1.0)
$ cat id.c
int
id (double x)
{
return x;
}
Using GHC:
$ ghc Test.hs id.c
$ ./Test
1.0
Using UHC:
$ uhc Test.hs id.c
[1/2] Compiling C id (id.c)
[2/2] Compiling Haskell Main (Test.hs)
Test.c:162:16: error: ‘id’ undeclared here (not in a function)
What else do I need to include when invoking UHC?
The "id" in the import should (as per FFI spec for Haskell) refer to an include file, say id.h, mentioning id via an extern declaration. The "id" should be "id.h id". That ought to do it...
A
On 28 Sep 2016, at 17:51, Andrés Sicard-Ramírez notifications@github.com wrote:
A MVE:
$ cat Test. hs
module Main where
foreign import ccall "id" c_id :: Double -> Double
main = print (c_id 1.0 )
foreign import ccall "identical" c_identical :: Double -> Double
main = print (c_identical 1.0) $ cat id.c
int id (double x) {
return x; }
Using GHC:
$ ghc Test.hs id.c $ ./Test 1.0
Using UHC:
Using UHC:
$ uhc Test.hs id.c [1/2] Compiling C id (id.c) [2/2] Compiling Haskell Main (Test.hs) Test.c:162:16: error: ‘id’ undeclared here (not in a function)
What else do I need to include when invoking UHC?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
That works. Thanks!
For future reference, I add the fixed example:
$ cat Test.hs
module Main where
foreign import ccall "id.h id" c_id :: Double -> Double
main = print (c_id 1.0)
$ cat id.h
int id (double x);
$ cat id.c
int
id (double x)
{
return x;
}
Using GHC:
$ ghc Test.hs id.c
Using UHC:
$ uhc Test.hs id.h
For fixing https://github.com/agda/agda/issues/2169 I need to use the
identicalIEEE
function from the ieee754 package. How can I use this function on UHC?Right now, I'm getting the following error:
CC'ing @phile314