google-deepmind / mujoco_mpc

Real-time behaviour synthesis with MuJoCo, using Predictive Control
https://github.com/deepmind/mujoco_mpc
Apache License 2.0
951 stars 142 forks source link

Dependency files needed change to void compiling error #109

Closed gaolongsen closed 7 months ago

gaolongsen commented 1 year ago

Dear Deepmind Team, after I cmake the project, I found some issues when I tried to use this lib on my Ubuntu20 system. I ask someone to do the same test and the problem are the same. So I would like to let you know and make some changes for that:

  1. mujoco_mpc/cmake/MpcOptions.cmake and /home/wam/mujoco_mpc/_deps/mujoco-build/CMakeFiles/mujoco.dir/flags.make I think you should remove all -Werror to make sure that even though some warring occurred, users can also compile the project.
  2. mujoco_mpc/mjpc/agent.cc add (struct mjuiDef_) in line 366, line 386 and line 389 to make sure that no errors occur during the assignment of structure variables.
saran-t commented 1 year ago

If you get an error from the -Werror then it usually indicates that there's a real issue with the code that needs to be fixed. Can you tell us what the error is?

gaolongsen commented 1 year ago

Hi Saran, Thanks for your response! Here is after I remove the -Werror, the terminal shows related errors for your examples code. /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in functiontest_compress': example.c:(.text.test_compress+0x71): undefined reference to compress' /usr/bin/ld: example.c:(.text.test_compress+0x96): undefined reference touncompress' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in function test_gzio': example.c:(.text.test_gzio+0x78): undefined reference togzopen' /usr/bin/ld: example.c:(.text.test_gzio+0x91): undefined reference to gzputc' /usr/bin/ld: example.c:(.text.test_gzio+0xa0): undefined reference togzputs' /usr/bin/ld: example.c:(.text.test_gzio+0xc1): undefined reference to gzprintf' /usr/bin/ld: example.c:(.text.test_gzio+0xdc): undefined reference togzseek' /usr/bin/ld: example.c:(.text.test_gzio+0xe4): undefined reference to gzclose' /usr/bin/ld: example.c:(.text.test_gzio+0xf3): undefined reference togzopen' /usr/bin/ld: example.c:(.text.test_gzio+0x11b): undefined reference to gzread' /usr/bin/ld: example.c:(.text.test_gzio+0x164): undefined reference togzseek' /usr/bin/ld: example.c:(.text.test_gzio+0x179): undefined reference to gztell' /usr/bin/ld: example.c:(.text.test_gzio+0x1c0): undefined reference togzungetc' /usr/bin/ld: example.c:(.text.test_gzio+0x1d7): undefined reference to gzgets' /usr/bin/ld: example.c:(.text.test_gzio+0x21e): undefined reference togzclose' /usr/bin/ld: example.c:(.text.test_gzio+0x244): undefined reference to gzgetc' /usr/bin/ld: example.c:(.text.test_gzio+0x257): undefined reference togztell' /usr/bin/ld: example.c:(.text.test_gzio+0x2b7): undefined reference to gzerror' /usr/bin/ld: example.c:(.text.test_gzio+0x2eb): undefined reference togzerror' /usr/bin/ld: example.c:(.text.test_gzio+0x325): undefined reference to gzerror' /usr/bin/ld: example.c:(.text.test_gzio+0x34a): undefined reference togzerror' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in function test_deflate': example.c:(.text.test_deflate+0x98): undefined reference todeflateInit_' /usr/bin/ld: example.c:(.text.test_deflate+0xcd): undefined reference to deflate' /usr/bin/ld: example.c:(.text.test_deflate+0xf5): undefined reference todeflate' /usr/bin/ld: example.c:(.text.test_deflate+0x102): undefined reference to deflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in functiontest_inflate': example.c:(.text.testinflate+0x6d): undefined reference to `inflateInit' /usr/bin/ld: example.c:(.text.test_inflate+0x9d): undefined reference to inflate' /usr/bin/ld: example.c:(.text.test_inflate+0xb5): undefined reference toinflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in function test_large_deflate': example.c:(.text.test_large_deflate+0x56): undefined reference todeflateInit_' /usr/bin/ld: example.c:(.text.test_large_deflate+0x7a): undefined reference to deflate' /usr/bin/ld: example.c:(.text.test_large_deflate+0x9c): undefined reference todeflateParams' /usr/bin/ld: example.c:(.text.test_large_deflate+0xae): undefined reference to deflate' /usr/bin/ld: example.c:(.text.test_large_deflate+0xc4): undefined reference todeflateParams' /usr/bin/ld: example.c:(.text.test_large_deflate+0xd7): undefined reference to deflate' /usr/bin/ld: example.c:(.text.test_large_deflate+0xe8): undefined reference todeflate' /usr/bin/ld: example.c:(.text.test_large_deflate+0xf5): undefined reference to deflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in functiontest_large_inflate': example.c:(.text.test_largeinflate+0x63): undefined reference to `inflateInit' /usr/bin/ld: example.c:(.text.test_large_inflate+0x8b): undefined reference to inflate' /usr/bin/ld: example.c:(.text.test_large_inflate+0x98): undefined reference toinflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in function test_flush': example.c:(.text.test_flush+0x95): undefined reference todeflateInit_' /usr/bin/ld: example.c:(.text.test_flush+0xc3): undefined reference to deflate' /usr/bin/ld: example.c:(.text.test_flush+0xdf): undefined reference todeflate' /usr/bin/ld: example.c:(.text.test_flush+0xec): undefined reference to deflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in functiontest_sync': example.c:(.text.testsync+0x68): undefined reference to `inflateInit' /usr/bin/ld: example.c:(.text.test_sync+0x84): undefined reference to inflate' /usr/bin/ld: example.c:(.text.test_sync+0x9b): undefined reference toinflateSync' /usr/bin/ld: example.c:(.text.test_sync+0xb0): undefined reference to inflate' /usr/bin/ld: example.c:(.text.test_sync+0xbd): undefined reference toinflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in function test_dict_deflate': example.c:(.text.test_dict_deflate+0x4c): undefined reference todeflateInit_' /usr/bin/ld: example.c:(.text.test_dict_deflate+0x68): undefined reference to deflateSetDictionary' /usr/bin/ld: example.c:(.text.test_dict_deflate+0xe0): undefined reference todeflate' /usr/bin/ld: example.c:(.text.test_dict_deflate+0xed): undefined reference to deflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in functiontest_dict_inflate': example.c:(.text.test_dictinflate+0x5c): undefined reference to `inflateInit' /usr/bin/ld: example.c:(.text.test_dict_inflate+0x8e): undefined reference to inflate' /usr/bin/ld: example.c:(.text.test_dict_inflate+0xba): undefined reference toinflateSetDictionary' /usr/bin/ld: example.c:(.text.test_dict_inflate+0xc4): undefined reference to inflateEnd' /usr/bin/ld: CMakeFiles/example.dir/test/example.o: in functionmain': example.c:(.text.startup.main+0x2e): undefined reference to zlibVersion' /usr/bin/ld: example.c:(.text.startup.main+0x3c): undefined reference tozlibVersion' /usr/bin/ld: example.c:(.text.startup.main+0x5f): undefined reference to zlibCompileFlags' /usr/bin/ld: example.c:(.text.startup.main+0x1ad): undefined reference tozlibVersion' collect2: error: ld returned 1 exit status make[2]: [_deps/grpc-build/third_party/zlib/CMakeFiles/example.dir/build.make:85: bin/example] Error 1 make[1]: [CMakeFiles/Makefile2:10758: _deps/grpc-build/third_party/zlib/CMakeFiles/example.dir/all] Error 2`

I tried to compile the whole project with the -Werror but didn't remember clearly because it would block the compiling process for each warning. You can have a try and then do a test. Thanks for your time!

gaolongsen commented 1 year ago

But so weird after I cmake . and cmake --build . again, no error occurred as I listed above.

saran-t commented 1 year ago

You're somehow building tests from gRPC... those aren't coming from this repo's code.

nimrod-gileadi commented 1 year ago

The CMake config for the project is in a bit of an odd state, and trying to build all targets does fail with weird errors.

For now, can you run the build command with --target mjpc, or potentially the full list of targets here?

erwincoumans commented 1 year ago

Same issue here, on Mac M1. The target mjpc compiles and runs fine, so it seems harmless.

erwincoumans@Erwins-MBP mujoco_mpc % make
[  0%] Built target absl_spinlock_wait
[  0%] Built target absl_log_severity
[  0%] Built target absl_raw_logging_internal
[  0%] Built target absl_base
[  0%] Built target threadpool
[  0%] Built target ccd
[  0%] Built target qhullstatic_r
[  0%] Built target lodepng
[  0%] Built target tinyxml2
[  0%] Built target tinyobjloader
[  2%] Built target mujoco
[  2%] Built target absl_malloc_internal
[  2%] Built target absl_throw_delegate
[  2%] Built target absl_time_zone
[  2%] Built target absl_debugging_internal
[  2%] Built target absl_stacktrace
[  3%] Built target absl_strings_internal
[  3%] Built target absl_demangle_internal
[  3%] Built target absl_int128
[  3%] Built target absl_strings
[  3%] Built target absl_symbolize
[  3%] Built target absl_exponential_biased
[  3%] Built target absl_graphcycles_internal
[  3%] Built target absl_civil_time
[  3%] Built target absl_time
[  3%] Built target absl_synchronization
[  3%] Built target absl_hashtablez_sampler
[  3%] Built target absl_bad_optional_access
[  3%] Built target absl_raw_hash_set
[  3%] Built target absl_crc_cpu_detect
[  3%] Built target absl_crc_internal
[  3%] Built target absl_crc32c
[  3%] Built target absl_crc_cord_state
[  3%] Built target absl_bad_variant_access
[  3%] Built target absl_city
[  3%] Built target absl_low_level_hash
[  3%] Built target absl_hash
[  3%] Built target absl_random_distributions
[  3%] Built target absl_random_seed_gen_exception
[  3%] Built target absl_random_internal_seed_material
[  3%] Built target absl_random_internal_platform
[  3%] Built target absl_random_internal_randen_hwaes_impl
[  3%] Built target absl_random_internal_randen_slow
[  3%] Built target absl_random_internal_randen_hwaes
[  4%] Built target absl_random_internal_randen
[  4%] Built target absl_random_internal_pool_urbg
[  4%] Built target absl_random_seed_sequences
[  4%] Built target absl_cord_internal
[  5%] Built target absl_cordz_functions
[  5%] Built target absl_cordz_handle
[  5%] Built target absl_cordz_info
[  5%] Built target absl_cord
[  7%] Built target libmjpc
[  7%] Copying tasks into binary directory
[  7%] Built target copy_resources
[  7%] Copying menagerie assets into binary directory
[  7%] Built target copy_menagerie_resources
[  7%] Built target platform_ui_adapter
[  8%] Built target glfw
[  8%] Built target absl_flags_program_name
[  8%] Built target absl_flags_config
[  9%] Built target absl_str_format_internal
[  9%] Built target absl_flags_marshalling
[  9%] Built target absl_flags_commandlineflag_internal
[  9%] Built target absl_flags_commandlineflag
[  9%] Built target absl_flags_private_handle_accessor
[  9%] Built target absl_flags_reflection
[  9%] Built target absl_flags_internal
[  9%] Built target absl_flags
[ 10%] Built target absl_flags_usage_internal
[ 10%] Built target absl_flags_usage
[ 10%] Built target absl_flags_parse
[ 10%] Built target mjpc
[ 10%] Built target load
[ 10%] Built target finite_difference
[ 10%] Built target lqr
[ 10%] Built target gtest
[ 10%] Built target gmock
[ 10%] Built target gtest_main
[ 10%] Built target sampling_planner_test
[ 11%] Built target gradient_planner_test
[ 11%] Built target gradient_test
[ 11%] Built target zero_test
[ 11%] Built target linear_test
[ 11%] Built target cubic_test
[ 11%] Built target ilqg_test
[ 12%] Built target backward_pass_test
[ 12%] Built target task_test
[ 12%] Built target state_test
[ 12%] Built target agent_test
[ 12%] Built target cost_derivatives_test
[ 13%] Built target linear_solve_test
[ 13%] Built target norm_test
[ 13%] Built target rollout_test
[ 13%] Built target threadpool_test
[ 13%] Built target trajectory_test
[ 13%] Built target utilities_test
[ 14%] Built target zlibstatic
[ 14%] Built target absl_strerror
[ 15%] Built target absl_examine_stack
[ 15%] Built target absl_log_internal_conditions
[ 15%] Built target absl_log_internal_globals
[ 15%] Built target absl_log_internal_format
[ 15%] Built target absl_log_internal_proto
[ 15%] Built target absl_log_globals
[ 15%] Built target absl_log_entry
[ 15%] Built target absl_log_sink
[ 16%] Built target absl_log_internal_log_sink_set
[ 16%] Built target absl_log_internal_nullguard
[ 16%] Built target absl_log_internal_message
[ 16%] Built target absl_status
[ 16%] Built target absl_statusor
[ 16%] Built target address_sorting
[ 17%] Built target gpr
[ 18%] Built target upb
[ 21%] Built target c-ares
[ 22%] Built target re2
[ 30%] Built target crypto
[ 32%] Built target ssl
[ 60%] Built target grpc
[ 63%] Built target libprotobuf
[ 65%] Built target grpc++
[ 68%] Built target libprotoc
[ 68%] Built target grpc_plugin_support
[ 68%] Built target grpc_cpp_plugin
[ 69%] Built target protoc
[ 70%] Built target grpc++_reflection
[ 70%] Built target agent_server
[ 84%] Built target grpc_unsecure
[ 84%] Built target grpc++_alts
[ 84%] Built target grpc++_error_details
[ 85%] Built target grpc++_unsecure
[ 93%] Built target grpc_authorization_provider
[ 93%] Built target grpcpp_channelz
[ 94%] Built target grpc_csharp_plugin
[ 94%] Built target grpc_node_plugin
[ 94%] Built target grpc_objective_c_plugin
[ 94%] Built target grpc_php_plugin
[ 94%] Built target grpc_python_plugin
[ 94%] Built target grpc_ruby_plugin
[ 94%] Built target ahost
[ 94%] Built target adig
[ 95%] Built target acountry
[ 96%] Built target libprotobuf-lite
[ 96%] Built target testing
[ 96%] Built target charclass_test
[ 97%] Built target compile_test
[ 97%] Built target filtered_re2_test
[ 97%] Built target mimics_pcre_test
[ 97%] Built target parse_test
[ 97%] Built target possible_match_test
[ 98%] Built target re2_test
[ 98%] Built target re2_arg_test
[ 98%] Built target regexp_test
[ 98%] Built target required_prefix_test
[ 98%] Built target search_test
[ 98%] Built target set_test
[ 98%] Built target simplify_test
[ 98%] Built target string_generator_test
[ 98%] Built target dfa_test
[ 98%] Built target exhaustive1_test
[ 98%] Built target exhaustive2_test
[ 98%] Built target exhaustive3_test
[ 98%] Built target exhaustive_test
[ 98%] Built target random_test
[ 98%] Built target regexp_benchmark
[ 98%] Built target bssl
[100%] Built target zlib
[100%] Linking C executable ../../../../bin/example
Undefined symbols for architecture arm64:
  "_compress", referenced from:
      _test_compress in example.o
     (maybe you meant: _test_compress)
  "_deflate", referenced from:
      _test_deflate in example.o
      _test_large_deflate in example.o
      _test_flush in example.o
      _test_dict_deflate in example.o
     (maybe you meant: _test_large_deflate, _test_deflate , _test_dict_deflate )
  "_deflateEnd", referenced from:
      _test_deflate in example.o
      _test_large_deflate in example.o
      _test_flush in example.o
      _test_dict_deflate in example.o
  "_deflateInit_", referenced from:
      _test_deflate in example.o
      _test_large_deflate in example.o
      _test_flush in example.o
      _test_dict_deflate in example.o
  "_deflateParams", referenced from:
      _test_large_deflate in example.o
  "_deflateSetDictionary", referenced from:
      _test_dict_deflate in example.o
  "_gzclose", referenced from:
      _test_gzio in example.o
  "_gzerror", referenced from:
      _test_gzio in example.o
  "_gzgetc", referenced from:
      _test_gzio in example.o
  "_gzgets", referenced from:
      _test_gzio in example.o
  "_gzopen", referenced from:
      _test_gzio in example.o
  "_gzprintf", referenced from:
      _test_gzio in example.o
  "_gzputc", referenced from:
      _test_gzio in example.o
  "_gzputs", referenced from:
      _test_gzio in example.o
  "_gzread", referenced from:
      _test_gzio in example.o
  "_gzseek", referenced from:
      _test_gzio in example.o
  "_gztell", referenced from:
      _test_gzio in example.o
  "_gzungetc", referenced from:
      _test_gzio in example.o
  "_inflate", referenced from:
      _test_inflate in example.o
      _test_large_inflate in example.o
      _test_sync in example.o
      _test_dict_inflate in example.o
     (maybe you meant: _test_large_inflate, _test_inflate , _test_dict_inflate )
  "_inflateEnd", referenced from:
      _test_inflate in example.o
      _test_large_inflate in example.o
      _test_sync in example.o
      _test_dict_inflate in example.o
  "_inflateInit_", referenced from:
      _test_inflate in example.o
      _test_large_inflate in example.o
      _test_sync in example.o
      _test_dict_inflate in example.o
  "_inflateSetDictionary", referenced from:
      _test_dict_inflate in example.o
  "_inflateSync", referenced from:
      _test_sync in example.o
  "_uncompress", referenced from:
      _test_compress in example.o
  "_zlibCompileFlags", referenced from:
      _main in example.o
  "_zlibVersion", referenced from:
      _main in example.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/example] Error 1
make[1]: *** [_deps/grpc-build/third_party/zlib/CMakeFiles/example.dir/all] Error 2
make: *** [all] Error 2