bugGNUstep - Bugs: bug #35802, Linking Problems [libobjc2 1.6 +...

Group
 
 

bug #35802: Linking Problems [libobjc2 1.6 + clang trunk (152539) + Ubuntu 11.10]

Submitter:  lowell <lowellv>
Submitted:  Mon 12 Mar 2012 02:42:39 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Item Group:  Installation Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 15 Jun 2012 06:55:32 AM UTC, comment #2: 

Thank you Niels, using the regular makefile worked!

#35802 can be changed from 'Ready for test' to 'Closed'.

lowell <lowellv>
Wed 21 Mar 2012 01:26:56 PM UTC, comment #1: 

Hi,

when building libobjc2 with Makefile.clang, the `llc' tool is responsible for generating native code from the LLVM bitcodes generated by clang. So we needed to tell llc to build relocatable code. This should be fixed in trunk, but Makefile.clang still seems horribly out of date. But you should be able to build the library with `CC=clang make -f Makefile' as well.

Cheers,

Niels

Niels Grewe <thebeing>
Group Member
Mon 12 Mar 2012 02:42:39 PM UTC, original submission:  

Hello, all.

I am trying to build libobjc2 1.6 (from svn) using a recent build of clang (NSNumber, NSArray, NSDictionary and BOOL literals!!) on Ubuntu 11.10. It seems to compile fine, but when it gets to linking, this happens:

        /usr/bin/ld: libobjc.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
        libobjc.o: could not read symbols: Bad value

-fPIC is already specified among the CFLAGS on line 9 of the makefile.

This is a mostly-clean, fresh install of Ubuntu 11.10 in VMware Fusion 4. Mostly-clean because of the aforementioned Clang 3.1 installation, as well as compiler-rt (for libblocksruntime, also from trunk) and libdispatch (and its dependencies, libpthread_workqueue and libkqueue). There is no Objective-C runtime installed.

This is the build output in its entirety:

        lowell@ubuntu:/usr/src/libobjc2-1.6$ make -f Makefile.clang
        Compiling arc.m...
        In file included from arc.m:7:
        ./class.h:285:14: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                return obj->isa;
                            ^
        arc.m:159:19: warning: direct access to objective-c's isa is deprecated in favor
              of object_setClass() and object_getClass() [-Wdeprecated-objc-isa-usage]
                Class cls = obj->isa;
                                 ^
        arc.m:176:19: warning: direct access to objective-c's isa is deprecated in favor
              of object_setClass() and object_getClass() [-Wdeprecated-objc-isa-usage]
                Class cls = obj->isa;
                                 ^
        3 warnings generated.
        Compiling associate.m...
        In file included from associate.m:9:
        ./class.h:285:14: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                return obj->isa;
                            ^
        associate.m:186:19: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                Class cls = obj->isa;
                                 ^
        associate.m:225:47: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                Class hiddenClass = allocateHiddenClass(obj->isa);
                                                             ^
        associate.m:226:33: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                assert(!class_isMetaClass(obj->isa));
                                               ^
        /usr/include/assert.h:92:5: note: expanded from macro 'assert'
          ((expr)                                                               \
            ^
        associate.m:235:7: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                obj->isa = hiddenClass;
                     ^
        associate.m:255:32: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                if (class_isMetaClass(object->isa))
                                              ^
        associate.m:314:32: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                if (class_isMetaClass(object->isa))
                                              ^
        associate.m:318:22: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                Class cls = object->isa;
                                    ^
        associate.m:385:32: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                if (class_isMetaClass(object->isa))
                                              ^
        associate.m:387:18: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                        return object->isa;
                                       ^
        associate.m:423:40: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                id new = class_createInstance(object->isa, 0);
                                                      ^
        11 warnings generated.
        Compiling gc_none.c...
        Compiling NSBlocks.m...
        In file included from NSBlocks.m:2:
        ./class.h:285:14: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                return obj->isa;
                            ^
        1 warning generated.
        Compiling Protocol2.m...
        In file included from Protocol2.m:3:
        ./class.h:285:14: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                return obj->isa;
                            ^
        1 warning generated.
        Compiling abi_version.c...
        Compiling alias_table.c...
        Compiling blocks_runtime.m...
        Compiling caps.c...
        Compiling category_loader.c...
        Compiling class_table.c...
        Compiling dtable.c...
        Compiling eh_personality.c...
        In file included from eh_personality.c:4:
        ./dwarf_eh.h:160:8: warning: case value not in enumerated type
              'dwarf_data_encoding' [-Wswitch]
                        case DW_EH_PE_absptr:
                             ^
        1 warning generated.
        Compiling encoding2.c...
        Compiling hash_table.c...
        Compiling hooks.c...
        Compiling ivar.c...
        Compiling legacy_malloc.c...
        Compiling loader.c...
        Compiling mutation.m...
        Compiling properties.m...
        In file included from properties.m:7:
        ./class.h:285:14: warning: direct access to objective-c's isa is deprecated in
              favor of object_setClass() and object_getClass()
              [-Wdeprecated-objc-isa-usage]
                return obj->isa;
                            ^
        1 warning generated.
        Compiling protocol.c...
        Compiling runtime.c...
        Compiling sarray2.c...
        Compiling selector_table.c...
        Compiling sendmsg2.c...
        Compiling statics_loader.c...
        Compiling toydispatch.c...
        Linking bitcode...
        Generating native object code...
        Linking shared library...
        /usr/bin/ld: libobjc.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
        libobjc.o: could not read symbols: Bad value
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        make: * [libobjc.so.4] Error 1

And here is some compiler info, if needed:

        lowell@ubuntu:/usr/src$ clang --version
        clang version 3.1 (trunk 152539)
        Target: x86_64-unknown-linux-gnu
        Thread model: posix
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$ ll
        ll               llvm-cov         llvm-mc          llvm-size
        llc              llvm-diff        llvm-nm          llvm-stress
        lli              llvm-dis         llvm-objdump     llvm-stub
        llvm-ar          llvm-dwarfdump   llvm-prof        llvm-tblgen
        llvm-as          llvm-extract     llvm-ranlib     
        llvm-bcanalyzer  llvm-ld          llvm-readobj    
        llvm-config      llvm-link        llvm-rtdyld
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$
        lowell@ubuntu:/usr/src$ clang -arch x86_64 -dM -E - < /dev/null | sort
        clang: warning: argument unused during compilation: '-arch x86_64'
        #define __amd64 1
        #define _amd64_ 1
        #define __ATOMIC_ACQ_REL 4
        #define __ATOMIC_ACQUIRE 2
        #define __ATOMIC_CONSUME 1
        #define __ATOMIC_RELAXED 0
        #define __ATOMIC_RELEASE 3
        #define __ATOMIC_SEQ_CST 5
        #define _CHAR16_TYPE_ unsigned short
        #define _CHAR32_TYPE_ unsigned int
        #define _CHAR_BIT_ 8
        #define _clang_ 1
        #define _clang_major_ 3
        #define _clang_minor_ 1
        #define _clang_patchlevel_ 0
        #define _clang_version_ "3.1 ((trunk 152539))"
        #define _CONSTANT_CFSTRINGS_ 1
        #define _DBL_DENORM_MIN_ 4.9406564584124654e-324
        #define _DBL_DIG_ 15
        #define _DBL_EPSILON_ 2.2204460492503131e-16
        #define _DBL_HAS_DENORM_ 1
        #define _DBL_HAS_INFINITY_ 1
        #define _DBL_HAS_QUIET_NAN_ 1
        #define _DBL_MANT_DIG_ 53
        #define _DBL_MAX_10_EXP_ 308
        #define _DBL_MAX_ 1.7976931348623157e+308
        #define _DBL_MAX_EXP_ 1024
        #define _DBL_MIN_10_EXP_ (-307)
        #define _DBL_MIN_ 2.2250738585072014e-308
        #define _DBL_MIN_EXP_ (-1021)
        #define _DECIMAL_DIG_ 21
        #define _ELF_ 1
        #define _FINITE_MATH_ONLY_ 0
        #define _FLT_DENORM_MIN_ 1.40129846e-45F
        #define _FLT_DIG_ 6
        #define _FLT_EPSILON_ 1.19209290e-7F
        #define _FLT_EVAL_METHOD_ 0
        #define _FLT_HAS_DENORM_ 1
        #define _FLT_HAS_INFINITY_ 1
        #define _FLT_HAS_QUIET_NAN_ 1
        #define _FLT_MANT_DIG_ 24
        #define _FLT_MAX_10_EXP_ 38
        #define _FLT_MAX_ 3.40282347e+38F
        #define _FLT_MAX_EXP_ 128
        #define _FLT_MIN_10_EXP_ (-37)
        #define _FLT_MIN_ 1.17549435e-38F
        #define _FLT_MIN_EXP_ (-125)
        #define _FLT_RADIX_ 2
        #define _GNUC_ 4
        #define _GNUC_MINOR_ 2
        #define _GNUC_PATCHLEVEL_ 1
        #define _GNUC_STDC_INLINE_ 1
        #define _gnu_linux_ 1
        #define __GXX_ABI_VERSION 1002
        #define __GXX_RTTI 1
        #define _INT16_TYPE_ short
        #define _INT32_TYPE_ int
        #define _INT64_C_SUFFIX_ L
        #define _INT64_TYPE_ long int
        #define _INT8_TYPE_ char
        #define _INT_MAX_ 2147483647
        #define _INTMAX_MAX_ 9223372036854775807L
        #define _INTMAX_TYPE_ long int
        #define _INTMAX_WIDTH_ 64
        #define _INTPTR_TYPE_ long int
        #define _INTPTR_WIDTH_ 64
        #define __k8 1
        #define _k8_ 1
        #define _LDBL_DENORM_MIN_ 3.64519953188247460253e-4951L
        #define _LDBL_DIG_ 18
        #define _LDBL_EPSILON_ 1.08420217248550443401e-19L
        #define _LDBL_HAS_DENORM_ 1
        #define _LDBL_HAS_INFINITY_ 1
        #define _LDBL_HAS_QUIET_NAN_ 1
        #define _LDBL_MANT_DIG_ 64
        #define _LDBL_MAX_10_EXP_ 4932
        #define _LDBL_MAX_ 1.18973149535723176502e+4932L
        #define _LDBL_MAX_EXP_ 16384
        #define _LDBL_MIN_10_EXP_ (-4931)
        #define _LDBL_MIN_ 3.36210314311209350626e-4932L
        #define _LDBL_MIN_EXP_ (-16381)
        #define __linux 1
        #define _linux_ 1
        #define linux 1
        #define _LITTLE_ENDIAN_ 1
        #define _llvm_ 1
        #define _LONG_LONG_MAX_ 9223372036854775807LL
        #define _LONG_MAX_ 9223372036854775807L
        #define _LP64_ 1
        #define _LP64 1
        #define _MMX_ 1
        #define _NO_INLINE_ 1
        #define __NO_MATH_INLINES 1
        #define _POINTER_WIDTH_ 64
        #define __PRAGMA_REDEFINE_EXTNAME 1
        #define _PTRDIFF_TYPE_ long int
        #define _PTRDIFF_WIDTH_ 64
        #define _REGISTER_PREFIX_
        #define _SCHAR_MAX_ 127
        #define _SHRT_MAX_ 32767
        #define _SIG_ATOMIC_WIDTH_ 32
        #define _SIZEOF_DOUBLE_ 8
        #define _SIZEOF_FLOAT_ 4
        #define _SIZEOF_INT_ 4
        #define _SIZEOF_LONG_ 8
        #define _SIZEOF_LONG_DOUBLE_ 16
        #define _SIZEOF_LONG_LONG_ 8
        #define _SIZEOF_POINTER_ 8
        #define _SIZEOF_PTRDIFF_T_ 8
        #define _SIZEOF_SHORT_ 2
        #define _SIZEOF_SIZE_T_ 8
        #define _SIZEOF_WCHAR_T_ 4
        #define _SIZEOF_WINT_T_ 4
        #define _SIZE_TYPE_ long unsigned int
        #define _SIZE_WIDTH_ 64
        #define _SSE_ 1
        #define _SSE2_ 1
        #define _SSE2_MATH_ 1
        #define _SSE_MATH_ 1
        #define _STDC_ 1
        #define _STDC_HOSTED_ 1
        #define _STDC_VERSION_ 199901L
        #define _tune_k8_ 1
        #define _UINTMAX_TYPE_ long unsigned int
        #define __unix 1
        #define _unix_ 1
        #define unix 1
        #define _USER_LABEL_PREFIX_
        #define _VERSION_ "4.2.1 Compatible Clang 3.1 ((trunk 152539))"
        #define _WCHAR_MAX_ 2147483647
        #define _WCHAR_TYPE_ int
        #define _WCHAR_WIDTH_ 32
        #define _WINT_TYPE_ unsigned int
        #define _WINT_UNSIGNED_ 1
        #define _WINT_WIDTH_ 32
        #define __x86_64 1
        #define _x86_64_ 1
        lowell@ubuntu:/usr/src$

Can anyone point me in the right direction, please?

Thanks for your time.

lowell <lowellv>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25332:  clang-version.txt added by lowellv (5KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by thebeing (Posted a comment)
  • -email is unavailable- added by lowellv (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-15 thebeing StatusReady For Test Fixed
        Open/ClosedIn Test Closed
    2012-03-21 thebeing StatusNone Ready For Test
        Open/ClosedOpen In Test
    2012-03-12 lowellv Attached File- Added clang-version.txt, #25332
        Attached File- Added libobjc2@1.6-build-output.txt, #25333

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code