Bug 853866

Summary: Libraries built with GPRbuild 2011 don't initialize.
Product: [Fedora] Fedora Reporter: Björn Persson <bjorn>
Component: gprbuildAssignee: Pavel Zhukov <pavel>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: pavel
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-19 05:58:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test case none

Description Björn Persson 2012-09-03 07:45:56 UTC
Description of problem:
Shared libraries built with GPRbuild 2011 don't initialize and finalize themselves properly. The bug seems to be gone in GPRbuild 2012.

Version-Release number of selected component (if applicable):
2011-4.fc17

How reproducible:
Always.

Steps to Reproduce:
1. Check out zlib-ada from Fedora's Git.
2. Edit the spec to use GPRbuild instead of Gnatmake.
3. Build the package locally and install it.
4. Compile and run one of the demo programs in /usr/share/doc/zlib-ada-devel-*.

Actual results:
All the demo programs raise Zlib_Error because ZLib.Thin.ZLIB_VERSION is uninitialized.

Expected results:
The demo programs work as they should when the library has been compiled with Gnatmake or GPRbuild 2012.

Comment 1 Pavel Zhukov 2012-09-10 17:57:03 UTC
I've added 
   package Linker is
          for Linker_Options use ("-lz");
   end Linker;
to zlib_ada.gpr and recompliled it with gprbuild and then successfully compiled samples
without linker_options I can compile sample with -largs -lz option

$ cat test.gpr 
with "directories";
with "zlib_ada";
project Test is 
    for Main use ("read");
end Test;


$ gprbuild -Ptest  -f 
gcc -c read.adb
gprbind read.bexch
gnatbind read.ali
gcc -c b__read.adb
gcc read.o -lz -o read


$ ./read 
ZLib 1.2.5
Level =-1 100000 -> 8837
Level = 0 100000 -> 100026
Level = 1 100000 -> 9044
Level = 2 100000 -> 9044
Level = 3 100000 -> 9044
Level = 4 100000 -> 8837
Level = 5 100000 -> 8837
Level = 6 100000 -> 8837
Level = 7 100000 -> 8837
Level = 8 100000 -> 8837
Level = 9 100000 -> 8837


gprbuild-2011-4.fc17.x86_64

Comment 2 Björn Persson 2012-11-18 14:26:47 UTC
Created attachment 647184 [details]
test case

I finally got around to writing a test case for this. Unpack the tarball and run the script "run". This is what I get in Fedora 17 with GPRbuild 2011:

Testing initialization of a shared library built with gnatmake:
-a passed to gnatbind: Yes.
"inittestlibinit" mentioned in relocation section: Yes.
Inittestlib is being elaborated.
Global: 2012
Local:  2012
Test PASSED.
Testing initialization of a shared library built with gprbuild:
-a passed to gnatbind: No.
"inittestlibinit" mentioned in relocation section: No.
Global: 0
Local:  2012
Test FAILED.

After installing GPRbuild 2012 I get this:

Testing initialization of a shared library built with gnatmake:
-a passed to gnatbind: Yes.
"inittestlibinit" mentioned in relocation section: Yes.
Inittestlib is being elaborated.
Global: 2012
Local:  2012
Test PASSED.
Testing initialization of a shared library built with gprbuild:
-a passed to gnatbind: Yes.
"inittestlibinit" mentioned in relocation section: Yes.
Inittestlib is being elaborated.
Global: 2012
Local:  2012
Test PASSED.

So, can we hope to see GPRbuild 2012 in Fedora 19?

Comment 3 Pavel Zhukov 2012-12-17 08:38:52 UTC
I've built gprbuild 2012 in rawhide. 

The tests from your attachment completed and passed with Gprbuild-2012. Please test.

Comment 4 Björn Persson 2012-12-18 19:13:40 UTC
I have tested gprbuild-2012-2 on Thulsadoom (Kevin Fenzi's Rawhide test server), and confirmed that this problem is gone.