google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
10.97k stars 2.1k forks source link

Can't compile v6.2 because of "ld: unknown option: -m64" #438

Closed gmarchi closed 7 years ago

gmarchi commented 7 years ago

I was trying to compile v6.2 of or-tools on macOS Sierra with make python, to use some external solvers like GLPK, SCIP and Gurobi, but at some point it showed me this error:

ld: unknown option: -m64
make: *** [/Users/Giacomo/or-tools-6.2/lib/libortools.dylib] Error 1

The whole command which generates the error should be:

ld -arch x86_64 -dylib -flat_namespace -undefined suppress -macosx_version_min 10.9 -lSystem -compatibility_version 6.2 -current_version 6.2 \
      -o /Users/Giacomo/or-tools-6.2/lib/libortools.dylib \
      objs/base/bitmap.o objs/base/callback.o objs/base/file.o objs/base/filelinereader.o objs/base/join.o objs/base/mutex.o objs/base/numbers.o objs/base/random.o objs/base/recordio.o objs/base/split.o objs/base/stringprintf.o objs/base/string_view.o objs/base/sysinfo.o objs/base/threadpool.o objs/base/timer.o objs/base/time_support.o \
      objs/util/bitset.o objs/util/cached_log.o objs/util/file_util.o objs/util/fp_utils.o objs/util/graph_export.o objs/util/piecewise_linear_function.o objs/util/proto_tools.o objs/util/range_query_function.o objs/util/rational_approximation.o objs/util/rcpsp_parser.o objs/util/sorted_interval_list.o objs/util/stats.o objs/util/time_limit.o objs/util/xml_helper.o \
      objs/lp_data/lp_data.o objs/lp_data/lp_decomposer.o objs/lp_data/lp_print_utils.o objs/lp_data/lp_types.o objs/lp_data/lp_utils.o objs/lp_data/matrix_scaler.o objs/lp_data/matrix_utils.o objs/lp_data/mps_reader.o objs/lp_data/proto_utils.o objs/lp_data/sparse.o objs/lp_data/sparse_column.o \
      objs/glop/basis_representation.o objs/glop/dual_edge_norms.o objs/glop/entering_variable.o objs/glop/initial_basis.o objs/glop/lp_solver.o objs/glop/lu_factorization.o objs/glop/markowitz.o objs/glop/preprocessor.o objs/glop/primal_edge_norms.o objs/glop/reduced_costs.o objs/glop/revised_simplex.o objs/glop/status.o objs/glop/update_row.o objs/glop/variables_info.o objs/glop/variable_values.o objs/glop/parameters.pb.o \
      objs/graph/assignment.o objs/graph/astar.o objs/graph/bellman_ford.o objs/graph/cliques.o objs/graph/dijkstra.o objs/graph/linear_assignment.o objs/graph/max_flow.o objs/graph/min_cost_flow.o objs/graph/shortestpaths.o objs/graph/util.o objs/graph/flow_problem.pb.o \
      objs/algorithms/dynamic_partition.o objs/algorithms/dynamic_permutation.o objs/algorithms/find_graph_symmetries.o objs/algorithms/hungarian.o objs/algorithms/knapsack_solver.o objs/algorithms/sparse_permutation.o \
      objs/sat/all_different.o objs/sat/boolean_problem.o objs/sat/clause.o objs/sat/cp_constraints.o objs/sat/cp_model_checker.o objs/sat/cp_model_presolve.o objs/sat/cp_model_solver.o objs/sat/cp_model_utils.o objs/sat/cumulative.o objs/sat/disjunctive.o objs/sat/drat.o objs/sat/encoding.o objs/sat/flow_costs.o objs/sat/integer.o objs/sat/integer_expr.o objs/sat/intervals.o objs/sat/linear_programming_constraint.o objs/sat/lp_utils.o objs/sat/no_cycle.o objs/sat/optimization.o objs/sat/overload_checker.o objs/sat/pb_constraint.o objs/sat/precedences.o objs/sat/sat_solver.o objs/sat/simplification.o objs/sat/symmetry.o objs/sat/table.o objs/sat/theta_tree.o objs/sat/timetable.o objs/sat/timetable_edgefinding.o objs/sat/util.o objs/sat/boolean_problem.pb.o objs/sat/cp_model.pb.o objs/sat/sat_parameters.pb.o \
      objs/bop/bop_base.o objs/bop/bop_fs.o objs/bop/bop_lns.o objs/bop/bop_ls.o objs/bop/bop_portfolio.o objs/bop/bop_solution.o objs/bop/bop_solver.o objs/bop/bop_util.o objs/bop/complete_optimizer.o objs/bop/integral_solver.o objs/bop/bop_parameters.pb.o \
      objs/linear_solver/bop_interface.o objs/linear_solver/cbc_interface.o objs/linear_solver/clp_interface.o objs/linear_solver/cplex_interface.o objs/linear_solver/glop_interface.o objs/linear_solver/glop_utils.o objs/linear_solver/glpk_interface.o objs/linear_solver/gurobi_interface.o objs/linear_solver/linear_expr.o objs/linear_solver/linear_solver.o objs/linear_solver/model_exporter.o objs/linear_solver/model_validator.o objs/linear_solver/scip_interface.o objs/linear_solver/linear_solver.pb.o \
      objs/constraint_solver/ac4_mdd_reset_table.o objs/constraint_solver/ac4r_table.o objs/constraint_solver/alldiff_cst.o objs/constraint_solver/assignment.o objs/constraint_solver/collect_variables.o objs/constraint_solver/constraints.o objs/constraint_solver/constraint_solver.o objs/constraint_solver/count_cst.o objs/constraint_solver/default_search.o objs/constraint_solver/demon_profiler.o objs/constraint_solver/deviation.o objs/constraint_solver/diffn.o objs/constraint_solver/element.o objs/constraint_solver/expr_array.o objs/constraint_solver/expr_cst.o objs/constraint_solver/expressions.o objs/constraint_solver/gcc.o objs/constraint_solver/graph_constraints.o objs/constraint_solver/hybrid.o objs/constraint_solver/interval.o objs/constraint_solver/io.o objs/constraint_solver/local_search.o objs/constraint_solver/model_cache.o objs/constraint_solver/nogoods.o objs/constraint_solver/pack.o objs/constraint_solver/range_cst.o objs/constraint_solver/resource.o objs/constraint_solver/routing.o objs/constraint_solver/routing_flags.o objs/constraint_solver/routing_neighborhoods.o objs/constraint_solver/routing_search.o objs/constraint_solver/sat_constraint.o objs/constraint_solver/sched_constraints.o objs/constraint_solver/sched_expr.o objs/constraint_solver/sched_search.o objs/constraint_solver/search.o objs/constraint_solver/softgcc.o objs/constraint_solver/table.o objs/constraint_solver/timetabling.o objs/constraint_solver/trace.o objs/constraint_solver/tree_monitor.o objs/constraint_solver/utilities.o objs/constraint_solver/visitor.o objs/constraint_solver/assignment.pb.o objs/constraint_solver/demon_profiler.pb.o objs/constraint_solver/model.pb.o objs/constraint_solver/routing_enums.pb.o objs/constraint_solver/routing_parameters.pb.o objs/constraint_solver/search_limit.pb.o objs/constraint_solver/solver_parameters.pb.o \
      /usr/local//lib/libglpk.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libCbcSolver.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libCbc.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libCgl.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libOsi.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libOsiCbc.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libOsiClp.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libClp.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libCoinUtils.a -force_load /Users/Giacomo/scipoptsuite-4.0.0/scip-4.0.0//lib/static/libscip.darwin.x86_64.gnu.opt.a /Users/Giacomo/scipoptsuite-4.0.0/scip-4.0.0//lib/static/libnlpi.cppad.darwin.x86_64.gnu.opt.a -force_load /Users/Giacomo/scipoptsuite-4.0.0/scip-4.0.0//lib/static/liblpispx2.darwin.x86_64.gnu.opt.a -force_load /Users/Giacomo/scipoptsuite-4.0.0/scip-4.0.0//lib/static/libsoplex.darwin.x86_64.gnu.opt.a  -L/Library/gurobi751//mac64/bin/ -m64 -lc -ldl -lm -lpthread -lgurobi75  /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libgflags.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libprotobuf.a /Users/Giacomo/or-tools-6.2/dependencies/install/lib/libglog.a \
      -lz

with option used in line:

-L/Library/gurobi751//mac64/bin/ -m64 -lc -ldl -lm -lpthread -lgurobi75

As man ld says:

-m Don't treat multiple definitions as an error.  This is no longer supported. This option is obsolete.

Could it be the reason of my fail or it's caused by gurobi?

So, how to workaround it?

lperron commented 7 years ago

Which compiler are you using?

Here is mine:

clang -v

Apple LLVM version 8.1.0 (clang-802.0.42)

Target: x86_64-apple-darwin16.6.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

2017-07-21 3:32 GMT-07:00 gmarchi notifications@github.com:

Reopened #438 https://github.com/google/or-tools/issues/438.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/438#event-1173649864, or mute the thread https://github.com/notifications/unsubscribe-auth/AKj17Vib6OnFIEhPk_8PwlSEnbhbf1Rzks5sQH45gaJpZM4OfPAl .

gmarchi commented 7 years ago

Here is my compiler:

Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
lperron commented 7 years ago

I pushed a fix that removes the link.

Can you try it out?

Thanks

Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

2017-07-21 8:40 GMT-07:00 gmarchi notifications@github.com:

This one seems mine:

Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/438#issuecomment-317035156, or mute the thread https://github.com/notifications/unsubscribe-auth/AKj17VSn83u89EcJcEsWGXm73zPszHZuks5sQMZ8gaJpZM4OfPAl .

gmarchi commented 7 years ago

Ok thanks @lperron ! However i'm in travel until monday, so i'll try it on monday, sorry.

gmarchi commented 7 years ago

Ok @lperron I'm here, compiling has gone well and with every solver, thank you.

However I made some tests (using your makefiles): C++ interface seems working without errors, but python test raise me this exception:

Traceback (most recent call last):
  File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/Users/Giacomo/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 560, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
ImportError: dlopen(/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/_pywrapcp.so, 2): Symbol not found: _SCIPtpiCollectJobs
  Referenced from: /Users/Giacomo/or-tools/lib/libortools.dylib
  Expected in: flat namespace
 in /Users/Giacomo/or-tools/lib/libortools.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "examples/python/hidato_table.py", line 27, in <module>
    from ortools.constraint_solver import pywrapcp
  File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 17, in <module>
    _pywrapcp = swig_import_helper()
  File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 16, in swig_import_helper
    return importlib.import_module('_pywrapcp')
  File "/Users/Giacomo/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrapcp'
make: *** [test_python_examples] Error 1

I thought the problem could be caused by my previous version of installed or-tools (via pip), so I uninstalled them, but nothing changed. I'm new to python so it isn't so easy for me to debug exceptions, sorry, I need your help one more time.

lperron commented 7 years ago

can you type

otool -L /libortools.dylib?

I would expect it does not find a scip dynamic library.

Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

2017-07-23 13:24 GMT-07:00 gmarchi notifications@github.com:

Ok @lperron https://github.com/lperron I'm here, compiling has gone well and with every solver, thank you.

However I made some tests (using your makefiles): C++ interface seems working without errors, but python test raise me this exception:

Traceback (most recent call last): File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/Users/Giacomo/anaconda/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 648, in _load_unlocked File "", line 560, in module_from_spec File "", line 922, in create_module File "", line 205, in _call_with_frames_removed ImportError: dlopen(/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/_pywrapcp.so, 2): Symbol not found: _SCIPtpiCollectJobs Referenced from: /Users/Giacomo/or-tools/lib/libortools.dylib Expected in: flat namespace in /Users/Giacomo/or-tools/lib/libortools.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "examples/python/hidato_table.py", line 27, in from ortools.constraint_solver import pywrapcp File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 17, in _pywrapcp = swig_import_helper() File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 16, in swig_import_helper return importlib.import_module('_pywrapcp') File "/Users/Giacomo/anaconda/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_pywrapcp' make: *** [test_python_examples] Error 1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/438#issuecomment-317279557, or mute the thread https://github.com/notifications/unsubscribe-auth/AKj17WudkiwxJFym9dyM8eLodDsDgEuEks5sQ6vxgaJpZM4OfPAl .

gmarchi commented 7 years ago

otool -L /Users/Giacomo/or-tools/lib/libortools.dylib

gives me this output:

/Users/Giacomo/or-tools/lib/libortools.dylib: /Users/Giacomo/or-tools/lib/libortools.dylib (compatibility version 6.3.0, current version 6.3.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2) libgurobi75.so (compatibility version 7.5.0, current version 7.5.1) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)

Il giorno 23 lug 2017, alle ore 23:52, lperron notifications@github.com ha scritto:

can you type

otool -L /libortools.dylib?

I would expect it does not find a scip dynamic library.

Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

2017-07-23 13:24 GMT-07:00 gmarchi notifications@github.com:

Ok @lperron https://github.com/lperron I'm here, compiling has gone well and with every solver, thank you.

However I made some tests (using your makefiles): C++ interface seems working without errors, but python test raise me this exception:

Traceback (most recent call last): File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/Users/Giacomo/anaconda/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 648, in _load_unlocked File "", line 560, in module_from_spec File "", line 922, in create_module File "", line 205, in _call_with_frames_removed ImportError: dlopen(/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/_pywrapcp.so, 2): Symbol not found: _SCIPtpiCollectJobs Referenced from: /Users/Giacomo/or-tools/lib/libortools.dylib Expected in: flat namespace in /Users/Giacomo/or-tools/lib/libortools.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "examples/python/hidato_table.py", line 27, in from ortools.constraint_solver import pywrapcp File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 17, in _pywrapcp = swig_import_helper() File "/Users/Giacomo/or-tools/ortools/constraint_solver/../gen/ortools/constraint_solver/pywrapcp.py", line 16, in swig_import_helper return importlib.import_module('_pywrapcp') File "/Users/Giacomo/anaconda/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_pywrapcp' make: *** [test_python_examples] Error 1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/438#issuecomment-317279557, or mute the thread https://github.com/notifications/unsubscribe-auth/AKj17WudkiwxJFym9dyM8eLodDsDgEuEks5sQ6vxgaJpZM4OfPAl .

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/438#issuecomment-317284792, or mute the thread https://github.com/notifications/unsubscribe-auth/ALqfr0iAUCnyLdjsSGTelR43-QAuzLdsks5sQ8CZgaJpZM4OfPAl.

lperron commented 7 years ago

I have clarified the way to build scip.

can you try the instructions there:

http://or-tools.blogspot.com/2017/03/changing-way-we-link-with-scip.html

gmarchi commented 7 years ago

Everything works! Thank you!

Il giorno 01 ago 2017, alle ore 16:51, lperron notifications@github.com ha scritto:

I have changed the way to build scip.

can you try the instructions there:

http://or-tools.blogspot.com/2017/03/changing-way-we-link-with-scip.html http://or-tools.blogspot.com/2017/03/changing-way-we-link-with-scip.html — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/438#issuecomment-319394106, or mute the thread https://github.com/notifications/unsubscribe-auth/ALqfrwXa5CaJu4DAUfLzo6QvokgnW8C9ks5sTzt1gaJpZM4OfPAl.