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

[Nim] Can't compile programs with SSL support #5904

Closed
ritcher opened this issue Oct 8, 2020 · 2 comments
Closed

[Nim] Can't compile programs with SSL support #5904

ritcher opened this issue Oct 8, 2020 · 2 comments
Labels
bug report Something is not working properly

Comments

@ritcher
Copy link

ritcher commented Oct 8, 2020

Problem description

It is not possible to compile Nim programs with SSL support.

Steps to reproduce

Write a simple Nim program that requires SSL support.

The program bellow uses Nim's built-in http client to connect to a website via https:

import httpClient
let client = newHttpClient()
echo client.getContent("https://example.com")

Now save the code in a text file and try to compile it with the -d:ssl flag:

$ echo -e 'import httpClient\nlet client = newHttpClient()\necho client.getContent("https://example.com")' > ssl_test.nim
$ nim compile --verbosity:1 -d:ssl ssl_test
Hint: used config file '/data/data/com.termux/files/usr/lib/nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: ssl_test [Processing]
Hint: httpclient [Processing]
Hint: net [Processing]
Hint: nativesockets [Processing]
Hint: os [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: macros [Processing]
Hint: algorithm [Processing]
Hint: unicode [Processing]
Hint: pathnorm [Processing]
Hint: osseps [Processing]
Hint: posix [Processing]
Hint: times [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: sets [Processing]
Hint: hashes [Processing]
Hint: monotimes [Processing]
Hint: ssl_certs [Processing]
Hint: ospaths [Processing]
Hint: openssl [Processing]
Hint: dynlib [Processing]
Hint: uri [Processing]
Hint: base64 [Processing]
Hint: mimetypes [Processing]
Hint: strtabs [Processing]
Hint: streams [Processing]
Hint: random [Processing]
Hint: httpcore [Processing]
Hint: tables [Processing]
Hint: asyncnet [Processing]
Hint: asyncdispatch [Processing]
Hint: heapqueue [Processing]
Hint: asyncstreams [Processing]
Hint: asyncfutures [Processing]
Hint: deques [Processing]
Hint: cstrutils [Processing]
Hint: selectors [Processing]
Hint: epoll [Processing]
Hint: asyncfile [Processing]
Hint:  [Link]
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_net.nim.c.o: in function `newContext__p45vOS9b3iK2JJ1Y7aIJ9bUA':
stdlib_net.nim.c:(.text+0x1924): undefined reference to `glob'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: stdlib_net.nim.c:(.text+0x1c2c): undefined reference to `globfree'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: stdlib_net.nim.c:(.text+0x1cc4): undefined reference to `globfree'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: stdlib_net.nim.c:(.text+0x2004): undefined reference to `glob'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: stdlib_net.nim.c:(.text+0x2358): undefined reference to `globfree'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: stdlib_net.nim.c:(.text+0x23fc): undefined reference to `globfree'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of an external program failed: 'clang   -o /data/data/com.termux/files/home/ssl_test  /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_assertions.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_io.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_system.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_parseutils.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_math.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_strutils.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_pathnorm.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_times.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_os.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_nativesockets.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_hashes.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_sets.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_monotimes.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_ssl_certs.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_dynlib.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_openssl.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_net.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_base64.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_uri.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_streams.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_random.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_tables.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_httpcore.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_heapqueue.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_deques.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_asyncfutures.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_selectors.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_asyncdispatch.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/stdlib_httpclient.nim.c.o /data/data/com.termux/files/home/.cache/nim/ssl_test_d/@mssl_test.nim.c.o  -lm   -ldl'

Expected behavior

Program compiles without errors.

Additional information

Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ stable main
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
Updatable packages:
All packages up to date
Android version:
8.1.0
Kernel build information:
Linux localhost 3.18.79 #2 SMP PREEMPT Wed Sep 12 13:32:44 CST 2018 armv7l Android
Device manufacturer:
teksun
Device model:
AllCall_S1_X
@ghost
Copy link

ghost commented Oct 11, 2020

Needs -landroid-glob in clang's command line while linking binary.

@ghost ghost added the bug report Something is not working properly label Oct 11, 2020
@ghost ghost closed this as completed in 8acc287 Oct 11, 2020
@ghost
Copy link

ghost commented Oct 11, 2020

Added fix in 8acc287.

Alternate way is passing flag -d:termux.

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug report Something is not working properly
Projects
None yet
Development

No branches or pull requests

1 participant