1 2 Previous Next 24 Replies Latest reply on Jun 25, 2007 8:23 PM by abrante Go to original post
      • 15. Re: How to use makefile utility in Solaris
        807559
        And if you want to make it really perfect:

        The Sun Compiler does accept

        -R (for the location of the libs DURING RUN TIME)
        -L (for the location of the libs during COMPILE TIME)

        And the former then is the equivalent for

        LD_RUN_PATH

        Here's the output from man cc for Studio 11:

        -Ldir
        Adds dir to the list of directories searched for
        libraries by ld. This option and its arguments are
        passed to ld.

        Warnings

        Never specify the compiler installation area,
        /usr/include, /lib, /usr/lib, as search directories.

        -Rdir[:dir...]
        A colon-separated list of directories used to specify
        library search directories to the runtime linker. If
        present and not null, it is recorded in the output
        object file and passed to the runtime linker.

        If both LD_RUN_PATH and the -R option are specified,
        the -R option takes precedence.

        Sad enough, that gcc still doesn't know how to handle -R. I do prefer binaries, that DO know where to find THEIR shared libs, and don't need to be forced by GLOBAL ENVIRONMENT VARIABLES, that influence ALL apps started from that environment.

        Matthias
        • 16. Re: How to use makefile utility in Solaris
          alan.pae
          ugh, that gcc still doesn't know how to handle -R. I
          do prefer binaries, that DO know where to find THEIR
          shared libs, and don't need to be forced by GLOBAL
          ENVIRONMENT VARIABLES, that influence ALL apps
          started from that environment.
          I don't get this. I use LDFLAGS"-L -R" all the time and have never needed to set a Global Environment Variable to get the binaries to run, using gcc.

          alan
          • 17. Re: How to use makefile utility in Solaris
            807559
            Here's what gcc gives for me:

            [sr1-efra05-01: home/pfuetz] {396} % which gcc
            /usr/sfw/bin/gcc
            [sr1-efra05-01: home/pfuetz] {397} % gcc --version
            gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
            Copyright (C) 2004 Free Software Foundation, Inc.
            This is free software; see the source for copying conditions. There is NO
            warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

            [sr1-efra05-01: home/pfuetz] {398} % gcc --help
            Usage: gcc [options] file...
            Options:
            -pass-exit-codes Exit with highest error code from a phase
            --help                   Display this information
            --target-help            Display target specific command line options
            (Use '-v --help' to display command line options of sub-processes)
            -dumpspecs Display all of the built in spec strings
            -dumpversion Display the version of the compiler
            -dumpmachine Display the compiler's target processor
            -print-search-dirs Display the directories in the compiler's search path
            -print-libgcc-file-name Display the name of the compiler's companion library
            -print-file-name=<lib> Display the full path to library <lib>
            -print-prog-name=<prog> Display the full path to compiler component <prog>
            -print-multi-directory Display the root directory for versions of libgcc
            -print-multi-lib Display the mapping between command line options and
            multiple library search directories
            -print-multi-os-directory Display the relative path to OS libraries
            -Wa,<options> Pass comma-separated <options> on to the assembler
            -Wp,<options> Pass comma-separated <options> on to the preprocessor
            -Wl,<options> Pass comma-separated <options> on to the linker
            -Xassembler <arg> Pass <arg> on to the assembler
            -Xpreprocessor <arg> Pass <arg> on to the preprocessor
            -Xlinker <arg> Pass <arg> on to the linker
            -save-temps Do not delete intermediate files
            -pipe Use pipes rather than intermediate files
            -time Time the execution of each subprocess
            -specs=<file> Override built-in specs with the contents of <file>
            -std=<standard> Assume that the input sources are for <standard>
            -B <directory> Add <directory> to the compiler's search paths
            -b <machine> Run gcc for target <machine>, if installed
            -V <version> Run gcc version number <version>, if installed
            -v Display the programs invoked by the compiler
            -### Like -v but options quoted and commands not executed
            -E Preprocess only; do not compile, assemble or link
            -S Compile only; do not assemble or link
            -c Compile and assemble, but do not link
            -o <file> Place the output into <file>
            -x <language> Specify the language of the following input files
            Permissible languages include: c c++ assembler none
            'none' means revert to the default behavior of
            guessing the language based on the file's extension

            Options starting with -g, -f, -m, -O, -W, or --param are automatically
            passed on to the various sub-processes invoked by gcc. In order to pass
            other options on to these processes the -W<letter> options must be used.

            For bug reporting instructions, please see:
            <URL:http://gcc.gnu.org/bugs.html>.

            I do not see the "-R" option...

            and: "gcc -v --help" does list more options, but also, not a "-L" nor "-R"...

            And: "man gcc" provides:

            NAME
            gcc - GNU project C and C++ compiler

            SYNOPSIS
            gcc [-c|-S|-E] [-std=standard]
            [-g] [-pg] [-Olevel]
            [-Wwarn...] [-pedantic]
            [-Idir...] [-Ldir...]
            [-Dmacro[=defn]...] [-Umacro]
            [-foption...] [-mmachine-option...]
            [-o outfile] infile...

            Only the most useful options are listed here; see below for
            the remainder. g++ accepts mostly the same options as gcc.

            DESCRIPTION
            When you invoke GCC, it normally does preprocessing,
            compilation, assembly and linking. The ``overall options''
            allow you to stop this process at an intermediate stage.
            For example, the -c option says not to run the linker. Then
            the output consists of object files output by the assembler.

            That does list at least "-L"...

            That's, what I mean...

            Matthias

            P.S.: But, you might be right, it also does not show "-L", so it might well be, that it already knows, how to handle it... I do prefer sun studio, so I do not have that many experiences with gcc any more... ;-)
            • 18. Re: How to use makefile utility in Solaris
              alan.pae
              AS I Said, I use LDFLAGS"-L -R" to pass the flags to the linker.

              So that should be:

              man ld.

              Then you will see -L and -R. gcc is the compiler, ld is still the linker.

              alan
              • 19. Re: How to use makefile utility in Solaris
                abrante
                You should copy the config.h file from your libevent build directory to /usr/local/include.

                .7/M.
                • 20. Re: How to use makefile utility in Solaris
                  alan.pae
                  You should copy the config.h file from your libevent
                  build directory to /usr/local/include.
                  Why?

                  Why not just the pass the directory (if needed) as -I.

                  alan
                  • 21. Re: How to use makefile utility in Solaris
                    abrante
                    Hmm, in case he wants to build other things towards libevent and remove the build directory i guess..

                    .7/M.
                    • 22. Re: How to use makefile utility in Solaris
                      alan.pae
                      make install should put any needed header files in

                      <prefix>/lib/<project name if needed>/*.h

                      Then if you need them in the future and configure does not pick them up you could simply add them to the -I line in the Makefile or pass it on the command line,

                      gcc -I/usr/local/lib/libevent.h

                      and then the base OS remains the base OS and you can still build other apps using libevent.h if needed.

                      alan
                      • 23. Re: How to use makefile utility in Solaris
                        alan.pae
                        Sorry that should have been

                        <prefix>/include/<project name if needed>/*.h

                        alan
                        • 24. Re: How to use makefile utility in Solaris
                          abrante
                          .. and.. giving it a second thought, having an include file named 'config.h' can probably give odd side effects :-)

                          I guess he also could edit his event.h so that the u_int variables points to uint instead.. to follow Solaris standard..

                          .7/M.
                          1 2 Previous Next