Skip to content

Build fails on DragonflyBSD; struct random_data not defined #355

@falsifian

Description

@falsifian

Just tried to use HMatrix on current DragonflyBSD. Here's what I see. (My file nc.cabal lists hmatrix as a dependency.)

This seems similar to #125. I guess struct random_data is a Linux-only thing.

falsifian angel-dfly 425 $ cabal run -j3 nc
Build profile: -w ghc-8.10.4 -O1
In order, the following will be built (use -v for more details):
 - hmatrix-0.20.2 (lib) (requires build)
 - narrow-cat-0.0.0.0 (exe:nc) (configuration changed)
Starting     hmatrix-0.20.2 (lib)
Building     hmatrix-0.20.2 (lib)

Failed to build hmatrix-0.20.2.
Build log (
/home/falsifian/.cabal/logs/ghc-8.10.4/hmatrix-0.20.2-13494f88f3af7b29e049cca0a66b4fef8a08d7a860eda39d9872ccbe1a75c79b.log
):
Configuring library for hmatrix-0.20.2..
Preprocessing library for hmatrix-0.20.2..
Building library for hmatrix-0.20.2..
[ 1 of 27] Compiling Internal.Vector  ( src/Internal/Vector.hs, dist/build/Internal/Vector.o, dist/build/Internal/Vector.dyn_o )
[ 2 of 27] Compiling Internal.Devel   ( src/Internal/Devel.hs, dist/build/Internal/Devel.o, dist/build/Internal/Devel.dyn_o )
[ 3 of 27] Compiling Internal.Vectorized ( src/Internal/Vectorized.hs, dist/build/Internal/Vectorized.o, dist/build/Internal/Vectorized.dyn_o )
[ 4 of 27] Compiling Internal.Matrix  ( src/Internal/Matrix.hs, dist/build/Internal/Matrix.o, dist/build/Internal/Matrix.dyn_o )
[ 5 of 27] Compiling Internal.ST      ( src/Internal/ST.hs, dist/build/Internal/ST.o, dist/build/Internal/ST.dyn_o )
[ 6 of 27] Compiling Internal.IO      ( src/Internal/IO.hs, dist/build/Internal/IO.o, dist/build/Internal/IO.dyn_o )
[ 7 of 27] Compiling Internal.Element ( src/Internal/Element.hs, dist/build/Internal/Element.o, dist/build/Internal/Element.dyn_o )
[ 8 of 27] Compiling Internal.Conversion ( src/Internal/Conversion.hs, dist/build/Internal/Conversion.o, dist/build/Internal/Conversion.dyn_o )
[ 9 of 27] Compiling Internal.LAPACK  ( src/Internal/LAPACK.hs, dist/build/Internal/LAPACK.o, dist/build/Internal/LAPACK.dyn_o )
[10 of 27] Compiling Internal.Numeric ( src/Internal/Numeric.hs, dist/build/Internal/Numeric.o, dist/build/Internal/Numeric.dyn_o )
[11 of 27] Compiling Internal.Sparse  ( src/Internal/Sparse.hs, dist/build/Internal/Sparse.o, dist/build/Internal/Sparse.dyn_o )
[12 of 27] Compiling Internal.Chain   ( src/Internal/Chain.hs, dist/build/Internal/Chain.o, dist/build/Internal/Chain.dyn_o )
[13 of 27] Compiling Internal.Algorithms ( src/Internal/Algorithms.hs, dist/build/Internal/Algorithms.o, dist/build/Internal/Algorithms.dyn_o )
[14 of 27] Compiling Internal.Random  ( src/Internal/Random.hs, dist/build/Internal/Random.o, dist/build/Internal/Random.dyn_o )
[15 of 27] Compiling Internal.Container ( src/Internal/Container.hs, dist/build/Internal/Container.o, dist/build/Internal/Container.dyn_o )
[16 of 27] Compiling Internal.Convolution ( src/Internal/Convolution.hs, dist/build/Internal/Convolution.o, dist/build/Internal/Convolution.dyn_o )
[17 of 27] Compiling Numeric.LinearAlgebra.Devel ( src/Numeric/LinearAlgebra/Devel.hs, dist/build/Numeric/LinearAlgebra/Devel.o, dist/build/Numeric/LinearAlgebra/Devel.dyn_o )
[18 of 27] Compiling Numeric.Matrix   ( src/Numeric/Matrix.hs, dist/build/Numeric/Matrix.o, dist/build/Numeric/Matrix.dyn_o )
[19 of 27] Compiling Numeric.Vector   ( src/Numeric/Vector.hs, dist/build/Numeric/Vector.o, dist/build/Numeric/Vector.dyn_o )
[20 of 27] Compiling Internal.Util    ( src/Internal/Util.hs, dist/build/Internal/Util.o, dist/build/Internal/Util.dyn_o )
[21 of 27] Compiling Internal.Modular ( src/Internal/Modular.hs, dist/build/Internal/Modular.o, dist/build/Internal/Modular.dyn_o )
[22 of 27] Compiling Numeric.LinearAlgebra.Data ( src/Numeric/LinearAlgebra/Data.hs, dist/build/Numeric/LinearAlgebra/Data.o, dist/build/Numeric/LinearAlgebra/Data.dyn_o )
[23 of 27] Compiling Internal.CG      ( src/Internal/CG.hs, dist/build/Internal/CG.o, dist/build/Internal/CG.dyn_o )
[24 of 27] Compiling Numeric.LinearAlgebra ( src/Numeric/LinearAlgebra.hs, dist/build/Numeric/LinearAlgebra.o, dist/build/Numeric/LinearAlgebra.dyn_o )
[25 of 27] Compiling Numeric.LinearAlgebra.HMatrix ( src/Numeric/LinearAlgebra/HMatrix.hs, dist/build/Numeric/LinearAlgebra/HMatrix.o, dist/build/Numeric/LinearAlgebra/HMatrix.dyn_o )
[26 of 27] Compiling Internal.Static  ( src/Internal/Static.hs, dist/build/Internal/Static.o, dist/build/Internal/Static.dyn_o )
[27 of 27] Compiling Numeric.LinearAlgebra.Static ( src/Numeric/LinearAlgebra/Static.hs, dist/build/Numeric/LinearAlgebra/Static.o, dist/build/Numeric/LinearAlgebra/Static.dyn_o )

src/Internal/C/vector-aux.c:1077:30: error:
     warning: 'struct random_data' declared inside parameter list will not be visible outside of this definition or declaration
     inline double urandom(struct random_data * buffer) {
                                  ^~~~~~~~~~~
     |
1077 | inline double urandom(struct random_data * buffer) {
     |                              ^
src/Internal/C/vector-aux.c: In function 'urandom':

src/Internal/C/vector-aux.c:1079:5: error:
     warning: implicit declaration of function 'random_r'; did you mean 'random'? [-Wimplicit-function-declaration]
         random_r(buffer,&res);
         ^~~~~~~~
         random
     |
1079 |     random_r(buffer,&res);
     |     ^
src/Internal/C/vector-aux.c: At top level:

src/Internal/C/vector-aux.c:1085:25: error:
     warning: 'struct random_data' declared inside parameter list will not be visible outside of this definition or declaration
     double gaussrand(struct random_data *buffer,
                             ^~~~~~~~~~~
     |
1085 | double gaussrand(struct random_data *buffer,
     |                         ^
src/Internal/C/vector-aux.c: In function 'gaussrand':

src/Internal/C/vector-aux.c:1093:33: error:
     warning: passing argument 1 of 'urandom' from incompatible pointer type [-Wincompatible-pointer-types]
                 double U1 = urandom(buffer);
                                     ^~~~~~
     |
1093 |             double U1 = urandom(buffer);
     |                                 ^

src/Internal/C/vector-aux.c:1077:44: error:
     note: expected 'struct random_data *' but argument is of type 'struct random_data *'
     inline double urandom(struct random_data * buffer) {
                           ~~~~~~~~~~~~~~~~~~~~~^~~~~~
     |
1077 | inline double urandom(struct random_data * buffer) {
     |                                            ^

src/Internal/C/vector-aux.c:1094:24: error:
     warning: passing argument 1 of 'urandom' from incompatible pointer type [-Wincompatible-pointer-types]
        double U2 = urandom(buffer);
                            ^~~~~~
     |
1094 |                         double U2 = urandom(buffer);
     |                        ^

src/Internal/C/vector-aux.c:1077:44: error:
     note: expected 'struct random_data *' but argument is of type 'struct random_data *'
     inline double urandom(struct random_data * buffer) {
                           ~~~~~~~~~~~~~~~~~~~~~^~~~~~
     |
1077 | inline double urandom(struct random_data * buffer) {
     |                                            ^
src/Internal/C/vector-aux.c: In function 'random_vector':

src/Internal/C/vector-aux.c:1113:24: error:
     error: storage size of 'buffer' isn't known
         struct random_data buffer;
                            ^~~~~~
     |
1113 |     struct random_data buffer;
     |                        ^

src/Internal/C/vector-aux.c:1115:31: error:
     error: invalid application of 'sizeof' to incomplete type 'struct random_data'
         memset(&buffer, 0, sizeof(struct random_data));
                                   ^~~~~~
     |
1115 |     memset(&buffer, 0, sizeof(struct random_data));
     |                               ^

src/Internal/C/vector-aux.c:1118:5: error:
     warning: implicit declaration of function 'initstate_r'; did you mean 'initstate'? [-Wimplicit-function-declaration]
         initstate_r(seed,random_state,sizeof(random_state),&buffer);
         ^~~~~~~~~~~
         initstate
     |
1118 |     initstate_r(seed,random_state,sizeof(random_state),&buffer);
     |     ^

src/Internal/C/vector-aux.c:1113:24: error:
     warning: unused variable 'buffer' [-Wunused-variable]
         struct random_data buffer;
                            ^~~~~~
     |
1113 |     struct random_data buffer;
     |                        ^
`cc' failed in phase `C Compiler'. (Exit code: 1)
cabal: Failed to build hmatrix-0.20.2 (which is required by exe:nc from
narrow-cat-0.0.0.0). See the build log above for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions