Thread overview
Vibe.d build on LDC error
Nov 06, 2020
Vino
Nov 06, 2020
Mathias LANG
Nov 06, 2020
Vino
November 06, 2020
Hi All,

  When we try to build vide.d using ldc (dub build) we are getting the below error, openssl is already been installed (OpenSSL 1.0.2j-fips  26 Sep 2016), hence request your help on the same.

openssl.d:84: error: undefined reference to 'OPENSSL_init_ssl'
openssl.d:121: error: undefined reference to 'OPENSSL_sk_num'
openssl.d:128: error: undefined reference to 'OPENSSL_sk_value'
openssl.d:243: error: undefined reference to 'BIO_set_init'
openssl.d:244: error: undefined reference to 'BIO_set_data'
openssl.d:245: error: undefined reference to 'BIO_set_shutdown'
openssl.d:1382: error: undefined reference to 'BIO_get_new_index'
openssl.d:1382: error: undefined reference to 'BIO_meth_new'
openssl.d:1384: error: undefined reference to 'BIO_meth_set_write'
openssl.d:1385: error: undefined reference to 'BIO_meth_set_read'
openssl.d:1386: error: undefined reference to 'BIO_meth_set_ctrl'
openssl.d:1387: error: undefined reference to 'BIO_meth_set_create'
openssl.d:1388: error: undefined reference to 'BIO_meth_set_destroy'
openssl.d:899: error: undefined reference to 'BN_get_rfc3526_prime_2048'
openssl.d:1288: error: undefined reference to 'BIO_set_init'
openssl.d:1290: error: undefined reference to 'BIO_set_data'
openssl.d:1298: error: undefined reference to 'BIO_get_shutdown'
openssl.d:1300: error: undefined reference to 'BIO_set_init'
openssl.d:1302: error: undefined reference to 'BIO_set_data'
openssl.d:1309: error: undefined reference to 'BIO_get_data'
openssl.d:1323: error: undefined reference to 'BIO_get_data'
openssl.d:1339: error: undefined reference to 'BIO_get_shutdown'
openssl.d:1342: error: undefined reference to 'BIO_set_shutdown'
openssl.d:1335: error: undefined reference to 'BIO_get_data'
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1
/Project/dlang/ldc-1.24.0/bin/ldc2 failed with exit code 1.

From,
Vino.B
November 06, 2020
On Friday, 6 November 2020 at 05:52:56 UTC, Vino wrote:
> Hi All,
>
>   When we try to build vide.d using ldc (dub build) we are getting the below error, openssl is already been installed (OpenSSL 1.0.2j-fips  26 Sep 2016), hence request your help on the same.
>
> openssl.d:84: error: undefined reference to 'OPENSSL_init_ssl'
> openssl.d:121: error: undefined reference to 'OPENSSL_sk_num'
> openssl.d:128: error: undefined reference to 'OPENSSL_sk_value'
> openssl.d:243: error: undefined reference to 'BIO_set_init'
> openssl.d:244: error: undefined reference to 'BIO_set_data'
> openssl.d:245: error: undefined reference to 'BIO_set_shutdown'
> openssl.d:1382: error: undefined reference to 'BIO_get_new_index'
> openssl.d:1382: error: undefined reference to 'BIO_meth_new'
> openssl.d:1384: error: undefined reference to 'BIO_meth_set_write'
> openssl.d:1385: error: undefined reference to 'BIO_meth_set_read'
> openssl.d:1386: error: undefined reference to 'BIO_meth_set_ctrl'
> openssl.d:1387: error: undefined reference to 'BIO_meth_set_create'
> openssl.d:1388: error: undefined reference to 'BIO_meth_set_destroy'
> openssl.d:899: error: undefined reference to 'BN_get_rfc3526_prime_2048'
> openssl.d:1288: error: undefined reference to 'BIO_set_init'
> openssl.d:1290: error: undefined reference to 'BIO_set_data'
> openssl.d:1298: error: undefined reference to 'BIO_get_shutdown'
> openssl.d:1300: error: undefined reference to 'BIO_set_init'
> openssl.d:1302: error: undefined reference to 'BIO_set_data'
> openssl.d:1309: error: undefined reference to 'BIO_get_data'
> openssl.d:1323: error: undefined reference to 'BIO_get_data'
> openssl.d:1339: error: undefined reference to 'BIO_get_shutdown'
> openssl.d:1342: error: undefined reference to 'BIO_set_shutdown'
> openssl.d:1335: error: undefined reference to 'BIO_get_data'
> collect2: error: ld returned 1 exit status
> Error: /usr/bin/cc failed with status: 1
> /Project/dlang/ldc-1.24.0/bin/ldc2 failed with exit code 1.
>
> From,
> Vino.B

Which Linux distribution ? Which version of Vibe.d ?
A recent enough Vibe.d should detect OpenSSL based on 1) pkg-config 2) the openssl binary. Make sure you have the development version of OpenSSL installed.
Additionally, v1.0.2 is quite old (and subject to security issues), so you might want consider upgrading. But even with that version, it should work.
You can force the usage of a certain configuration using:

```
    "dependencies": {
        "vibe-d": "~>0.9",
        "vibe-d:tls": "*"
    },
    "subConfigurations": {
        "vibe-d:tls": "openssl-1.0"
    },
```

See: https://github.com/vibe-d/vibe.d/blob/70b50fdb9cd4144f1a5007b36e6ac39d4731c140/tls/dub.sdl#L99-L103
November 06, 2020
On Friday, 6 November 2020 at 10:30:03 UTC, Mathias LANG wrote:
> On Friday, 6 November 2020 at 05:52:56 UTC, Vino wrote:
>> [...]
>
> Which Linux distribution ? Which version of Vibe.d ?
> A recent enough Vibe.d should detect OpenSSL based on 1) pkg-config 2) the openssl binary. Make sure you have the development version of OpenSSL installed.
> Additionally, v1.0.2 is quite old (and subject to security issues), so you might want consider upgrading. But even with that version, it should work.
> You can force the usage of a certain configuration using:
>
> ```
>     "dependencies": {
>         "vibe-d": "~>0.9",
>         "vibe-d:tls": "*"
>     },
>     "subConfigurations": {
>         "vibe-d:tls": "openssl-1.0"
>     },
> ```
>
> See: https://github.com/vibe-d/vibe.d/blob/70b50fdb9cd4144f1a5007b36e6ac39d4731c140/tls/dub.sdl#L99-L103

Hi Mathias,

  Thank you very much, it resolved the issue.

From,
Vino.B