Fast-Trips / fast-trips

Dynamic transit assignment tool
http://fast-trips.mtc.ca.gov/
Other
38 stars 22 forks source link

Error compiling on Ubuntu 18.04 #178

Open pedrocamargo opened 6 years ago

pedrocamargo commented 6 years ago

System: Ubuntu 18.04 (both branches, Master and Py3)

Stack track below. Apparently, a narrowing conversion on hyperlink.cpp line 420, due to StopStateKey being initialized with a mix of integers and floats. I am not great in C++ (or even reasonable at it), so hard to be sure.

Reference here: https://stackoverflow.com/questions/4434140/narrowing-conversions-in-c0x-is-it-just-me-or-does-this-sound-like-a-breakin

Stack trace below

Installing collected packages: fasttrips
Running setup.py install for fasttrips ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-9e9i69pe-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-r2xf54nn-record/install-record.txt --single-version-externally-managed --compile:
  running install
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Error.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Stop.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Logger.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Performance.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/PathSet.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Trip.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Passenger.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Assignment.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/FastTrips.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/TAZ.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Util.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Run.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Transfer.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/__init__.py -> build/lib.linux-x86_64-3.6/fasttrips
  copying fasttrips/Route.py -> build/lib.linux-x86_64-3.6/fasttrips
  running build_ext
  building '_fasttrips' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/dev/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/fasttrips.cpp -o build/temp.linux-x86_64-3.6/src/fasttrips.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  src/fasttrips.cpp: In function ‘PyObject* _fasttrips_initialize_supply(PyObject*, PyObject*)’:
  src/fasttrips.cpp:57:33: warning: unused variable ‘input5’ [-Wunused-variable]
       PyObject *input3, *input4, *input5, *input6;
                                   ^~~~~~
  src/fasttrips.cpp:57:42: warning: unused variable ‘input6’ [-Wunused-variable]
       PyObject *input3, *input4, *input5, *input6;
                                            ^~~~~~
  src/fasttrips.cpp:74:9: warning: unused variable ‘num_stop_times’ [-Wunused-variable]
       int num_stop_times  = PyArray_DIMS(pyo)[0];
           ^~~~~~~~~~~~~~
  src/fasttrips.cpp: In function ‘PyObject* _fasttrips_set_bump_wait(PyObject*, PyObject*)’:
  src/fasttrips.cpp:110:9: warning: unused variable ‘num_times’ [-Wunused-variable]
       int num_times   = PyArray_DIMS(pyo)[0];
           ^~~~~~~~~
  src/fasttrips.cpp: In function ‘PyObject* _fasttrips_find_pathset(PyObject*, PyObject*)’:
  src/fasttrips.cpp:179:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           for (int link_num = 0; link_num < path.size(); ++link_num) {
                                  ~~~~~~~~~^~~~~~~~~~~~~
  src/fasttrips.cpp:120:20: warning: unused variable ‘pyo’ [-Wunused-variable]
       PyArrayObject *pyo;
                      ^~~
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/dev/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c src/hyperlink.cpp -o build/temp.linux-x86_64-3.6/src/hyperlink.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  src/hyperlink.cpp: In member function ‘void fasttrips::Hyperlink::updateLowCostPath(const fasttrips::StopStateKey&, const fasttrips::Hyperlink*, std::ostream&, const fasttrips::PathSpecification&, const fasttrips::PathFinder&)’:
  src/hyperlink.cpp:147:33: warning: unused variable ‘prev_ssk’ [-Wunused-variable]
               const StopStateKey& prev_ssk = it->first;
                                   ^~~~~~~~
  src/hyperlink.cpp: In member function ‘const fasttrips::Path* fasttrips::Hyperlink::getLowCostPath(bool) const’:
  src/hyperlink.cpp:199:16: warning: variable ‘low_cost’ set but not used [-Wunused-but-set-variable]
           double low_cost = 0;
                  ^~~~~~~~
  src/hyperlink.cpp: In member function ‘void fasttrips::Hyperlink::clear(bool)’:
  src/hyperlink.cpp:420:27: error: expected initializer before ‘zero_ssk’
           void StopStateKey zero_ssk = { 0.0, 0, 0, 0, 0.0 };
                             ^~~~~~~~
  src/hyperlink.cpp:439:47: error: ‘zero_ssk’ was not declared in this scope
           linkset.lder_ssk_                   = zero_ssk;
                                                 ^~~~~~~~
  src/hyperlink.cpp: In member function ‘double fasttrips::Hyperlink::getFareWithTransfer(const fasttrips::PathSpecification&, std::ostream&, const fasttrips::PathFinder&, const fasttrips::FarePeriod&, const std::map<int, fasttrips::Hyperlink>&) const’:
  src/hyperlink.cpp:1023:21: warning: unused variable ‘stop_succpred’ [-Wunused-variable]
                   int stop_succpred = ss.stop_succpred_;
                       ^~~~~~~~~~~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
pedrocamargo commented 6 years ago

The source of the error is confirmed. Changing the line for

const StopStateKey zero_ssk = { 0, 0, 0, 0, 0 };

solves the problem, but I have NO idea if that has any impact in the code, as I haven't gone through it yet...

e-lo commented 6 years ago

will look, thanks for reporting.

On Sat, Sep 8, 2018 at 1:36 AM Pedro Camargo notifications@github.com wrote:

The source of the error is confirmed. Changing the line for const StopStateKey zero_ssk = { 0, 0, 0, 0, 0 }; solves the problem, but I have NO idea if that has any impact in the code, as I haven't gone through it yet...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BayAreaMetro/fast-trips/issues/178#issuecomment-419623862, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwgo8nYqQmswb5y_TbadaNZqxngu1kVks5uY4GDgaJpZM4Wfx43 .

e-lo commented 6 years ago

This issue doesn't exist in our Trusty Ubuntu 14.04 test environment and Travis doesn't support later Ubuntu versions out of the box right now so we'd have to pull a docker image, which I'm not super keen on dealing with at this point.

Will run a test with the line change and see if this affects anything.

cc: @lmz

pedrocamargo commented 6 years ago

I have also been testing a few things on the Python 3 branch with newer versions of the most important dependencies, but several things are coming up regarding functions that will be deprecated or have its behaviour change. Are you guys planning to upgrade those dependencies? If so, I am happy to make a pull request targeting that branch with all the changes I have been making...

e-lo commented 6 years ago

I believe most of those are future warnings? Issues #174 #175 #176 note the ones that I am aware of, and we would be happy to review and merge your pull request!

On Tue, Sep 11, 2018, 5:42 AM Pedro Camargo notifications@github.com wrote:

I have also been testing a few things on the Python 3 branch with newer versions of the most important dependencies, but several things are coming up regarding functions that will be deprecated or have its behaviour change. Are you guys planning to upgrade those dependencies? If so, I am happy to make a pull request targeting that branch with all the changes I have been making...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BayAreaMetro/fast-trips/issues/178#issuecomment-420260274, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwgoxQi4dIM5ZYIcG6QgdscYugxcllsks5uZ6-qgaJpZM4Wfx43 .

timothyjamesbecker commented 5 years ago

Travis now supports Ubuntu 18.04 LTS via the bionic name, I just finished three .travis.xml builds.