Giter Club home page Giter Club logo

Comments (9)

urschrei avatar urschrei commented on July 22, 2024

Just to confirm:

  • you can't reproduce the error on earlier versions of Ubuntu, using the same coordinate
  • you can't reproduce the error on Ubuntu 16.04, using different coordinates
  • you can't reproduce the error on Ubuntu 16.04 using e.g.
    convert_bng([-7.30034511], [49.95888852])

from convertbng.

chongyangshi avatar chongyangshi commented on July 22, 2024

Just checked:

  • convert_lonlat as used below works fine on my Ubuntu 14.04 64bit.
  • a different BNG coordinate such as (315877,781709) still triggers the illegal instruction on Ubuntu 16.04.
  • your convert_bng example works (fine?) on this Ubuntu 16.04, returning ([nan], [nan]).

With this:

from convertbng.util import convert_lonlat, convert_bng
from numpy import isnan

def bng_to_longlat(bng):
    """ Given a pair of BNG coordinates return its long and lat coordinates. """
    
    try:
        easting = [int(bng[0])]
        northing = [int(bng[1])]
        coordinates = convert_lonlat(easting, northing)
        coordinate_long = coordinates[0][0]
        coordinate_lat = coordinates[1][0]

        if isnan(coordinate_long) or isnan(coordinate_lat):
            return False

        return (coordinate_long, coordinate_lat)
        
    except ValueError:
        return False

#print bng_to_longlat((20000,20000))
#print bng_to_longlat((315877,781709))
print convert_bng([-7.30034511], [49.95888852])

from convertbng.

urschrei avatar urschrei commented on July 22, 2024

Hmmm that's extremely confusing. If you change your import to
from convertbng.cutil import convert_lonlat
is the error triggered?

from convertbng.

chongyangshi avatar chongyangshi commented on July 22, 2024

With convertbng.cutil, convert_lonlat still causes Illegal Instruction while convert_bng still seems to work.

As the library was simply installed by doing pip install convertbng under the virtualenv from the preloaded python 2.7 of the distribution, could this be an issue with rustc and this particular CPU?

I think I'll try deploying it in a 16.04 VM at some time, just in case it's the CPU.

from convertbng.

urschrei avatar urschrei commented on July 22, 2024

If it's an x86 CPU, there's no reason it shouldn't work, although a dump of the system info might help. I haven't had a chance to try to reproduce this using 16.04 yet.

from convertbng.

chongyangshi avatar chongyangshi commented on July 22, 2024

Just tested the same code in a KVM VPS running 16.04 64bit, and it worked without issue. Therefore it is highly likely that something does not sing well between i5-3570S and Rust.

I'll find some time to look into this weird thing, thanks for your time.

from convertbng.

chongyangshi avatar chongyangshi commented on July 22, 2024

Okay, thanks for patching up the other repo. I have built a new liblonlat_bng.so from lonlat_bng, replaced the rust binary that pip installed ({virtualenv environment}/lib/python2.7/site-packages/convertbng/.libs/liblonlat_bng-783571af.so) with liblonlat_bng.so generated in lonlat_bng/target/release/liblonlat_bng.so , and run the Python script again. It worked.

As the liblonlat_bng-783571af.so binary from PyPI version 5.5 is still broken for this processor, I wonder if it is suitable to rebuild a binary and push to PyPI?

Thanks a lot for the assistance.

from convertbng.

urschrei avatar urschrei commented on July 22, 2024

from convertbng.

chongyangshi avatar chongyangshi commented on July 22, 2024

I totally understand. For something as strange as this, it is unlikely that a build tool can guarantee something working on this processor. I am however happy to test any binary coming out of manylinux.

The working binary can be found at https://mega.nz/#!0U9kQAab!2QYUjK6yRyZ837EMzD_N4xM1s9W4ZrLRSN4hYikrgWw for your inspection.

Cheers.

from convertbng.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.