ikod / dlang-requests

dlang http client library inspired by python-requests
Boost Software License 1.0
154 stars 32 forks source link

Undefined reference to idna #67

Closed ghost closed 6 years ago

ghost commented 6 years ago

When I try to use library I get this error message:

undefined reference to `_D4idna10idn_encodeFNfAyaZQe'

I copied these source code to project's import folder but still get this .

https://github.com/ikod/idna/tree/master/source

ikod commented 6 years ago

Hello, can you give more details? How do you compile library and how do you compile your sources? What is your OS?

Thanks

21 Фев 2018 г. 0:06 пользователь "Erdem" notifications@github.com написал:

When I try to use library I get this error message:

undefined reference to `_D4idna10idn_encodeFNfAyaZQe'

I copied these source code to project's import folder but still get this .

https://github.com/ikod/idna/tree/master/source

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ikod/dlang-requests/issues/67, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNuSfmWnNWszi1TP96ouYsWNOlGuJdYks5tW0HpgaJpZM4SMvwW .

ghost commented 6 years ago

My operating system is Ubuntu 16.04 64 bit. I compile library using dub command and seems to compile fine.

However when I try to compile some program which use to compile fine before it fails.

Here is the makefile:

KAYNAK := \
    kiraz.d \
    temizle.d \
    teksayfaolustur.d \
    dizge.d \
    adres.d \
    kayitguncelle.d \
    bolumolustur.d \
    yukle.d \
    arsd/dom.d \
    arsd/curl.d \

SECENEKLER=-I/home/erdem/Belgeler/kutuphane/ddili/import  -L-L/home/erdem/Belgeler/kutuphane/ddili/lib  -L-L/usr/lib/x86_64-linux-gnu
KUTUPHANE= -L-l:librequests.a -L-l:libasdf.a 
EKSECENEKLER=-L--no-warn-search-mismatch

#KUTUPHANE -L-l:libssl.so -L-l:libcrypto.so

kiraz:${KAYNAK}
    dmd ${KAYNAK} ${SECENEKLER} ${EKSECENEKLER} ${KUTUPHANE} -of$@

birimtesti:${KAYNAK}
    dmd -unittest ${KAYNAK} ~/Belgeler/kutuphane/ddili/import/requests/uri.d ${SECENEKLER} ${EKSECENEKLER} ${KUTUPHANE} -ofbirimtesti

temizle clean:
    rm -f *.o *.d~ *.py~ *.c~ *.pyc *.# *.d# Makefile~
    find . -maxdepth 1 ! -name 'sil' -perm +100 -type f -delete

Complete error message :

make dmd kiraz.d temizle.d teksayfaolustur.d dizge.d adres.d kayitguncelle.d bolumolustur.d yukle.d arsd/dom.d arsd/curl.d -I/home/erdem/Belgeler/kutuphane/ddili/import -L-L/home/erdem/Belgeler/kutuphane/ddili/lib -L-L/usr/lib/x86_64-linux-gnu -L--no-warn-search-mismatch -L-l:librequests.a -L-l:libasdf.a -L-l:libssl.so -L-l:libcrypto.so -ofkiraz temizle.d(103): Deprecation: catch statement without an exception specification is deprecated; use catch(Throwable) for old behavior temizle.d(211): Deprecation: catch statement without an exception specification is deprecated; use catch(Throwable) for old behavior kiraz.o: In function _D4arsd3dom8Document__T18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream': arsd/curl.d:(.text._D4arsd3dom8Document__T18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream[_D4arsd3dom8Document__T18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream]+0x43): undefined reference to_D4arsd18characterencodings22tryToDetermineEncodingFxAhZAya' arsd/curl.d:(.text._D4arsd3dom8DocumentT18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream[_D4arsd3dom8DocumentT18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream]+0x439): undefined reference to `_D4arsd18characterencodings13convertToUtf8FAyhAyaZQe' arsd/curl.d:(.text._D4arsd3dom8DocumentT18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream[_D4arsd3dom8DocumentT18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream]+0x46f): undefined reference to _D4arsd18characterencodings13convertToUtf8FAyhAyaZQe' arsd/curl.d:(.text._D4arsd3dom8Document__T18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream[_D4arsd3dom8Document__T18handleDataEncodingZQvMFxAyaAyabZCQCeQCc10Utf8Stream]+0x4c6): undefined reference to_D4arsd18characterencodings13convertToUtf8FAyhAyaZQe' /home/erdem/Belgeler/kutuphane/ddili/lib/librequests.a(http_1e5_429.o): In function _D8requests4http11HTTPRequest15setupConnectionMFZv': source/requests/http.d:(.text._D8requests4http11HTTPRequest15setupConnectionMFZv[_D8requests4http11HTTPRequest15setupConnectionMFZv]+0xd1): undefined reference to_D4idna10idn_encodeFNfAyaZQe' source/requests/http.d:(.text._D8requests4http11HTTPRequest15setupConnectionMFZv[_D8requests4http11HTTPRequest15setupConnectionMFZv]+0x1ae): undefined reference to _D4idna10idn_encodeFNfAyaZQe' /home/erdem/Belgeler/kutuphane/ddili/lib/librequests.a(uri_1e33_f0.o): In function_D8requests3uri3URI10idn_encodeMFNfZv': source/requests/uri.d:(.text._D8requests3uri3URI10idn_encodeMFNfZv[_D8requests3uri3URI10idn_encodeMFNfZv]+0x1b): undefined reference to `_D4idna10idn_encodeFNfAyaZQe' collect2: error: ld returned 1 exit status Error: linker exited with status 1 Makefile:22: recipe for target 'kiraz' failed make: *** [kiraz] Error 1

ikod commented 6 years ago

Hello, Thanks for the info. idna is International Domain Names for Application. It allow to resolve names in national alpahbets and was added recently to requests.

If not done automatically by dub - you have to fetch and build it it with dub fetch idna && dub build idna

To solve problem with idn_encode you have to add path to idna package sources and add it to linker list of libraries:

SECENEKLER=-I/home/erdem/Belgeler/kutuphane/ddili/import  -I/home/erdem/.dub/packages/idna-0.0.1/idna/source/ -L-L/home/erdem/Belgeler/kutuphane/ddili/lib  -L-L/usr/lib/x86_64-linux-gnu -L-L/home/erdem.dub/packages/idna-0.0.1/idna/

KUTUPHANE= -L-l:librequests.a -L-l:libasdf.a -L-l:libidna.a

If you updacked and compiled idna library in some other place then default dub local repository, then, please, change -I option accordingly.

Hope this helps.

ghost commented 6 years ago

Thanks this solved the issue.