So I'm trying to run the open-source code from this research paper, but I keep getting [make] Error 2. The makefile for the code was thankfully provided so I all I did was run the make command when I was in the folder that contained the makefile.
I'm new to all of this, I got everything from the internet, so I apologize if I'm a bit ignorant. I'm trying to learn, please be patient (:
QuantumHoneybees-MacBook-Pro:femflip2 Joe$ make
makeCompiling src/adaptive2.cpp ...
In file included from src/adaptive2.cpp:13:
./src/kernel.h:16:20: warning: unused function 'smooth_kernel' [-Wunused-function]
static FLOAT64 smooth_kernel( FLOAT64 r2, FLOAT64 h ) {
^
In file included from src/adaptive2.cpp:15:
./src/util2.h:29:13: warning: unused function 'dump' [-Wunused-function]
static void dump( const char *format, ...) {
^
./src/util2.h:45:13: warning: unused function 'run' [-Wunused-function]
static void run( const char *format, ...) {
^
./src/util2.h:54:20: warning: unused function 'format_str' [-Wunused-function]
static const char *format_str( const char *format, ...) {
^
./src/util2.h:65:13: warning: unused function 'is_nan' [-Wunused-function]
static bool is_nan(const double v) {
^
./src/util2.h:86:17: warning: unused function 'square' [-Wunused-function]
static FLOAT64 square(FLOAT64 a) {
^
./src/util2.h:120:17: warning: unused function 'getSeconds' [-Wunused-function]
static FLOAT64 getSeconds() {
^
./src/util2.h:142:15: warning: unused function 'stretchPosition' [-Wunused-function]
static vec2d stretchPosition( const svd2 &svd, vec2d p, FLOAT64 min, FLOAT64 max, bool inverse=true ) {
^
./src/util2.h:162:28: warning: unused function 'marchPoints' [-Wunused-function]
static std::vector<vec2d> marchPoints( const std::vector<vec2d> &nodes, const std::vector<FLOAT64> &levelsets, bool fill=true ) {
^
./src/util2.h:180:17: warning: unused function 'computeVolume' [-Wunused-function]
static FLOAT64 computeVolume( const std::vector<vec2d> points ) {
^
./src/util2.h:192:17: warning: unused function 'distance' [-Wunused-function]
static FLOAT64 distance( const vec2d &p0, const vec2d &p1, vec2d &p ) {
^
./src/util2.h:222:17: warning: unused function 'detDelaunay' [-Wunused-function]
static FLOAT64 detDelaunay( vec2d p0, vec2d p1, vec2d p2, vec2d p3 ) {
^
src/adaptive2.cpp:53:13: warning: unused function 'sampleVelocity' [-Wunused-function]
static bool sampleVelocity( sorter2& sorter, vec2d pos, FLOAT64 dpx, const std::vector<particle2 *> &neighbors, vec2d &vel ) {
^
13 warnings generated.
Compiling src/ann/ANN.cpp ...
Compiling src/ann/bd_fix_rad_search.cpp ...
Compiling src/ann/bd_pr_search.cpp ...
Compiling src/ann/bd_search.cpp ...
Compiling src/ann/bd_tree.cpp ...
Compiling src/ann/brute.cpp ...
Compiling src/ann/kd_dump.cpp ...
src/ann/kd_dump.cpp:44:14: warning: unused variable 'EPSILON' [-Wunused-const-variable]
const double EPSILON = 1E-5; // small number for float comparison
^
1 warning generated.
Compiling src/ann/kd_fix_rad_search.cpp ...
Compiling src/ann/kd_pr_search.cpp ...
Compiling src/ann/kd_search.cpp ...
Compiling src/ann/kd_split.cpp ...
Compiling src/ann/kd_tree.cpp ...
Compiling src/ann/kd_util.cpp ...
Compiling src/ann/perf.cpp ...
Compiling src/annsorter2.cpp ...
In file included from src/annsorter2.cpp:9:
In file included from ./src/annsorter2.h:10:
In file included from ./src/ann2.h:11:
./src/util2.h:29:13: warning: unused function 'dump' [-Wunused-function]
static void dump( const char *format, ...) {
^
./src/util2.h:45:13: warning: unused function 'run' [-Wunused-function]
static void run( const char *format, ...) {
^
./src/util2.h:54:20: warning: unused function 'format_str' [-Wunused-function]
static const char *format_str( const char *format, ...) {
^
./src/util2.h:65:13: warning: unused function 'is_nan' [-Wunused-function]
static bool is_nan(const double v) {
^
./src/util2.h:86:17: warning: unused function 'square' [-Wunused-function]
static FLOAT64 square(FLOAT64 a) {
^
./src/util2.h:120:17: warning: unused function 'getSeconds' [-Wunused-function]
static FLOAT64 getSeconds() {
^
./src/util2.h:142:15: warning: unused function 'stretchPosition' [-Wunused-function]
static vec2d stretchPosition( const svd2 &svd, vec2d p, FLOAT64 min, FLOAT64 max, bool inverse=true ) {
^
./src/util2.h:162:28: warning: unused function 'marchPoints' [-Wunused-function]
static std::vector<vec2d> marchPoints( const std::vector<vec2d> &nodes, const std::vector<FLOAT64> &levelsets, bool fill=true ) {
^
./src/util2.h:180:17: warning: unused function 'computeVolume' [-Wunused-function]
static FLOAT64 computeVolume( const std::vector<vec2d> points ) {
^
./src/util2.h:192:17: warning: unused function 'distance' [-Wunused-function]
static FLOAT64 distance( const vec2d &p0, const vec2d &p1, vec2d &p ) {
^
./src/util2.h:222:17: warning: unused function 'detDelaunay' [-Wunused-function]
static FLOAT64 detDelaunay( vec2d p0, vec2d p1, vec2d p2, vec2d p3 ) {
^
11 warnings generated.
make: *** [all] Error 2
QuantumHoneybees-MacBook-Pro:femflip2 Joe$ make
Edit:: I've narrowed it down to the makefile in lines 36-44 there is something wrong with what is written. I unfortunately have zero experience with writing makefiles, so I don't know how to fix it. I tried messing around with some lines' indentation because some other threads seem to have that issue, but to no avail.
There's a missing include in fluid2.h, NULL isn't defined.
Either invoke
make OPT="-Wall -Os -include cstddef"
Or add
#include <cstddef>
to the includes in fluid2.h.
It's quicker to just rewrite the terrible included makefile, try this:
CC := g++
CPPFLAGS := -Isrc -Isrc/ann -Isrc/pcgsolver -MMD -MP
CXXFLAGS := -Wall -Os
LDFLAGS := -framework OpenGL -framework GLUT
sources := $(wildcard src/*.cpp src/ann/*.cpp)
objects := $(sources:.cpp=.o)
deps := $(objects:.o=.d)
flip2d: $(objects)
$(LINK.o) $^ $(LDLIBS) -o $#
.PHONY: clean
clean: ; $(RM) $(objects) $(deps) flip2d
-include $(deps)
Related
I have bcrypto as a dependency of 3box which is already a dependency (dependency of dependency), and it seems since bcrypto hasn't been updated for M1 chips there is no way to install it. I've been told to install from the source, but no idea how to do it on Mac. Any suggestion is welcome.
The repo that I'm trying to install is https://github.com/1Hive/honey-pot
Here's a copy of the logs:
[4/4] 🔨 Building fresh packages...
[12/25] â bcrypto
[-/25] â waiting...
[-/25] â waiting...
[-/25] â waiting...
error /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp#7.1.2
gyp info using node#14.16.1 | darwin | x64
gyp info find Python using Python version 3.9.4 found at "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"
gyp info spawn /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1',
gyp info spawn args '-Dnode_gyp_dir=/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/gastonneedleman/Library/Caches/node-gyp/14.16.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/bcrypto/src/torsion/src/aead.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/chacha20.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/drbg.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/dsa.o
In file included from ../src/torsion/src/dsa.c:34:
In file included from ../src/torsion/src/asn1.h:13:
In file included from ../src/torsion/src/mpz.h:20:
../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
mpn_tdiv_qr(mp_limb_t *qp,
^
../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
mpn_gcdext(mp_limb_t *gp,
^
In file included from ../src/torsion/src/dsa.c:34:
In file included from ../src/torsion/src/asn1.h:13:
../src/torsion/src/mpz.h:456:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
^
../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
#define mpz_random_prime torsion_mpz_random_prime
^
In file included from ../src/torsion/src/dsa.c:34:
../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
asn1_read_int(unsigned char *out, size_t out_len,
^
../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
asn1_size_int(const unsigned char *num, size_t len) {
^
../src/torsion/src/asn1.h:331:1: warning: unused function 'asn1_write_int' [-Wunused-function]
asn1_write_int(unsigned char *data, size_t pos,
^
6 warnings generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/ecc.o
In file included from ../src/torsion/src/ecc.c:158:
In file included from ../src/torsion/src/asn1.h:13:
In file included from ../src/torsion/src/mpz.h:20:
../src/torsion/src/gmp-compat.h:103:1: warning: unused function 'mpz_powm_sec' [-Wunused-function]
mpz_powm_sec(mpz_t rop, const mpz_t base, const mpz_t exp, const mpz_t mod) {
^
In file included from ../src/torsion/src/ecc.c:158:
In file included from ../src/torsion/src/asn1.h:13:
../src/torsion/src/mpz.h:42:1: warning: unused function 'torsion_mpz_roset' [-Wunused-function]
mpz_roset(mpz_t r, const mpz_t x) {
^
../src/torsion/src/mpz.h:25:19: note: expanded from macro 'mpz_roset'
#define mpz_roset torsion_mpz_roset
^
../src/torsion/src/mpz.h:83:1: warning: unused function 'torsion_mpz_export_pad' [-Wunused-function]
mpz_export_pad(unsigned char *out, const mpz_t n, size_t size, int endian) {
^
../src/torsion/src/mpz.h:28:24: note: expanded from macro 'mpz_export_pad'
#define mpz_export_pad torsion_mpz_export_pad
^
../src/torsion/src/mpz.h:456:1: warning: unused function 'torsion_mpz_random_prime' [-Wunused-function]
mpz_random_prime(mpz_t ret, size_t bits, drbg_t *rng) {
^
../src/torsion/src/mpz.h:35:26: note: expanded from macro 'mpz_random_prime'
#define mpz_random_prime torsion_mpz_random_prime
^
In file included from ../src/torsion/src/ecc.c:158:
../src/torsion/src/asn1.h:204:1: warning: unused function 'asn1_read_version' [-Wunused-function]
asn1_read_version(const unsigned char **data, size_t *len,
^
../src/torsion/src/asn1.h:235:1: warning: unused function 'asn1_read_dumb' [-Wunused-function]
asn1_read_dumb(mpz_t n, const unsigned char **data, size_t *len) {
^
../src/torsion/src/asn1.h:286:1: warning: unused function 'asn1_size_mpz' [-Wunused-function]
asn1_size_mpz(const mpz_t n) {
^
../src/torsion/src/asn1.h:301:1: warning: unused function 'asn1_size_version' [-Wunused-function]
asn1_size_version(unsigned char version) {
^
../src/torsion/src/asn1.h:365:1: warning: unused function 'asn1_write_mpz' [-Wunused-function]
asn1_write_mpz(unsigned char *data, size_t pos, const mpz_t n) {
^
../src/torsion/src/asn1.h:395:1: warning: unused function 'asn1_write_version' [-Wunused-function]
asn1_write_version(unsigned char *data, size_t pos, unsigned char version) {
^
../src/torsion/src/asn1.h:403:1: warning: unused function 'asn1_write_dumb' [-Wunused-function]
asn1_write_dumb(unsigned char *data, size_t pos, const mpz_t n) {
^
../src/torsion/src/ecc.c:526:1: warning: unused function 'bytes_equal' [-Wunused-function]
bytes_equal(const unsigned char *a,
^
../src/torsion/src/ecc.c:562:1: warning: unused function 'bytes_lte' [-Wunused-function]
bytes_lte(const unsigned char *a,
^
../src/torsion/src/ecc.c:688:1: warning: unused function 'sc_swap' [-Wunused-function]
sc_swap(scalar_field_t *sc, sc_t a, sc_t b, unsigned int flag) {
^
../src/torsion/src/ecc.c:808:1: warning: unused function 'sc_sub' [-Wunused-function]
sc_sub(scalar_field_t *sc, sc_t r, const sc_t a, const sc_t b) {
^
../src/torsion/src/ecc.c:1760:1: warning: unused function 'fe_random' [-Wunused-function]
fe_random(prime_field_t *fe, fe_t x, drbg_t *rng) {
^
../src/torsion/src/ecc.c:2090:1: warning: unused function 'wge_swap' [-Wunused-function]
wge_swap(wei_t *ec, wge_t *a, wge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:2130:1: warning: unused function 'wge_equal' [-Wunused-function]
wge_equal(wei_t *ec, const wge_t *a, const wge_t *b) {
^
../src/torsion/src/ecc.c:2158:1: warning: unused function 'wge_is_square_var' [-Wunused-function]
wge_is_square_var(wei_t *ec, const wge_t *p) {
^
../src/torsion/src/ecc.c:2166:1: warning: unused function 'wge_equal_x' [-Wunused-function]
wge_equal_x(wei_t *ec, const wge_t *p, const fe_t x) {
^
../src/torsion/src/ecc.c:2325:1: warning: unused function 'wge_dbl' [-Wunused-function]
wge_dbl(wei_t *ec, wge_t *r, const wge_t *p) {
^
../src/torsion/src/ecc.c:2469:1: warning: unused function 'jge_swap' [-Wunused-function]
jge_swap(wei_t *ec, jge_t *a, jge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:2507:1: warning: unused function 'jge_equal' [-Wunused-function]
jge_equal(wei_t *ec, const jge_t *a, const jge_t *b) {
^
../src/torsion/src/ecc.c:2538:1: warning: unused function 'jge_is_square' [-Wunused-function]
jge_is_square(wei_t *ec, const jge_t *p) {
^
../src/torsion/src/ecc.c:2629:1: warning: unused function 'jge_neg_cond' [-Wunused-function]
jge_neg_cond(wei_t *ec, jge_t *r, const jge_t *a, unsigned int flag) {
^
../src/torsion/src/ecc.c:3163:1: warning: unused function 'jge_sub' [-Wunused-function]
jge_sub(wei_t *ec, jge_t *r, const jge_t *a, const jge_t *b) {
^
../src/torsion/src/ecc.c:3311:1: warning: unused function 'jge_mixed_sub' [-Wunused-function]
jge_mixed_sub(wei_t *ec, jge_t *r, const jge_t *a, const wge_t *b) {
^
../src/torsion/src/ecc.c:3387:1: warning: unused function 'jge_validate' [-Wunused-function]
jge_validate(wei_t *ec, const jge_t *p) {
^
../src/torsion/src/ecc.c:4211:1: warning: unused function 'wei_mul_multi_var' [-Wunused-function]
wei_mul_multi_var(wei_t *ec,
^
../src/torsion/src/ecc.c:4729:1: warning: unused function 'mge_zero' [-Wunused-function]
mge_zero(mont_t *ec, mge_t *r) {
^
../src/torsion/src/ecc.c:4747:1: warning: unused function 'mge_validate' [-Wunused-function]
mge_validate(mont_t *ec, const mge_t *p) {
^
../src/torsion/src/ecc.c:4827:1: warning: unused function 'mge_swap' [-Wunused-function]
mge_swap(mont_t *ec, mge_t *a, mge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:4841:1: warning: unused function 'mge_set' [-Wunused-function]
mge_set(mont_t *ec, mge_t *r, const mge_t *a) {
^
../src/torsion/src/ecc.c:4850:1: warning: unused function 'mge_equal' [-Wunused-function]
mge_equal(mont_t *ec, const mge_t *a, const mge_t *b) {
^
../src/torsion/src/ecc.c:4868:1: warning: unused function 'mge_is_zero' [-Wunused-function]
mge_is_zero(mont_t *ec, const mge_t *a) {
^
../src/torsion/src/ecc.c:4882:1: warning: unused function 'mge_dbl' [-Wunused-function]
mge_dbl(mont_t *ec, mge_t *r, const mge_t *p) {
^
../src/torsion/src/ecc.c:5149:1: warning: unused function 'pge_equal' [-Wunused-function]
pge_equal(mont_t *ec, const pge_t *a, const pge_t *b) {
^
../src/torsion/src/ecc.c:5874:1: warning: unused function 'xge_swap' [-Wunused-function]
xge_swap(edwards_t *ec, xge_t *a, xge_t *b, unsigned int flag) {
^
../src/torsion/src/ecc.c:5947:1: warning: unused function 'xge_neg_cond' [-Wunused-function]
xge_neg_cond(edwards_t *ec, xge_t *r, const xge_t *a, unsigned int flag) {
^
../src/torsion/src/ecc.c:6135:1: warning: unused function 'xge_normalize' [-Wunused-function]
xge_normalize(edwards_t *ec, xge_t *r, const xge_t *p) {
^
../src/torsion/src/ecc.c:6159:1: warning: unused function 'xge_normalize_var' [-Wunused-function]
xge_normalize_var(edwards_t *ec, xge_t *r, const xge_t *p) {
^
41 warnings generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/hash.o
../src/torsion/src/hash.c:68:1: warning: unused function 'read64be' [-Wunused-function]
read64be(const void *src) {
^
1 warning generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/kdf.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/poly1305.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/rsa.o
In file included from ../src/torsion/src/rsa.c:29:
In file included from ../src/torsion/src/asn1.h:13:
In file included from ../src/torsion/src/mpz.h:20:
../src/torsion/src/gmp-compat.h:124:1: warning: unused function 'mpn_tdiv_qr' [-Wunused-function]
mpn_tdiv_qr(mp_limb_t *qp,
^
../src/torsion/src/gmp-compat.h:154:1: warning: unused function 'mpn_gcdext' [-Wunused-function]
mpn_gcdext(mp_limb_t *gp,
^
In file included from ../src/torsion/src/rsa.c:29:
../src/torsion/src/asn1.h:94:1: warning: unused function 'asn1_read_int' [-Wunused-function]
asn1_read_int(unsigned char *out, size_t out_len,
^
../src/torsion/src/asn1.h:270:1: warning: unused function 'asn1_size_int' [-Wunused-function]
asn1_size_int(const unsigned char *num, size_t len) {
^
../src/torsion/src/asn1.h:331:1: warning: unused function 'asn1_write_int' [-Wunused-function]
asn1_write_int(unsigned char *data, size_t pos,
^
../src/torsion/src/rsa.c:1024:1: warning: unused function 'rsa_pub_set' [-Wunused-function]
rsa_pub_set(rsa_pub_t *r, const rsa_pub_t *k) {
^
6 warnings generated.
CC(target) Release/obj.target/bcrypto/src/torsion/src/salsa20.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/siphash.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/util.o
CC(target) Release/obj.target/bcrypto/src/base58/base58.o
CC(target) Release/obj.target/bcrypto/src/bech32/bech32.o
CC(target) Release/obj.target/bcrypto/src/cash32/cash32.o
CC(target) Release/obj.target/bcrypto/src/murmur3/murmur3.o
CXX(target) Release/obj.target/bcrypto/src/aead.o
CXX(target) Release/obj.target/bcrypto/src/base58.o
CXX(target) Release/obj.target/bcrypto/src/bech32.o
CXX(target) Release/obj.target/bcrypto/src/bcrypto.o
CXX(target) Release/obj.target/bcrypto/src/blake2b.o
CXX(target) Release/obj.target/bcrypto/src/blake2s.o
CXX(target) Release/obj.target/bcrypto/src/cash32.o
CXX(target) Release/obj.target/bcrypto/src/chacha20.o
CXX(target) Release/obj.target/bcrypto/src/dsa.o
CXX(target) Release/obj.target/bcrypto/src/dsa_async.o
CXX(target) Release/obj.target/bcrypto/src/ecdh.o
CXX(target) Release/obj.target/bcrypto/src/ecdsa.o
CXX(target) Release/obj.target/bcrypto/src/eddsa.o
CXX(target) Release/obj.target/bcrypto/src/hash.o
CXX(target) Release/obj.target/bcrypto/src/hmac.o
CXX(target) Release/obj.target/bcrypto/src/keccak.o
CXX(target) Release/obj.target/bcrypto/src/murmur3.o
CXX(target) Release/obj.target/bcrypto/src/pbkdf2.o
CXX(target) Release/obj.target/bcrypto/src/pbkdf2_async.o
CXX(target) Release/obj.target/bcrypto/src/poly1305.o
CXX(target) Release/obj.target/bcrypto/src/rsa.o
CXX(target) Release/obj.target/bcrypto/src/rsa_async.o
CXX(target) Release/obj.target/bcrypto/src/salsa20.o
CXX(target) Release/obj.target/bcrypto/src/scrypt.o
CXX(target) Release/obj.target/bcrypto/src/scrypt_async.o
CXX(target) Release/obj.target/bcrypto/src/siphash.o
CXX(target) Release/obj.target/bcrypto/src/util.o
CC(target) Release/obj.target/bcrypto/src/torsion/src/mini-gmp.o
CC(target) Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o
In file included from ../src/secp256k1/src/secp256k1.c:12:
In file included from ../src/secp256k1/src/scalar_impl.h:20:
../src/secp256k1/src/scalar_4x64_impl.h:969:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
memcpy((void *) seed32, (const void *) seed, 32);
^
../src/secp256k1/src/scalar_4x64_impl.h:969:5: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
1 error generated.
make: *** [Release/obj.target/bcrypto/src/secp256k1/src/secp256k1.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/Users/gastonneedleman/.nvm/versions/node/v14.16.1/bin/node" "/Users/gastonneedleman/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/gastonneedleman/Coding/honey-pot/node_modules/libp2p-noise/node_modules/bcrypto
I am trying to build calc++ after looking into tutorial given here https://www.genivia.com/examples/calc++/index.html but end up with error as shown below.
Here are the steps i followed
wsdl2h -o calc.h http://www.genivia.com/calc.wsdl [This created the
header file and i am not sure what to do file "typemap.dat" file so
i proceed with second step]
soapcpp2 -j -r -CL calc.h [This generates the required files and i downloaded the calcclient.cpp , copied the stdsoap2.h and stdsoap2.cpp in the same folder]
g++ -o calcclient calcclient.cpp stdsoap2.cpp soapC.cpp soapcalcProxy.cpp [This step ends with the error shown below]
Can anybody help me regarding this, i am totally new to gsoap and trying to build something with it so i decided to start with gsoap example but getting this big error. I am doing this in Ubuntu and following the exact steps which is given in the tutorial.Please check error below
calcclient.cpp: In function ‘int main(int, char**)’:
calcclient.cpp:58:29: error: no matching function for call to ‘calcProxy::add(double&, double&, double*)’
calc.add(a, b, &result);
^
In file included from calcclient.cpp:41:0:
soapcalcProxy.h:74:21: note: candidate: virtual int calcProxy::add(double, double, double&)
virtual int add(double a, double b, double &result)
^
soapcalcProxy.h:74:21: note: no known conversion for argument 3 from ‘double*’ to ‘double&’
soapcalcProxy.h:76:21: note: candidate: virtual int calcProxy::add(const char*, const char*, double, double, double&)
virtual int add(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
^
soapcalcProxy.h:76:21: note: candidate expects 5 arguments, 3 provided
calcclient.cpp:61:29: error: no matching function for call to ‘calcProxy::sub(double&, double&, double*)’
calc.sub(a, b, &result);
^
In file included from calcclient.cpp:41:0:
soapcalcProxy.h:78:21: note: candidate: virtual int calcProxy::sub(double, double, double&)
virtual int sub(double a, double b, double &result)
^
soapcalcProxy.h:78:21: note: no known conversion for argument 3 from ‘double*’ to ‘double&’
soapcalcProxy.h:80:21: note: candidate: virtual int calcProxy::sub(const char*, const char*, double, double, double&)
virtual int sub(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
^
soapcalcProxy.h:80:21: note: candidate expects 5 arguments, 3 provided
calcclient.cpp:64:29: error: no matching function for call to ‘calcProxy::mul(double&, double&, double*)’
calc.mul(a, b, &result);
^
In file included from calcclient.cpp:41:0:
soapcalcProxy.h:82:21: note: candidate: virtual int calcProxy::mul(double, double, double&)
virtual int mul(double a, double b, double &result)
^
soapcalcProxy.h:82:21: note: no known conversion for argument 3 from ‘double*’ to ‘double&’
soapcalcProxy.h:84:21: note: candidate: virtual int calcProxy::mul(const char*, const char*, double, double, double&)
virtual int mul(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
^
soapcalcProxy.h:84:21: note: candidate expects 5 arguments, 3 provided
calcclient.cpp:67:29: error: no matching function for call to ‘calcProxy::div(double&, double&, double*)’
calc.div(a, b, &result);
^
In file included from calcclient.cpp:41:0:
soapcalcProxy.h:86:21: note: candidate: virtual int calcProxy::div(double, double, double&)
virtual int div(double a, double b, double &result)
^
soapcalcProxy.h:86:21: note: no known conversion for argument 3 from ‘double*’ to ‘double&’
soapcalcProxy.h:88:21: note: candidate: virtual int calcProxy::div(const char*, const char*, double, double, double&)
virtual int div(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
^
soapcalcProxy.h:88:21: note: candidate expects 5 arguments, 3 provided
calcclient.cpp:70:29: error: no matching function for call to ‘calcProxy::pow(double&, double&, double*)’
calc.pow(a, b, &result);
^
In file included from calcclient.cpp:41:0:
soapcalcProxy.h:90:21: note: candidate: virtual int calcProxy::pow(double, double, double&)
virtual int pow(double a, double b, double &result)
^
soapcalcProxy.h:90:21: note: no known conversion for argument 3 from ‘double*’ to ‘double&’
soapcalcProxy.h:92:21: note: candidate: virtual int calcProxy::pow(const char*, const char*, double, double, double&)
virtual int pow(const char *soap_endpoint, const char *soap_action, double a, double b, double &result);
^
soapcalcProxy.h:92:21: note: candidate expects 5 arguments, 3 provided
Perhaps you are passing one or more arguments as a pointer. The correct proxy call should look like this:
#include "soapcalcProxy.h"
#include "calc.nsmap"
double a, b, result;
calcProxy calc("http://server.com/path");
a = 1.23;
b = 4.56;
int err = calc.add(a, b, result);
I have a union typedef containing an anonymous struct. When trying to initialize it I always get a warning with gcc 4.9.2 (-Wall -Wextra -pedantic) about missing initializers for fields. However it seems to work as expected. Is there something wrong with the way the variable is initialized below?
#include <stdio.h>
typedef union {
unsigned int raw;
struct {
unsigned short hue;
unsigned char saturation;
unsigned char value;
};
} HSV;
int main() {
HSV color = {.hue = 1, .saturation = 2, .value = 4};
printf("hue: %d, saturation: %d, value: %d, raw: %08X\n", color.hue, color.saturation, color.value, color.raw);
}
When compiling gcc gives some warnings.
$ gcc -Wall -Wextra -pedantic -std=gnu11 main.c
main.c: In function 'main':
main.c:13:2: warning: missing initializer for field 'saturation' of 'struct <anonymous>' [-Wmissing-field-initializers]
HSV color = {.hue = 1, .saturation = 2, .value = 4};
^
main.c:7:20: note: 'saturation' declared here
unsigned char saturation;
^
main.c:13:2: warning: missing initializer for field 'value' of 'struct <anonymous>' [-Wmissing-field-initializers]
HSV color = {.hue = 1, .saturation = 2, .value = 4};
^
main.c:8:20: note: 'value' declared here
unsigned char value;
^
$ ./a.out
hue: 1, saturation: 2, value: 4, raw: 04020001
I am trying to build a list of linked list in my application. The list will contains unique IP addresses,and for each IP addres I have a list of applications. I am trying to build it using unordered_map to take Boost::boost::asio::ip::address as a the key and std::list as value:
#include <boost/unordered/unordered_map.hpp>
#include <iostream>
#include <list>
using namespace boost::asio::ip;
using namespace std;
typedef int ApplicationID;
typedef address IPAddress;
typedef list <ApplicationID> APP_LIST;
typedef boost::unordered::unordered_map <IPAddress, APP_LIST> USER_MAP;
USER_MAP user_map;
Later I try to get the list associated with an IP address as following:
APP_LIST *list = &user_map[ip];
But I get errors in the compilation, so could you please specify what's the problem?
Is it possible to use Boost:IPaddress as a key function?
Another question is it possible to use char[some_size] as a key value?
Error Output:
In file included from /boost/functional/hash/hash.hpp:535:0,
from /boost/functional/hash.hpp:6,
from /boost/unordered/unordered_map.hpp:21,
from ipc_module.cpp:18:
/boost/functional/hash/extensions.hpp: In member function ‘std::size_t boost::hash<T>::operator()(const T&) const [with T = boost::asio::ip::address, std::size_t = long unsigned int]’:
/boost/unordered/detail/unique.hpp:331:55: instantiated from ‘boost::unordered::detail::table_impl<Types>::value_type& boost::unordered::detail::table_impl<Types>::operator[](const key_type&) [with Types = boost::unordered::detail::map<std::allocator<std::pair<const boost::asio::ip::address, std::list<int> > >, boost::asio::ip::address, std::list<int>, boost::hash<boost::asio::ip::address>, std::equal_to<boost::asio::ip::address> >, boost::unordered::detail::table_impl<Types>::value_type = std::pair<const boost::asio::ip::address, std::list<int> >, boost::unordered::detail::table_impl<Types>::key_type = boost::asio::ip::address]’
/boost/unordered/unordered_map.hpp:1192:26: instantiated from ‘boost::unordered::unordered_map<K, T, H, P, A>::mapped_type& boost::unordered::unordered_map<K, T, H, P, A>::operator[](const key_type&) [with K = boost::asio::ip::address, T = std::list<int>, H = boost::hash<boost::asio::ip::address>, P = std::equal_to<boost::asio::ip::address>, A = std::allocator<std::pair<const boost::asio::ip::address, std::list<int> > >, boost::unordered::unordered_map<K, T, H, P, A>::mapped_type = std::list<int>, boost::unordered::unordered_map<K, T, H, P, A>::key_type = boost::asio::ip::address]’
ipc_module.cpp:175:40: instantiated from here
/boost/functional/hash/extensions.hpp:176:34: error: no matching function for call to ‘hash_value(const boost::asio::ip::address&)’
/boost/functional/hash/extensions.hpp:176:34: note: candidates are:
/boost/smart_ptr/shared_ptr.hpp:708:33: note: template<class T> std::size_t boost::hash_value(const boost::shared_ptr<T>&)
/boost/functional/hash/hash.hpp:144:24: note: std::size_t boost::hash_value(bool)
/boost/functional/hash/hash.hpp:144:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘bool’
/boost/functional/hash/hash.hpp:149:24: note: std::size_t boost::hash_value(char)
/boost/functional/hash/hash.hpp:149:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘char’
/boost/functional/hash/hash.hpp:154:24: note: std::size_t boost::hash_value(unsigned char)
/boost/functional/hash/hash.hpp:154:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘unsigned char’
/boost/functional/hash/hash.hpp:159:24: note: std::size_t boost::hash_value(signed char)
/boost/functional/hash/hash.hpp:159:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘signed char’
/boost/functional/hash/hash.hpp:164:24: note: std::size_t boost::hash_value(short int)
/boost/functional/hash/hash.hpp:164:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘short int’
/boost/functional/hash/hash.hpp:169:24: note: std::size_t boost::hash_value(short unsigned int)
/boost/functional/hash/hash.hpp:169:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘short unsigned int’
/boost/functional/hash/hash.hpp:174:24: note: std::size_t boost::hash_value(int)
/boost/functional/hash/hash.hpp:174:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘int’
/boost/functional/hash/hash.hpp:179:24: note: std::size_t boost::hash_value(unsigned int)
/boost/functional/hash/hash.hpp:179:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘unsigned int’
/boost/functional/hash/hash.hpp:184:24: note: std::size_t boost::hash_value(long int)
/boost/functional/hash/hash.hpp:184:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘long int’
/boost/functional/hash/hash.hpp:189:24: note: std::size_t boost::hash_value(long unsigned int)
/boost/functional/hash/hash.hpp:189:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘long unsigned int’
/boost/functional/hash/hash.hpp:195:24: note: std::size_t boost::hash_value(wchar_t)
/boost/functional/hash/hash.hpp:195:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘wchar_t’
/boost/functional/hash/hash.hpp:202:24: note: std::size_t boost::hash_value(boost::long_long_type)
/boost/functional/hash/hash.hpp:202:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘boost::long_long_type {aka long long int}’
/boost/functional/hash/hash.hpp:207:24: note: std::size_t boost::hash_value(boost::ulong_long_type)
/boost/functional/hash/hash.hpp:207:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘boost::ulong_long_type {aka long long unsigned int}’
/boost/functional/hash/hash.hpp:215:36: note: template<class T> std::size_t boost::hash_value(T* const&)
/boost/functional/hash/hash.hpp:308:24: note: template<class T, unsigned int N> std::size_t boost::hash_value(const T (&)[N])
/boost/functional/hash/hash.hpp:314:24: note: template<class T, unsigned int N> std::size_t boost::hash_value(T (&)[N])
/boost/functional/hash/hash.hpp:327:24: note: std::size_t boost::hash_value(float)
/boost/functional/hash/hash.hpp:327:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘float’
/boost/functional/hash/hash.hpp:332:24: note: std::size_t boost::hash_value(double)
/boost/functional/hash/hash.hpp:332:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘double’
/boost/functional/hash/hash.hpp:337:24: note: std::size_t boost::hash_value(long double)
/boost/functional/hash/hash.hpp:337:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘long double’
/boost/functional/hash/hash.hpp:321:24: note: template<class Ch, class A> std::size_t boost::hash_value(const std::basic_string<Ch, std::char_traits<_CharT>, A>&)
/boost/functional/hash/hash.hpp:343:24: note: std::size_t boost::hash_value(std::type_index)
/boost/functional/hash/hash.hpp:343:24: note: no known conversion for argument 1 from ‘const boost::asio::ip::address’ to ‘std::type_index’
/boost/functional/hash/extensions.hpp:54:17: note: template<class A, class B> std::size_t boost::hash_value(const std::pair<_T1, _T2>&)
/boost/functional/hash/extensions.hpp:63:17: note: template<class T, class A> std::size_t boost::hash_value(const std::vector<_Tp, _Alloc>&)
/boost/functional/hash/extensions.hpp:69:17: note: template<class T, class A> std::size_t boost::hash_value(const std::list<_Tp, _Alloc>&)
/boost/functional/hash/extensions.hpp:75:17: note: template<class T, class A> std::size_t boost::hash_value(const std::deque<_Tp, _Alloc>&)
/boost/functional/hash/extensions.hpp:81:17: note: template<class K, class C, class A> std::size_t boost::hash_value(const std::set<_Key, _Compare, _Alloc>&)
/boost/functional/hash/extensions.hpp:87:17: note: template<class K, class C, class A> std::size_t boost::hash_value(const std::multiset<_Key, _Compare, _Alloc>&)
/boost/functional/hash/extensions.hpp:93:17: note: template<class K, class T, class C, class A> std::size_t boost::hash_value(const std::map<_Key, _Tp, _Compare, _Alloc>&)
/boost/functional/hash/extensions.hpp:99:17: note: template<class K, class T, class C, class A> std::size_t boost::hash_value(const std::multimap<_Key, _Tp, _Compare, _Alloc>&)
/boost/functional/hash/extensions.hpp:105:17: note: template<class T> std::size_t boost::hash_value(const std::complex<_Tp>&)
/boost/functional/hash/extensions.hpp:177:9: warning: control reaches end of non-void function [-Wreturn-type]
/boost/asio/error.hpp: At global scope:
/boost/asio/error.hpp:244:45: warning: ‘boost::asio::error::system_category’ defined but not used [-Wunused-variable]
/boost/asio/error.hpp:246:45: warning: ‘boost::asio::error::netdb_category’ defined but not used [-Wunused-variable]
/boost/asio/error.hpp:248:45: warning: ‘boost::asio::error::addrinfo_category’ defined but not used [-Wunused-variable]
/boost/asio/error.hpp:250:45: warning: ‘boost::asio::error::misc_category’ defined but not used [-Wunused-variable]
Here's what I came up with after a brief inspection of the class interface for ip::address.
I would like to note that it's pretty wasteful to use. Especially if you happen to know that all addresses are ipv4, e.g. I'd prefer to key by ulong then.
namespace boost
{
template <>
struct hash<IPAddress>
{
size_t operator()(IPAddress const& v) const {
if (v.is_v4())
return v.to_v4().to_ulong();
if (v.is_v6())
{
auto const& range = v.to_v6().to_bytes();
return hash_range(range.begin(), range.end());
}
if (v.is_unspecified())
{
// guaranteed to be random: chosen by fair dice roll
return static_cast<size_t>(0x4751301174351161ul);
}
return hash_value(v.to_string());
}
};
}
See it Live on Coliru:
#include <boost/asio.hpp>
#include <boost/unordered/unordered_map.hpp>
#include <iostream>
#include <list>
typedef int ApplicationID;
typedef boost::asio::ip::address IPAddress;
typedef std::list<ApplicationID> APP_LIST;
typedef boost::unordered::unordered_map<IPAddress, APP_LIST> USER_MAP;
namespace boost
{
template <>
struct hash<IPAddress>
{
size_t operator()(IPAddress const& v) const {
if (v.is_v4())
return v.to_v4().to_ulong();
if (v.is_v6())
{
auto const& range = v.to_v6().to_bytes();
return hash_range(range.begin(), range.end());
}
if (v.is_unspecified())
return 0x4751301174351161ul;
return hash_value(v.to_string());
}
};
}
int main()
{
USER_MAP map;
map.insert({ {}, {} });
}
This is an old question, but I recently came across the same issue while writing a game in c++17.
This is how I solved it:
struct endpoint_hash
{
std::size_t operator()(boost::asio::ip::udp::endpoint const& ep) const noexcept
{
auto accum = std::size_t(0);
auto combine = [&accum](auto&& arg) {
boost::hash_combine(accum, arg);
};
combine(ep.port());
if (auto&& addr = ep.address(); addr.is_v4())
{
combine(addr.to_v4().to_ulong());
}
else
{
combine(addr.to_v6().to_bytes());
}
combine(ep.port());
return accum;
}
};
std::unordered_map<boost::asio::ip::udp::endpoint, std::shared_ptr<game_client>, endpoint_hash> cache_;
It will work if you write a hash function for IPaddress.
I am having trouble calling a c function from arm assembly. Vice versa works fine. Arch is cortex-m3 and the board is due. Compiler is gcc.
Here's the assembly code:
.syntax unified
.section .text
.thumb_func
.cpu cortex-m3
.extern my_c_add
.global call_my_c_add
call_my_c_add: # r0 - x, r1 - y
bl my_c_add
bx lr # return
And here's the c code:
#include <Arduino.h>
#include <SPI.h>
#include <Ethernet.h>
extern "C" unsigned int call_my_c_add (unsigned int, unsigned int);
unsigned int my_c_add(unsigned int, unsigned int);
unsigned int x=20;
unsigned int y = 15;
void setup()
{
Serial.begin(115200);
Serial.println("exiting setup");
}
void loop()
{
unsigned int z = 0;
z = call_my_c_add (x, y);
Serial.print("c calling asm calling c, addition is - ");
Serial.println(z);
}
unsigned int my_c_add(unsigned int x, unsigned int y)
{
return (x+y);
}
The error I get is -
small_sample.S.o: In function call_my_c_add':
small_sample.S:12: undefined reference tomy_c_add'
collect2: ld returned 1 exit status
Here's the command I use for linking -
arm-none-eabi-g++ -O3 -Wl,--gc-sections -mcpu=cortex-m3 -T flash.ld -Wl,-Map,mapfile -o elffile -L somefile -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--start-group some.c.o some2.cpp.o assembly.S.o somelib.a -Wl,--end-group
g++ compiler does some name mangling. You probably need to add extern "C" also on the my_c_add, to disable it for that function.
Try to run arm-none-eabi-nm on the two object files, and check that the name of the symbol defined in the object compiled from C/C++ is the same as the symbol in the object compiled from assembly.