GithubHelp home page GithubHelp logo

adacore / gnatcoll-bindings Goto Github PK

View Code? Open in Web Editor NEW
13.0 35.0 17.0 7.99 MB

GNAT Components Collection – Bindings to C libraries

License: Other

Python 6.66% Ada 87.53% C 4.30% Makefile 0.39% C++ 1.13%

gnatcoll-bindings's Issues

Pull requests temporarily on hold

Dear contributors,

Following the switch to modular organization, we are working on the testsuite refactoring. Before the testsuite is in place we can't accept pull requests.

We apologize in advance, and thank you for your patience!

Compiling Issue

I'm getting this error
hon_support.o: relocation R_X86_64_PC32 against symbol init_user_module can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status gprlib: /usr/bin/gcc execution error gprbuild: could not build library for project gnatcoll_python process failed with status: 4 ==> ERROR: A failure occurred in build().

Specific include path is missing for gmp.h.

Hello,
If gmp.h is not in standard include path, how to add a specific include path with setup.py?

As a workaround, I added the gmp include path in gpr file:

--- a/gmp/gnatcoll_gmp.gpr
+++ b/gmp/gnatcoll_gmp.gpr
@@ -58,7 +58,7 @@ project GnatColl_GMP is
for Switches ("Ada") use
("-g", "-O0", "-gnata", "-gnatVa", "-gnatQ", "-gnaty", "-gnateE",
"-gnatwaCJe", "-fstack-check");
- for Switches ("C") use ("-g", "-Wunreachable-code");
+ for Switches ("C") use ("-g", "-Wunreachable-code", "-I/usr/local/xnadalib-2018/include");
when "PROD" =>
-- Do not use -gnatwe for production mode

Thanks, Pascal.

Clash between legal *BUILD values here & in installed projects

I wanted a debug build for python3, and failed to spot that the way to get it is to reconfigure for debug (I’m using a Python 3.8 virtual environment):

python setup.py build --reconfigure --debug

On the way, having seen this in gnatcoll_python.gpr

   type Build_Type is ("DEBUG", "PROD");
   Build : Build_Type :=
       External ("GNATCOLL_BUILD", External ("BUILD", "PROD"));

I tried setting GNATCOLL_BUILD to DEBUG, which resulted in

gnatcoll_python.gpr:58:10: warning: no when others for this case construction
gnatcoll.gpr:12:04: value "DEBUG" is illegal for typed string "build"

because the installed gnatcoll.gpr says

library project GnatColl is
   type BUILD_KIND is ("static", "relocatable", "static-pic");
   BUILD : BUILD_KIND := external("GNATCOLL_CORE_BUILD", external("GNATCOLL_BUILD", external("LIBRARY_TYPE", "static")));

which results from the way the Makefile calls gprinstall.

I get the impression from the gprinstall documentation that it only supports one scenario variable?

Libiconv issues.

Some Libiconv implementions define symbols such as iconv_open whereas others define libiconv_open.
Currently GNATColl-iconv use iconv_open style in binding support, for instance:

void *gnatcoll_iconv_open(char *tocode, char *fromcode){
  iconv_t res = iconv_open(tocode, fromcode);
  return (res == (iconv_t) -1) ? NULL : res;
}

As it was formerly explained in documentation:

If your application depends on having a working libiconv, you can specify –with-iconv or –with-iconv=PATH to GNATCOLL’s configure.

But configure is no more present.

How can I use Libiconv library with libiconv_open style?

python3/setup.py build fails with undefined Py_TPFLAGS_HAVE_VECTORCALL

Mac OSX 10.13.6
Xcode 10.1
GNAT Community 2021 (20210519)

My attempt to compile Python3 python_support.c failed with:

MacBook-Air:gnatcoll-bindings-23.0.0 rogermcmurtrie$ python3/setup.py build
Launch: /opt/gnat-ce-2021/bin/gprbuild -j0 -p -gargs -P/Ada_Source/gnatcoll-bindings-23.0.0/python3/gnatcoll_python.gpr --relocate-build-tree --target=x86_64-darwin -XGNATCOLL_PYTHON_STATIC_LIB=/Users/rogermcmurtrie/.pyenv/versions/3.8.6/lib/python3.8/config-3.8-darwin/libpython3.8.a -XGNATCOLL_PYTHON_LIBS=-lintl -ldl   -framework CoreFoundation -XGNATCOLL_LIBPYTHON_KIND=static -XGNATCOLL_PYTHON_CFLAGS=-I/Users/rogermcmurtrie/.pyenv/versions/3.8.6/include/python3.8 -I/Users/rogermcmurtrie/.pyenv/versions/3.8.6/include/python3.8 -XGNATCOLL_VERSION=0.0 -XBUILD=PROD -XGNATCOLL_OS=osx -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static
Compile
   [C]            python_support.c
   [Ada]          gnatcoll-python-ctypes.ads
   [Ada]          gnatcoll-scripts-python.adb
   [Ada]          gnatcoll-python-errors.ads
   [Ada]          gnatcoll-python-exceptions.ads
   [Ada]          gnatcoll-python.adb
/Ada_Source/gnatcoll-bindings-23.0.0/python3/python_support.c: In function 'PyDescr_NewAdaMethod':
/Ada_Source/gnatcoll-bindings-23.0.0/python3/python_support.c:251:33: error: 'Py_TPFLAGS_HAVE_VECTORCALL' undeclared (first use in this function); did you mean 'Py_TPFLAGS_HAVE_VERSION_TAG'?
  251 |         Py_TPFLAGS_DEFAULT && !(Py_TPFLAGS_HAVE_VECTORCALL);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                 Py_TPFLAGS_HAVE_VERSION_TAG
/Ada_Source/gnatcoll-bindings-23.0.0/python3/python_support.c:251:33: note: each undeclared identifier is reported only once for each function it appears in
   compilation of python_support.c failed

Specific compiler option on build command.

Hello,
How to add a specific compiler option with "setup.py build"?
(without change in GPR files)
For instance I want to add "-gnatwn" option (in order to cancel "-gnatwaCJe" effects).
Thanks, Pascal.

Test iconv__iconv1 FAILED: Test character for which there is no transliteration

Hi, I'm attempting to run the test suite here and I'm seeing one failure in the iconv tests. Everything else passes.

This is using glibc 2.39, with the following locales enabled:

C.UTF8 UTF-8
en_US.UTF-8 UTF-8

The failing test is:

INFO     Found 5 tests
INFO     PASS            iconv__bad_charset
INFO     FAIL            iconv__iconv1: command call fails
_Status code: 0
_Output:
_Setup
_   [mkdir]        object directory for project Test
_test.gpr:9:09: warning: there are no sources of language "C" in this project
_Compile
_   [Ada]          test.adb
_   [Ada]          test_assert.adb
_Bind
_   [gprbind]      test.bexch
_   [Ada]          test.ali
_Link
_   [link]         test.adb
_Status code: 1
_Output:
_test.adb:29: PASSED: simple test
_test.adb:30: PASSED:
_test.adb:31: PASSED:
_test.adb:33: PASSED:
_test.adb:37: PASSED:
_test.adb:40: PASSED:
_test.adb:44: PASSED: Test transliteration on ellipsis
_test.adb:52: PASSED: Test UTF-8 to ASCII of ellipsis without transliteration
_test.adb:61: FAILED: Test character for which there is no transliteration
_iconv( 199 130 65, to_code => ASCII, from_code => UTF-8, transliteration => TRUE, ignore => TRUE
_- expect:  65
_- got:  63 65
_<=== TEST FAILED ===>
_
INFO     PASS            omp__sort
INFO     PASS            gmp
INFO     PASS            coders
INFO     Summary:
_  PASS         4
_  FAIL         1

Problem building python/

On Darwin (El Capitan; High Sierra), can’t build the relocatable library. This is [2c426fe].

With FSF GCC 8.0.1 (the only compiler I have with gnatcoll-core installed), I see

$ setup.py build
Fetch Python information...
  Python version:          2.7
  Static dir               /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
  Shared dir               /System/Library/Frameworks/Python.framework/Versions/2.7/lib
  CFLAGS                   -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
  Shared linker flags      -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib -lpython2.7 -ldl  -framework CoreFoundation
  Static linker flags      /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.a -ldl  -framework CoreFoundation
Force link to static python library
Libraries kind             static, static-pic, relocatable
Version                    0.0
Build mode                 PROD
[...]
Launch: /opt/gcc-8.0.1/bin/gprbuild -j0 -p -Pgnatcoll_python.gpr --target=x86_64-darwin -XGNATCOLL_LIBPYTHON_KIND=static -XGNATCOLL_OS=osx -XGNATCOLL_PYTHON_LIBS=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.a -ldl  -framework CoreFoundation -XBUILD=PROD -XGNATCOLL_VERSION=0.0 -XGNATCOLL_PYTHON_CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -XLIBRARY_TYPE=relocatable -XGPR_BUILD=relocatable -XXMLADA_BUILD=relocatable
Compile
   [C]            python_support.c
   [Ada]          gnatcoll-any_types-python.adb
   [Ada]          gnatcoll-scripts-python.adb
   [Ada]          gnatcoll-python.adb
Build Libraries
   [gprlib]       gnatcoll_python.lexch
   [link library] libgnatcoll_python.dylib
Undefined symbols for architecture x86_64:
  "_PyArg_ParseTuple", referenced from:
      _ada_py_arg_parsetuple_ptr in python_support.o
      _ada_py_arg_parsetuple_ptr2 in python_support.o
      _ada_py_arg_parsetuple_ptr3 in python_support.o
      _ada_py_arg_parsetuple_ptr4 in python_support.o
      _ada_py_arg_parsetuple_ptr5 in python_support.o
[...]

This is because of -XGNATCOLL_LIBPYTHON_KIND=static.

I tried setup.py build --enable-shared,

$ ./setup.py build --enable-shared
Launch: /opt/gcc-8.0.1/bin/gprbuild -j0 -p --enable-shared -Pgnatcoll_python.gpr --target=x86_64-darwin -XGNATCOLL_LIBPYTHON_KIND=static -XGNATCOLL_PYTHON_CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -XGNATCOLL_PYTHON_LIBS=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.a -ldl  -framework CoreFoundation -XBUILD=PROD -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=osx -XLIBRARY_TYPE=static -XGPR_BUILD=static -XXMLADA_BUILD=static
gprbuild: illegal option "--enable-shared" on the command line
process failed with status: 4

I edited setup.json to set "GNATCOLL_LIBPYTHON_KIND": "shared": now the build succeeds.

setup.py:92 and :97 imply that --enable-shared should be supported.
Alternatively, what about adding system.platform.startswith("darwin") to that check?


Having made this workround, the shared build is OK but I now find this failure:

$ gprbuild -XLIBRARY_TYPE=static 
using project file check_build.gpr
Compile
   [Ada]          check_build.adb
Bind
   [gprbind]      check_build.bexch
   [Ada]          check_build.ali
Link
   [link]         check_build.adb
Undefined symbols for architecture x86_64:
  "_PyArg_ParseTuple", referenced from:
      _ada_py_arg_parsetuple_ptr in libgnatcoll_python.a(python_support.o)
[...]

which can itself be worked round by

$ gprbuild -XLIBRARY_TYPE=static -largs -lpython

or

$ gprbuild -XLIBRARY_TYPE=static -XGNATCOLL_PYTHON_LIBS=-lpython

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.