Skip to content

Commit 933c094

Browse files
committed
Fix build bitrot
Bazel configuration appears to have bitrotted. Update to the latest set of dependencies & fix build issues.
1 parent 4e02d0d commit 933c094

8 files changed

Lines changed: 134 additions & 30 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ bin
77
*.a
88
CMakeCache.txt
99
cmake-build-debug
10+
bazel-*

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,36 @@ on Windows follow any installation instructions and install libmicrohttpd, curl
3030
Finally, call
3131
> bazel build //...
3232
33+
If using a sufficiently new compiler, boringssl dependency for gRPC may fail to build. Try:
34+
> bazel build --copt=-Wno-error=array-parameter --copt=-Wno-error=stringop-overflow //...
35+
3336
To run tests, call
3437
> bazel test //...
3538
3639
## Training
3740

3841
Run:
39-
> bazel run //src/training/train
42+
> bazel run //n2p/training:train
43+
Don't forget about `--copt` from above if boringssl fails to build.
4044

4145
To get options for training, use:
42-
> bazel run //src/training/train --help
46+
> bazel run //n2p/training:train --help
4347
4448
By default, train gets input programs (converted to JSON for example with UnuglifyJS) from the file testdata in the current directory. As a result, it creates files with the trained model.
4549

4650
If you wish to train the model using pseudolikelihood use the following parameters:
4751

48-
> bazel run //src/training/train -- -training_method pl -input path/to/input/file --logtostderr
52+
> bazel run //n2p/training:train -- -training_method pl -input path/to/input/file --logtostderr
4953
5054
you can control the pseudolikelihood specific beam size with the `-beam_size` parameter which is different from the beam size used during MAP Inference.
5155

52-
`//src/training/train` expects data to be in protobuf recordIO format. If you want to use JSON input - use `//src/training/train_json` instead.
56+
`//n2p/training:train` expects data to be in protobuf recordIO format. If you want to use JSON input - use `//n2p/training:train_json` instead.
5357

5458
### Factors
5559

5660
by default the usage of factor features in Nice2Predict is enabled, however if you wish to disable it you can launch the training with the following command:
5761

58-
> bazel run //src/training/train -- -use_factors=false -input path/to/input/file --logtostderr
62+
> bazel run //n2p/training:train -- -use_factors=false -input path/to/input/file --logtostderr
5963
6064
## Predicting properties
6165

WORKSPACE

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
git_repository(
2-
name = "org_pubref_rules_protobuf",
3-
remote = "https://github.com/pubref/rules_protobuf",
4-
tag = "v0.8.1",
5-
# commit = "d9523f3d443b6a4f3fabc72051d84eb5474d7745"
6-
)
7-
8-
load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories")
9-
cpp_proto_repositories()
1+
load("//tools/build_defs:externals.bzl", "new_patched_http_archive")
2+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
104

11-
#BTW, @org_pubref_rules_protobuf already contains @com_google_googletest
12-
13-
load("//tools/build_defs:externals.bzl",
14-
"new_patched_http_archive",
15-
)
16-
17-
# The sparsehash BUILD is copied from https://github.com/livegrep/livegrep
185
new_patched_http_archive(
196
name = "com_github_sparsehash",
207
url = "https://github.com/sparsehash/sparsehash/archive/sparsehash-2.0.3.tar.gz",
@@ -23,3 +10,45 @@ new_patched_http_archive(
2310
strip_prefix = "sparsehash-sparsehash-2.0.3/",
2411
patch_file = "//third_party:sparsehash.patch",
2512
)
13+
14+
http_archive(
15+
name = "com_google_googletest",
16+
url = "https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz",
17+
strip_prefix = "googletest-release-1.11.0",
18+
sha256 = "b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5",
19+
)
20+
21+
git_repository(
22+
name = "com_google_googletest",
23+
remote = "https://github.com/google/googletest.git",
24+
tag = "release-1.11.0",
25+
)
26+
27+
http_archive(
28+
name = "com_google_protobuf",
29+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-cpp-3.17.3.tar.gz",
30+
strip_prefix = "protobuf-3.17.3",
31+
sha256 = "51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb",
32+
)
33+
34+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
35+
protobuf_deps()
36+
37+
http_archive(
38+
name = "com_github_madler_zlib",
39+
url = "https://github.com/madler/zlib/archive/refs/tags/v1.2.11.tar.gz",
40+
strip_prefix = "zlib-1.2.11",
41+
build_file = "//third_party:BUILD.zlib",
42+
sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff",
43+
)
44+
45+
http_archive(
46+
name = "com_github_grpc_grpc",
47+
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.38.1.tar.gz",
48+
strip_prefix = "grpc-1.38.1",
49+
sha256 = "f60e5b112913bf776a22c16a3053cc02cf55e60bf27a959fd54d7aaf8e2da6e8",
50+
)
51+
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
52+
grpc_deps()
53+
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
54+
grpc_extra_deps()

json/server_connectors_httpserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void HttpServer::SetUrlHandler(const string &url, IClientConnectionHandler *hand
119119
this->SetHandler(NULL);
120120
}
121121

122-
int HttpServer::callback(void *cls, MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
122+
MHD_Result HttpServer::callback(void *cls, MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
123123
{
124124
(void)version;
125125
if (*con_cls == NULL)

json/server_connectors_httpserver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace jsonrpc
7171

7272
std::map<std::string, IClientConnectionHandler*> urlhandler;
7373

74-
static int callback(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
74+
static MHD_Result callback(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
7575

7676
IClientConnectionHandler* GetHandler(const std::string &url);
7777

n2p/protos/BUILD

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
1-
load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cc_proto_library")
1+
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
2+
load("@com_github_grpc_grpc//bazel:generate_cc.bzl", "generate_cc")
3+
4+
proto_library(
5+
name = "service",
6+
srcs = ["service.proto"],
7+
deps = [
8+
":interface",
9+
"@com_google_protobuf//:any_proto",
10+
],
11+
)
12+
13+
proto_library(
14+
name = "interface",
15+
srcs = ["interface.proto"],
16+
)
217

318
cc_proto_library(
19+
name = "service_cc",
20+
deps = [":service"],
21+
)
22+
23+
cc_grpc_library(
424
name = "service_cc_proto",
5-
protos = ["service.proto"],
6-
proto_deps = ["interface_cc_proto"],
7-
with_grpc = True,
25+
srcs = [":service"],
26+
deps = [
27+
":service_cc",
28+
"@com_github_grpc_grpc//:grpc++",
29+
],
30+
grpc_only = True,
831
visibility = ["//visibility:public"],
932
)
1033

1134
cc_proto_library(
1235
name = "interface_cc_proto",
13-
protos = ["interface.proto"],
14-
with_grpc = False,
36+
deps = [":interface"],
1537
visibility = ["//visibility:public"]
1638
)

n2p/server/nice2server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <gflags/gflags.h>
44
#include <glog/logging.h>
55

6-
#include "grpc++/grpc++.h"
6+
#include "grpcpp/grpcpp.h"
77

88
#include "base/stringprintf.h"
99
#include "n2p/inference/graph_inference.h"

third_party/BUILD.zlib

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# ****************************************************************
2+
# BUILD file for https://github.com/madler/zlib
3+
# ****************************************************************
4+
#
5+
package(default_visibility = ["//visibility:public"])
6+
7+
licenses(["notice"]) # BSD/MIT-like license (for zlib)
8+
9+
cc_library(
10+
name = "zlib",
11+
srcs = [
12+
"adler32.c",
13+
"compress.c",
14+
"crc32.c",
15+
"deflate.c",
16+
"gzclose.c",
17+
"gzlib.c",
18+
"gzread.c",
19+
"gzwrite.c",
20+
"infback.c",
21+
"inffast.c",
22+
"inflate.c",
23+
"inftrees.c",
24+
"trees.c",
25+
"uncompr.c",
26+
"zutil.c",
27+
],
28+
hdrs = [
29+
"crc32.h",
30+
"deflate.h",
31+
"gzguts.h",
32+
"inffast.h",
33+
"inffixed.h",
34+
"inflate.h",
35+
"inftrees.h",
36+
"trees.h",
37+
"zconf.h",
38+
"zlib.h",
39+
"zutil.h",
40+
],
41+
includes = [
42+
".",
43+
],
44+
copts = [
45+
"-Wno-unused-variable",
46+
"-Wno-implicit-function-declaration",
47+
],
48+
)

0 commit comments

Comments
 (0)