davidmalcolm / gcc-python-plugin

GCC plugin that embeds CPython inside the compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MacOXS undefined symbols error

nachiket opened this issue · comments

Hi -- I'm trying to get gcc-python-plugin to work on MacOSX. I am facing the following issues with gcc-8

gcc-8 -I/usr/local/Cellar/gcc@8/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin19/8.3.0/plugin/include -I/usr/local/Cellar/gcc@8/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin19/8.3.0/plugin/include/c-family -I. -I/usr/local/include -O2 -Werror -g -fPIC -fno-strict-aliasing -Wall  -shared gcc-callgraph.o gcc-cfg.o gcc-constant.o gcc-declaration.o gcc-diagnostics.o gcc-function.o gcc-gimple.o gcc-location.o gcc-option.o gcc-rtl.o gcc-tree.o gcc-type.o gcc-variable.o autogenerated-casts.o -o libgcc-c-api.so -lstdc++
Undefined symbols for architecture x86_64:
  "integer_zerop(tree_node const*)", referenced from:
      _gcc_gimple_call_get_fndecl in gcc-gimple.o
  "gimple_get_lhs(gimple const*)", referenced from:
      _gcc_gimple_get_expr_type in gcc-gimple.o
  "expand_location(unsigned int)", referenced from:
      _gcc_location_get_filename in gcc-location.o
      _gcc_location_get_line in gcc-location.o
      _gcc_location_get_column in gcc-location.o
  "gt_ggc_mx_gimple(void*)", referenced from:
      _gcc_gimple_mark_in_use in gcc-gimple.o
  "get_pure_location(line_maps*, unsigned int)", referenced from:
      _gcc_location_get_caret in gcc-location.o
  "gimple_call_flags(gimple const*)", referenced from:
      _gcc_gimple_call_is_noreturn in gcc-gimple.o
  "gt_ggc_mx_rtx_def(void*)", referenced from:
      _gcc_rtl_insn_mark_in_use in gcc-rtl.o
  "build_pointer_type(tree_node*)", referenced from:
      _gcc_type_get_pointer in gcc-type.o
  "get_range_from_loc(line_maps*, unsigned int)", referenced from:
      _gcc_location_get_start in gcc-location.o
      _gcc_location_get_finish in gcc-location.o
  "gt_ggc_mx_edge_def(void*)", referenced from:
      _gcc_cfg_edge_mark_in_use in gcc-cfg.o
  "gt_ggc_mx_function(void*)", referenced from:
      _gcc_function_mark_in_use in gcc-function.o
  "gt_ggc_mx_cgraph_edge(void*)", referenced from:
      _gcc_cgraph_edge_mark_in_use in gcc-callgraph.o
  "gt_ggc_mx_symtab_node(void*)", referenced from:
      _gcc_cgraph_node_mark_in_use in gcc-callgraph.o
      _gcc_variable_mark_in_use in gcc-variable.o
  "get_data_from_adhoc_loc(line_maps*, unsigned int)", referenced from:
      _gcc_gimple_get_block in gcc-gimple.o
  "gt_ggc_mx_lang_tree_node(void*)", referenced from:
      _gcc_tree_mark_in_use in gcc-tree.o
  "gt_ggc_mx_basic_block_def(void*)", referenced from:
      _gcc_cfg_block_mark_in_use in gcc-cfg.o
  "get_location_from_adhoc_loc(line_maps*, unsigned int)", referenced from:
      _gcc_decl_is_builtin in gcc-declaration.o
  "gt_ggc_mx_control_flow_graph(void*)", referenced from:
      _gcc_cfg_mark_in_use in gcc-cfg.o
  "linemap_location_in_system_header_p(line_maps*, unsigned int)", referenced from:
      _gcc_location_get_in_system_header in gcc-location.o
  "linemap_position_for_loc_and_offset(line_maps*, unsigned int, unsigned int)", referenced from:
      _gcc_location_offset_column in gcc-location.o
  "inform(unsigned int, char const*, ...)", referenced from:
      _gcc_inform in gcc-diagnostics.o
  "error_at(unsigned int, char const*, ...)", referenced from:
      _gcc_error_at in gcc-diagnostics.o
  "permerror(unsigned int, char const*, ...)", referenced from:
      _gcc_permerror in gcc-diagnostics.o
  "_all_translation_units", referenced from:
      _gcc_for_each_translation_unit_decl in gcc-declaration.o
  "_cfun", referenced from:
      _gcc_get_current_function in gcc-function.o
  "_cl_options", referenced from:
      _gcc_option_get_text in gcc-option.o
  "_cl_options_count", referenced from:
      _gcc_for_each_option in gcc-option.o
  "_gimple_rhs_class_table", referenced from:
      _gcc_gimple_get_expr_type in gcc-gimple.o
  "_global_trees", referenced from:
      _gcc_gimple_get_expr_type in gcc-gimple.o
  "_input_location", referenced from:
      _gcc_set_input_location in gcc-location.o
      _gcc_get_input_location in gcc-location.o
     (maybe you meant: _gcc_set_input_location, _gcc_get_input_location )
  "_line_table", referenced from:
      _gcc_decl_is_builtin in gcc-declaration.o
      _gcc_gimple_get_block in gcc-gimple.o
      _gcc_location_get_in_system_header in gcc-location.o
      _gcc_location_get_caret in gcc-location.o
      _gcc_location_get_start in gcc-location.o
      _gcc_location_get_finish in gcc-location.o
      _gcc_location_offset_column in gcc-location.o
      ...
  "_symtab", referenced from:
      _gcc_for_each_cgraph_node in gcc-callgraph.o
      _gcc_for_each_variable in gcc-variable.o
  "_tree_code_type", referenced from:
      _gcc_binary_get_location in gcc-tree.o
      _gcc_comparison_get_location in gcc-tree.o
      _gcc_expression_get_location in gcc-tree.o
      _gcc_reference_get_location in gcc-tree.o
      _gcc_statement_get_location in gcc-tree.o
      _gcc_unary_get_location in gcc-tree.o
      _gcc_vlexp_get_location in gcc-tree.o
      ...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

I am not sure if I'm missing any shared library path. I did have to add /usr/local/include to get some errors with missing gmp.h sorted out. I tried adding /usr/local/lib to LDFLAGS to no effect.

@nachiket did you succeed to build on MacOS? According to the README this module depends on gcc-plugin-devel but I don't think this is available in Mac. At least brew does not show it.

I wasn’t able to build it. It did with in Ubuntu at some point by I haven’t checked recently.