2016-08-09 4 views
2

오기 모듈을 컴파일 할 수 없습니다 (그것도 사용하지 않습니다) :는 최소한의 모듈 <code>Foreign.R</code>를 가져 오는 여기 Foreign.R

-- test.hs 
{-# LANGUAGE ForeignFunctionInterface #-} 

module Test where 

import Foreign 
import Foreign.R 

foreign export ccall testR :: Ptr (Double) -> IO() 

testR :: Ptr (Double) -> IO() 
testR result = do 
    poke result $ 1 

이 컴파일이 실패 :

ghc -fPIC -shared -dynamic -lHSrts-ghc7.10.3 test.hs -o test.so 

그것은 제공 : 프랑스어

Linking test.so ... 
/usr/bin/ld: test.o: réadressage R_X86_64_PC32 vers symbole « Test_testR_closure » ne peut pas être utilisé en créant un objet partagé ; recompilé avec -fPIC 
/usr/bin/ld : échec de l'édition de liens finale : Mauvaise valeur 
collect2: error: ld returned 1 exit status 

죄송합니다 ... 영어로는 보일 것 같은 :

Linking test.so ... 
/usr/bin/ld: test.o: relocation R_X86_64_PC32 to symbol « Test_testR_closure » cannot be used by creating a shared object; recompile with -fPIC 
/usr/bin/ld : failure edit final link : Bad value 
collect2: error: ld returned 1 exit status 

import Foreign.R을 삭제해도 문제 없습니다.

답변

3

나는 a fix here을 찾았습니다.

우분투에, 내가 그랬어 : 지금 컴파일 할 때

sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 

더 이상 오류가 없습니다.