Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Cannot link C++ file in 12.1 X64bit SUSE

  1. #1

    Default Cannot link C++ file in 12.1 X64bit SUSE

    Hi,

    I install Linux SUSE 12.1 64-bit on my desktop. I find that a simple SystemC file cannot link in Eclipse although a simple C++ can pass. The difference between SystemC and C++ is that SystemC using a precompiled library libsystemc.a. The error message see below please. Could you give me some ideas on this problem? Thanks.




    ...............................

    **** Build of configuration Debug for project systemc_trivial ****

    make all
    Building target: systemc_trivial
    Invoking: GCC C++ Linker
    g++ -nostartfiles -nodefaultlibs -nostdlib -o "systemc_trivial" ./trivial.o -l\ /home/jeff/systemc-2.2.0/objdir/lib-linux64/libsystemc.a
    /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -l /home/jeff/systemc-2.2.0/objdir/lib-linux64/libsystemc.a
    collect2: ld returned 1 exit status
    make: *** [systemc_trivial] Error 1

    **** Build Finished ****

  2. #2

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Hi,

    Without space in the path of library still does not work. The message sees below. The default library is OK because no SystemC library works. Thanks.




    ...............................

    **** Build of configuration Debug for project systemc_trivial ****

    make all
    Building target: systemc_trivial
    Invoking: GCC C++ Linker
    g++ -nostartfiles -nodefaultlibs -nostdlib -o "systemc_trivial" ./trivial.o -l/home/jeff/systemc-2.2.0/objdir/lib-linux64/libsystemc.a
    /usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -l/home/jeff/systemc-2.2.0/objdir/lib-linux64/libsystemc.a
    collect2: ld returned 1 exit status
    make: *** [systemc_trivial] Error 1

    **** Build Finished ****

  3. #3
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Am 26.11.2011 21:06, schrieb freerjw:
    > -l/home/jeff/systemc-2.2.0/objdir/lib-linux64/libsystemc.a

    Try
    -L/home/jeff/systemc-2.2.0/objdir/lib-linux64 -lsystemc
    instead.


    --
    PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
    4.6.0 | GeForce GT 420 | 16GB Ram
    Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.7.3 |
    nVidia ION | 3GB Ram

  4. #4

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    The problem is that the small letter 'l' originates from Eclipse CDT. What option can alter that?


    BTW, in terminal, capital letter L does make link goes although there are many message echo on the screen I don't know why yet. The user C++ library is selected from

    GCC++Linker/Library dialogue box?


    Thanks.

  5. #5
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    On 11/26/2011 09:06 PM, freerjw wrote:

    >Error 1
    >
    > **** Build Finished ****


    this is your fifth post in the openSUSE applications forum....but, the
    errors you are encountering have nothing to do with either openSUSE or
    any application shipped with openSUSE..

    that is to say: no matter which Linux distribution you had selected to
    install, you would be having the same troubles..

    and in my opinion that is because you have not yet schooled yourself in
    the very fundamental basics of Linux..

    there are usually some folks around here who are willing to help folks
    get started on Linux....but, you hit the forums on a weekend...and, it
    is about my bed time, but i'll take the time to give you a reading list
    you can work though until a real guru with the patience to help you
    comes alone:

    http://doc.opensuse.org/

    http://tinyurl.com/3a5rong

    --
    DD http://tinyurl.com/DD-Caveat
    openSUSE®, the "German Engineered Automobiles" of operating systems!

  6. #6
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Am 26.11.2011 21:26, schrieb freerjw:
    >
    > The problem is that the small letter 'l' originates from Eclipse CDT.
    > What option can alter that?
    >

    I have no idea what project settings you use in eclipse so how should I
    know how to change it or what you change, it seems just that you do not
    know how to tell the IDE how to use a library.
    >
    > BTW, in terminal, capital letter L does make link goes although there
    > are many message echo on the screen I don't know why yet. The user C++
    > library is selected from
    >
    > GCC++Linker/Library dialogue box?

    Again no idea, because it heavily depends on the project settings you
    are using in eclipse and you do not tell us anything about it (custom
    Makefile, managed Makefile, autotools based project) what you have to do
    exactly.

    Please make yourself more familiar with the tools you use or add proper
    details about what you are doing. We do not sit in front of your machine
    and cannot see what you do and why.

    --
    PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
    4.6.0 | GeForce GT 420 | 16GB Ram
    Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.7.3 |
    nVidia ION | 3GB Ram

  7. #7

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Hi
    I met a samilar probelm when building kernel on opensuse 11.04 64bit os. It occured the below error messages:
    /usr/bin/ld cannot find -lc
    but I can find /usr/lib/libc.so and /usr/lib/libc.a, I donn't why, could andybody give me some feedback.

    thanks a lot

  8. #8
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Am 12.12.2011 12:16, schrieb richce:
    >
    > Hi
    > I met a samilar probelm when building kernel on opensuse 11.04 64bit
    > os. It occured the below error messages:
    > /usr/bin/ld cannot find -lc
    > but I can find /usr/lib/libc.so and /usr/lib/libc.a, I donn't why,
    > could andybody give me some feedback.
    >
    > thanks a lot
    >
    >

    gcc (which calls ld) links automatically against libc, where does your
    explicit -lc come from?
    Can you give us the complete command line used for your compilation step
    which fails?

    --
    PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
    4.6.0 | GeForce GT 420 | 16GB Ram
    Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.7.3 |
    nVidia ION | 3GB Ram

  9. #9

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Hi
    I intercept some logs about e2fsporgs building using uclibc toolchain, here is the logs:
    rpmbuild --dbpath /home/b35734//var/lib/rpm --target m68knommu --define '_unpackaged_files_terminate_build 0' --define '_target_cpu m68knommu' --define '__strip strip' --define '_topdir /home/b35734/rpm' --define '_prefix /usr' --define '_tmppath /home/b35734/tmp' --define '_rpmdir /home/b35734/rpm/RPMS' --define '_mandir /usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bc --short-circuit /home/b35734/dist/lfs-5.1/e2fsprogs/e2fsprogs.spec
    Building target platforms: m68knommu
    Building for target m68knommu
    Executing(%build): /bin/sh -e /home/b35734/tmp/rpm-tmp.42229
    + umask 022
    + cd /home/b35734/rpm/BUILD
    + cd e2fsprogs-1.41.4
    + '[' -n y ']'
    + extra_opts=--disable-tls
    + '[' m532xevb = host ']'
    + BUILD_CC='ccache /usr/bin/gcc -B/usr/bin/'
    + ./configure --host=m68k-uclinux --prefix=/usr/ --disable-tls
    configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
    Generating configuration file for e2fsprogs version 1.41.4
    Release date is January, 2009
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... m68k-unknown-uclinux
    CC defaults to gcc
    checking for m68k-uclinux-gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... yes
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -E
    LD defaults to ld
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking linux/fs.h usability... yes
    checking linux/fs.h presence... yes
    checking for linux/fs.h... yes
    checking for additional special compiler flags... (none)
    Disabling maintainer mode by default
    Disabling compression support by default
    Enabling htree directory support by default
    Disabling ELF shared libraries by default
    Disabling BSD shared libraries by default
    Disabling profiling libraries by default
    Disabling checker libraries by default
    Disabling journal debugging by default
    Disabling blkid debugging by default
    Enabling testio debugging by default
    Enabling debugfs support by default
    Enabling e2image support by default
    Enabling e2resize support by default
    Building fsck wrapper by default
    Building e2initrd helper by default
    Disabling thread local support
    Building uuidd by default
    checking whether make sets $(MAKE)... yes
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether NLS is requested... yes
    checking for msgfmt... /usr/bin/msgfmt
    checking for gmsgfmt... /usr/bin/msgfmt
    checking for xgettext... /usr/bin/xgettext
    checking for msgmerge... /usr/bin/msgmerge
    checking for m68k-uclinux-ranlib... m68k-uclinux-ranlib
    checking for strerror in -lcposix... no
    checking for an ANSI C-conforming const... yes
    checking for signed... yes
    checking for inline... inline
    checking for off_t... yes
    checking for size_t... yes
    checking for long long... yes
    checking for long double... yes
    checking for wchar_t... yes
    checking for wint_t... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for intmax_t... yes
    checking whether printf() supports POSIX/XSI format strings... guessing yes
    checking for working alloca.h... yes
    checking for alloca... yes
    checking for stdlib.h... (cached) yes
    checking for unistd.h... (cached) yes
    checking for getpagesize... yes
    checking for working mmap... no
    checking whether we are using the GNU C Library 2.1 or newer... yes
    checking whether integer division by zero raises SIGFPE... guessing yes
    checking for unsigned long long... yes
    checking for inttypes.h... yes
    checking whether the inttypes.h PRIxNN macros are broken... no
    checking for stdint.h... (cached) yes
    checking for SIZE_MAX... yes
    checking for stdint.h... (cached) yes
    checking for ld used by GCC... ld
    checking if the linker (ld) is GNU ld... yes
    checking for shared library run path origin... done
    checking for ptrdiff_t... yes
    checking argz.h usability... no
    checking argz.h presence... no
    checking for argz.h... no
    checking limits.h usability... yes
    checking for iconv... no, consider installing GNU libiconv
    checking for nl_langinfo and CODESET... yes
    checking for LC_MESSAGES... yes
    checking for bison... bison
    checking version of bison... 2.3, ok
    checking whether NLS is requested... yes
    checking whether included gettext is requested... no
    checking for GNU gettext in libc... no
    checking for GNU gettext in libintl... no
    checking whether to use NLS... yes
    checking where the gettext function comes from... included intl directory
    checking whether make sets $(MAKE)... (cached) yes
    checking for ln... /bin/ln
    checking whether ln -s works... yes
    checking for mv... /bin/mv
    checking for cp... /bin/cp
    checking for rm... /bin/rm
    checking for chmod... /bin/chmod
    checking for gawk... gawk
    checking for egrep... (cached) /usr/bin/grep -E
    checking for sed... /usr/bin/sed
    checking for perl... /usr/bin/perl
    checking for ldconfig... :
    checking for m68k-uclinux-ar... ar
    checking for m68k-uclinux-ranlib... (cached) m68k-uclinux-ranlib
    checking for m68k-uclinux-strip... m68k-uclinux-strip
    checking for makeinfo... makeinfo
    checking for a BSD-compatible install... /usr/bin/install -c
    checking for gcc... ccache /usr/bin/gcc -B/usr/bin/
    checking dirent.h usability... yes
    checking dirent.h presence... yes
    checking for dirent.h... yes
    checking setjmp.h usability... yes
    checking setjmp.h presence... yes
    checking for setjmp.h... yes
    checking signal.h usability... yes
    checking sys/sysmacros.h presence... yes
    checking for sys/sysmacros.h... yes
    checking sys/time.h usability... yes
    checking sys/time.h presence... yes
    checking for sys/time.h... yes
    checking for sys/types.h... (cached) yes
    checking for socket in -lsocket... no
    checking for dlopen in -ldl... no
    checking for optreset... no
    checking for sem_init... no
    checking for sem_init in -lpthread... yes
    checking for unified diff option... -u
    checking whether linker accepts -static... yes
    configure: creating ./config.status
    config.status: creating MCONFIG
    config.status: creating Makefile
    config.status: creating e2fsprogs.spec
    config.status: creating util/Makefile
    config.status: creating util/subst.conf
    config.status: creating util/gen-tarball
    config.status: creating lib/et/Makefile
    config.status: creating lib/ss/Makefile
    config.status: creating lib/e2p/Makefile
    config.status: creating lib/ext2fs/Makefile
    config.status: creating lib/ext2fs/ext2_types.h
    config.status: creating lib/uuid/Makefile
    config.status: creating lib/uuid/uuid_types.h
    config.status: creating lib/blkid/Makefile
    config.status: creating lib/blkid/blkid_types.h
    config.status: creating lib/ss/ss.pc
    config.status: creating lib/uuid/uuid.pc
    config.status: creating lib/et/com_err.pc
    config.status: creating lib/e2p/e2p.pc
    config.status: creating lib/blkid/blkid.pc
    config.status: creating lib/ext2fs/ext2fs.pc
    config.status: creating misc/Makefile
    config.status: creating ext2ed/Makefile
    config.status: creating e2fsck/Makefile
    config.status: creating debugfs/Makefile
    config.status: creating tests/Makefile
    config.status: creating tests/progs/Makefile
    config.status: creating resize/Makefile
    config.status: creating doc/Makefile
    config.status: creating intl/Makefile
    config.status: creating po/Makefile.in
    config.status: executing default-1 commands
    config.status: creating po/POTFILES
    config.status: creating po/Makefile
    + make
    cd ./util ; make subst
    make[1]: Entering directory `/home/b35734/rpm/BUILD/e2fsprogs-1.41.4/util'
    LD subst
    /usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
    /usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
    /usr/bin/ld: cannot find -lc
    collect2: ld returned 1 exit status

    I really had no idea about it, hopefully anyone can help me.
    thanks
    rich

  10. #10

    Default Re: Cannot link C++ file in 12.1 X64bit SUSE

    Hi
    Maybe I find the reason, when I building micwindows , and it failed because of "missed stubs-32.h", after I setuped glibc-devel.i686 and micwindows can build successfully, but it caused e2fsporgs and kernel builed failed. And I had tested it if didn't setup glibc-devel.i686, the kernel and e2fsprogs could be ok. I had no idea, so strange.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •