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

Recipe for minimal WORKSPACE w/ required deps ? #329

Open
tcal-x opened this issue May 20, 2024 · 3 comments
Open

Recipe for minimal WORKSPACE w/ required deps ? #329

tcal-x opened this issue May 20, 2024 · 3 comments

Comments

@tcal-x
Copy link
Member

tcal-x commented May 20, 2024

I've been trying to get an example to run through synthesize_rtl and place_and_route, starting with the example in the README.md, in a new Bazel workspace. I needed to keep adding stuff to the WORKSPACE, and have gotten far enough that synthesis works (although with many warnings from the C/C++ compiler). But place_and_route is blocked by C/C++ compiler errors. I copied the llvm_toolchain rule from the WORKSPACE in this repo but am probably missing something.

Would you suggest that I instead start with the complete WORKSPACE file and dependency_support/ directory in this repo?

@QuantamHD
Copy link
Collaborator

It should generally work. I would say the XLS example is the one to copy. https://github.com/google/xls/blob/main/WORKSPACE#L73

If there's specific errors you're running up against we should try to fix those. Can you post those here?

@tcal-x
Copy link
Member Author

tcal-x commented May 21, 2024

Thanks Ethan; if I just attempt synthesis_rtl, I see many cc1 warnings, but synthesis does complete. Most warnings are this:

INFO: From Compiling src/sat/bmc/bmcMaj2.c [for tool]:
cc1: warning: command line option '-Wno-non-virtual-dtor' is valid for C++/ObjC++ but not for C
cc1: warning: unrecognized command line option '-Wno-unknown-warning-option'
cc1: warning: unrecognized command line option '-Wno-tautological-constant-out-of-range-compare'
cc1: warning: unrecognized command line option '-Wno-string-plus-char'
cc1: warning: unrecognized command line option '-Wno-sometimes-uninitialized'
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-implicit-int-float-conversion'

There are some other random ones like this:

INFO: From Compiling libs/minisat/SimpSolver.cc [for tool]:
In file included from external/at_clifford_yosys/libs/minisat/Sort.h:24,
                 from external/at_clifford_yosys/libs/minisat/SimpSolver.cc:27:
external/at_clifford_yosys/libs/minisat/Vec.h: In instantiation of 'void Minisat::vec<T, _Size>::capacity(Minisat::vec<T, _Size>::Size) [with T = Minisat::vec<unsigned int>; _Size = int; Minisat::vec<T, _Size>::Size = int]':
external/at_clifford_yosys/libs/minisat/Vec.h:119:5:   required from 'void Minisat::vec<T, _Size>::growTo(Minisat::vec<T, _Size>::Size) [with T = Minisat::vec<unsigned int>; _Size = int; Minisat::vec<T, _Size>::Size = int]'
external/at_clifford_yosys/libs/minisat/IntMap.h:48:48:   required from 'void Minisat::IntMap<K, V, MkIndex>::reserve(K) [with K = int; V = Minisat::vec<unsigned int>; MkIndex = Minisat::MkIndexDefault<int>]'
external/at_clifford_yosys/libs/minisat/SolverTypes.h:338:37:   required from 'void Minisat::OccLists<K, Vec, Deleted, MkIndex>::init(const K&) [with K = int; Vec = Minisat::vec<unsigned int>; Deleted = Minisat::SimpSolver::ClauseDeleted; MkIndex = Minisat::MkIndexDefault<int>]'
external/at_clifford_yosys/libs/minisat/SimpSolver.cc:92:28:   required from here
external/at_clifford_yosys/libs/minisat/Vec.h:103:33: warning: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'class Minisat::vec<unsigned int>'; use 'new' and 'delete' instead [-Wclass-memaccess]
     ||   (((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM) )
                        ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from external/at_clifford_yosys/libs/minisat/Sort.h:24,
                 from external/at_clifford_yosys/libs/minisat/SimpSolver.cc:27:
external/at_clifford_yosys/libs/minisat/Vec.h:39:7: note: 'class Minisat::vec<unsigned int>' declared here
 class vec {
       ^~~

@tcal-x
Copy link
Member Author

tcal-x commented May 21, 2024

Edit: This is without copying ANY of dependency_support from this repo.

If I attempt place_and_route, I encounter many errors. Here are a few.

ERROR: /home/tim/.cache/bazel/_bazel_tim/b3b926f1899913ee5ea156bf91d76d18/external/org_theopenroadproject/BUILD.bazel:169:11: Compiling src/utl/src/Logger.cpp [for tool] failed: (Exit 1): gcc failed: error executing command (from target @org_theopenroadproject//:logger) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 72 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/org_theopenroadproject/src/utl/src/Logger.cpp:36:
external/org_theopenroadproject/src/utl/include/utl/Logger.h:201:33: error: 'string_view' in namespace 'std' does not name a type
   inline void metric(const std::string_view metric_name, T value)
                                 ^~~~~~~~~~~
external/org_theopenroadproject/src/utl/include/utl/Logger.h:201:28: note: 'std::string_view' is only available from C++17 onwards
   inline void metric(const std::string_view metric_name, T value)
                            ^~~
In file included from external/org_theopenroadproject/src/utl/src/Logger.cpp:36:
external/org_theopenroadproject/src/utl/include/utl/Logger.h:221:34: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
     log_metric(std::string(metric), '"' + value + '"');
                                  ^
external/org_theopenroadproject/src/utl/src/Logger.cpp:57:58: error: 'is_always_lock_free' is not a member of 'std::atomic<short int>'
   static_assert(std::atomic<MessageCounter::value_type>::is_always_lock_free,
                                                          ^~~~~~~~~~~~~~~~~~~
external/org_theopenroadproject/src/utl/src/Logger.cpp: At global scope:
external/org_theopenroadproject/src/utl/src/Logger.cpp:165:35: error: variable or field 'setMetricsStage' declared void
 void Logger::setMetricsStage(std::string_view format)
                                   ^~~~~~~~~~~
external/org_theopenroadproject/src/utl/src/Logger.cpp:165:35: error: 'string_view' is not a member of 'std'
external/org_theopenroadproject/src/utl/src/Logger.cpp:165:35: note: 'std::string_view' is only available from C++17 onwards

Also, it seems I'm using my local gcc installation -- this is another error:

/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/stl_tree.h:1895:6: error: no match for call to '(utl::Logger::StringViewCmp) (const std::__cxx11::basic_string<char>&, const std::__cxx11::basic_string<char>&)'

Yes, maybe another clue -- this is a Red Hat system.

Edit: but I should mention that on this system, all tests under bazel_rules_hdl do pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants