This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/34358] New: Dynamic library created in Object_Dir instead of Library_Dir in *-darwin*
- From: "bechir dot zalila at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Dec 2007 13:47:59 -0000
- Subject: [Bug ada/34358] New: Dynamic library created in Object_Dir instead of Library_Dir in *-darwin*
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
I've found the following bug in GNAT when building dynamic libraries using
project files:
Ada spec (p.ads)
================
package P is
procedure Dummy;
end P;
Ada body (p.adb)
================
package body P is
-----------
-- Dummy --
-----------
procedure Dummy is
begin
null;
end Dummy;
end P;
Project file (lib_project.gpr)
===========================
project Lib_Project is
for Source_Files use ("p.ads", "p.adb");
for Library_Name use "my_lib";
for Library_Dir use "./libs";
for Object_Dir use "./objects";
for Library_Kind use "relocatable";
end Lib_Project;
Command:
=========
% gnatmake -p -P lib_project.gpr
% ls objects libs
Expected behavior:
==================
% gnatmake -p -P lib_project.gpr
object directory "/Volumes/Stock/Dev/gnat_bug_report/./objects" created
library directory "/Volumes/Stock/Dev/gnat_bug_report/./libs" created
gcc -c -fPIC -I- -gnatA /Volumes/Stock/Dev/gnat_bug_report/p.adb
building relocatable library for project lib_project
/Volumes/Stock/Dev/gcc-4.3_trunk/bin/gcc -dynamiclib -o
/Volumes/Stock/Dev/gnat_bug_report/libs/libmy_lib.dylib
-L/Volumes/Stock/Dev/gcc-4.3_trunk/lib/gcc/i686-apple-darwin8/4.3.0/adalib/
-fPIC
-L/Volumes/Stock/Dev/gcc-4.3_trunk/lib/gcc/i686-apple-darwin8/4.3.0/adalib/
-lgnat-4.3 -Wl,-flat_namespace -shared-libgcc
/Volumes/Stock/Dev/gnat_bug_report/objects/p.o
/usr/bin/ld: warning can't open dynamic library: /libgcc_s.1.dylib referenced
from:
/Volumes/Stock/Dev/gcc-4.3_trunk/lib/gcc/i686-apple-darwin8/4.3.0/adalib//libgnat-4.3.dylib
(checking for undefined symbols may be affected) (No such file or directory,
errno = 2)
[The warning issued by the linker here is another independant bug (see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30572)]
% ls objects libs
libs:
libmy_lib.dylib p.ali
objects:
p.ali p.o
Actual behavior:
================
% gnatmake -p -P lib_project.gpr
object directory "/Volumes/Stock/Dev/gnat_bug_report/./objects" created
library directory "/Volumes/Stock/Dev/gnat_bug_report/./libs" created
gcc -c -fPIC -I- -gnatA /Volumes/Stock/Dev/gnat_bug_report/p.adb
building relocatable library for project lib_project
/Volumes/Stock/Dev/gcc-4.3_trunk/bin/gcc -dynamiclib -o libmy_lib.dylib
-L/Volumes/Stock/Dev/gcc-4.3_trunk/lib/gcc/i686-apple-darwin8/4.3.0/adalib/
-fPIC
-L/Volumes/Stock/Dev/gcc-4.3_trunk/lib/gcc/i686-apple-darwin8/4.3.0/adalib/
-lgnat-4.3 -Wl,-flat_namespace -shared-libgcc
/Volumes/Stock/Dev/gnat_bug_report/objects/p.o
/usr/bin/ld: warning can't open dynamic library: /libgcc_s.1.dylib referenced
from:
/Volumes/Stock/Dev/gcc-4.3_trunk/lib/gcc/i686-apple-darwin8/4.3.0/adalib//libgnat-4.3.dylib
(checking for undefined symbols may be affected) (No such file or directory,
errno = 2)
% ls objects libs
libs:
p.ali
objects:
libmy_lib.dylib p.ali p.o
The library file libmy_lib.dylib is created in the object directory. This
causes a problem if we want to link against this library...
The attached patch fixes this problem.
Here is my system configuration:
* the exact version of GCC, as shown by "gcc -v";
Using built-in specs.
Target: i686-apple-darwin8
Configured with: ../gcc_trunk/configure --disable-nls
--prefix=/Volumes/Stock/dev/gcc-4.3_trunk --host=i686-apple-darwin8
--target=i686-apple-darwin8 --build=i686-apple-darwin8 --enable-languages=c,ada
--with-gmp=/opt/local
Thread model: posix
gcc version 4.3.0 20071206 (experimental) (GCC)
* the system type (uname -a);
Darwin xxxxxxxxx.xxxx.xx 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10
18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
* the options when GCC was configured/built;
../gcc_trunk/configure --disable-nls --prefix=/Volumes/Stock/dev/gcc-4.3_trunk
--host=i686-apple-darwin8 --target=i686-apple-darwin8
--build=i686-apple-darwin8 --enable-languages=c,ada --with-gmp=/opt/local
--
Summary: Dynamic library created in Object_Dir instead of
Library_Dir in *-darwin*
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bechir dot zalila at gmail dot com
GCC build triplet: i686-apple-darwin8
GCC host triplet: i686-apple-darwin8
GCC target triplet: i686-apple-darwin8
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34358