LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to create *.tar.gz to install free software from C/C++ code (http://www.linuxquestions.org/questions/programming-9/how-to-create-%2A-tar-gz-to-install-free-software-from-c-c-code-4175420199/)

greendream 08-03-2012 10:42 AM

How to create *.tar.gz to install free software from C/C++ code
 
Hi everybody !

I have just written a simple program to Merge & Split file run in terminal. It very cool and easy to use so I want make a file *.tar.gz to share for my friends for free under GPL license and they can install with the command:

Quote:

$ ./configure
$ make
$ make install

My computer use Fedora17-i686-KDE, Kernel Linux 3.4.6-2
I use GNU autotool and installed autotoolset-0.11.3-1.i386.rpm, autoconf, automake, libtool and use acmkdir to create a standard install package but it not run.


I do that follow manual here:
I don't know it wrong/mistake at what step ?

And I know If add option -D_FILE_OFFSET_BITS=64 at option for gcc look like:
$ gcc -D_FILE_OFSET_BITS=64 *.c *.h -o MSF
I will handle lager file upto 2GB but when auto compile at destination computer how I do it.

Please help me, thank so much !


My code include 7 files:
Quote:

MSF.c -It contains main() method
agent.h -It assigns all struct enum and some method for split and merge file
agent.c -It contains full method in agent.h
split.h -It assigns Split() method
split.c -It contains full method in split.h
merge.h -It assigns Merge() method
merge.c -It contains full method in merge.h
And link to my sources code here.

After run
$ acmkdir MSF

I get a set of file, directory in /MSF directory:
Quote:

[LeAnh@LeAnh MSF]$ ls -l
total 56
-rw-rw-r--. 1 LeAnh LeAnh 126 Aug 3 21:06 AUTHORS
drwxr-xr-x. 2 root root 4096 Aug 3 20:43 autom4te.cache
-rw-rw-r--. 1 LeAnh LeAnh 0 Aug 3 21:06 ChangeLog
-rw-rw-r--. 1 LeAnh LeAnh 754 Aug 3 21:07 configure.ac
-rw-rw-r--. 1 LeAnh LeAnh 17982 Aug 3 21:06 COPYING
lrwxrwxrwx. 1 LeAnh LeAnh 36 Aug 3 21:06 INSTALL -> /usr/share/autotools/new_install.txt
-rw-rw-r--. 1 LeAnh LeAnh 536 Aug 3 21:06 Makefile.am
-rw-rw-r--. 1 LeAnh LeAnh 875 Aug 3 21:06 NEWS
-rw-rw-r--. 1 LeAnh LeAnh 243 Aug 3 21:06 README.in
-rwxrw-r--. 1 LeAnh LeAnh 687 Aug 3 21:06 reconf
drwxrwxr-x. 2 LeAnh LeAnh 4096 Aug 3 21:07 src
-rw-rw-r--. 1 LeAnh LeAnh 298 Aug 3 21:06 THANKS
File /MSF/configure.ac contain:
Quote:

AC_INIT(MSF,0.0.1)
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE

LF_CONFIGURE_CC
LF_CONFIGURE_CXX
LF_HOST_TYPE
LF_SET_WARNINGS
AC_PROG_RANLIB

AC_CONFIG_FILES([
Makefile
README
doc/Makefile
m4/Makefile
src/Makefile
])
AC_OUTPUT
File /MSF/Makefile.am contain:
Quote:

EXTRA_DIST = reconf configure
SUBDIRS = m4 src doc
And then I copy my code into /MSF/src directory. I changed /MSF/src/Makefile.am it look like:
Quote:

bin_PROGRAMS = MSF
MSF_SOURCES = MSF.c agent.h agent.c split.h split.c merge.h merge.c
And change directory to /MSF then run:
$ ./reconf
To launch scrip in file reconf:
Quote:

#!/bin/sh
rm -f config.cache
rm -f acconfig.h
echo "- aclocal."
aclocal -I m4
echo "- autoconf."
autoconf
echo "- acconfig."
acconfig
echo "- autoheader."
autoheader
echo "- automake."
automake -a
exit
But I get many errors and warnings:

Quote:

- aclocal.
/usr/share/aclocal/lf_x11.m4:33: warning: underquoted definition of LF_PATH_XLIB
/usr/share/aclocal/lf_x11.m4:33: run info '(automake)Extending aclocal'
/usr/share/aclocal/lf_x11.m4:33: or see http://www.gnu.org/software/automake...ending-aclocal
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before it was required
../../lib/autoconf/c.m4:429: AC_LANG_COMPILER(C) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
/usr/share/aclocal/lf_cc.m4:33: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CPP' was expanded before it was required
../../lib/autoconf/c.m4:336: AC_LANG_PREPROC(C) is expanded from...
../../lib/autoconf/lang.m4:373: AC_LANG_PREPROC_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2519: AC_PREPROC_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
/usr/share/aclocal/lf_cc.m4:33: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:17: warning: AC_REQUIRE: `AC_PROG_CXX' was expanded before it was required
../../lib/autoconf/c.m4:667: AC_LANG_COMPILER(C++) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from...
../../lib/autoconf/general.m4:2765: AC_TRY_RUN is expanded from...
/usr/share/aclocal/lf_cxx.m4:55: LF_CPP_PORTABILITY is expanded from...
/usr/share/aclocal/lf_cxx.m4:32: LF_CONFIGURE_CXX is expanded from...
configure.ac:17: the top level
- autoconf.
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before it was required
../../lib/autoconf/c.m4:429: AC_LANG_COMPILER(C) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
aclocal.m4:55: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CPP' was expanded before it was required
../../lib/autoconf/c.m4:336: AC_LANG_PREPROC(C) is expanded from...
../../lib/autoconf/lang.m4:373: AC_LANG_PREPROC_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2519: AC_PREPROC_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
aclocal.m4:55: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:17: warning: AC_REQUIRE: `AC_PROG_CXX' was expanded before it was required
../../lib/autoconf/c.m4:667: AC_LANG_COMPILER(C++) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from...
../../lib/autoconf/general.m4:2765: AC_TRY_RUN is expanded from...
aclocal.m4:120: LF_CPP_PORTABILITY is expanded from...
aclocal.m4:97: LF_CONFIGURE_CXX is expanded from...
configure.ac:17: the top level
- acconfig.
Use of "do" to call subroutines is deprecated at /usr/bin/acconfig line 85.
Use of "do" to call subroutines is deprecated at /usr/bin/acconfig line 90.
Use of "do" to call subroutines is deprecated at /usr/bin/acconfig line 91.
Use of "do" to call subroutines is deprecated at /usr/bin/acconfig line 93.
Can't open configure.in: No such file or directory at /usr/bin/acconfig line 102.
- autoheader.
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before it was required
../../lib/autoconf/c.m4:429: AC_LANG_COMPILER(C) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
aclocal.m4:55: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CPP' was expanded before it was required
../../lib/autoconf/c.m4:336: AC_LANG_PREPROC(C) is expanded from...
../../lib/autoconf/lang.m4:373: AC_LANG_PREPROC_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2519: AC_PREPROC_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
aclocal.m4:55: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:17: warning: AC_REQUIRE: `AC_PROG_CXX' was expanded before it was required
../../lib/autoconf/c.m4:667: AC_LANG_COMPILER(C++) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from...
../../lib/autoconf/general.m4:2765: AC_TRY_RUN is expanded from...
aclocal.m4:120: LF_CPP_PORTABILITY is expanded from...
aclocal.m4:97: LF_CONFIGURE_CXX is expanded from...
configure.ac:17: the top level
autoheader: warning: missing template: CXX_HAS_BUGGY_FOR_LOOPS
autoheader: Use AC_DEFINE([CXX_HAS_BUGGY_FOR_LOOPS], [], [Description])
autoheader: warning: missing template: CXX_HAS_NO_BOOL
autoheader: warning: missing template: NDEBUG
autoheader: warning: missing template: YOUR_OS
- automake.
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before it was required
../../lib/autoconf/c.m4:429: AC_LANG_COMPILER(C) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
aclocal.m4:55: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:16: warning: AC_REQUIRE: `AC_PROG_CPP' was expanded before it was required
../../lib/autoconf/c.m4:336: AC_LANG_PREPROC(C) is expanded from...
../../lib/autoconf/lang.m4:373: AC_LANG_PREPROC_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2519: AC_PREPROC_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:606: AS_IF is expanded from...
../../lib/m4sugar/m4sh.m4:353: AS_REQUIRE is expanded from...
../../lib/autoconf/general.m4:183: AC_REQUIRE_SHELL_FN is expanded from...
../../lib/autoconf/headers.m4:129: _AC_CHECK_HEADER_MONGREL is expanded from...
../../lib/autoconf/headers.m4:67: AC_CHECK_HEADER is expanded from...
../../lib/autoconf/specific.m4:432: AC_AIX is expanded from...
aclocal.m4:55: LF_CONFIGURE_CC is expanded from...
configure.ac:16: the top level
configure.ac:17: warning: AC_REQUIRE: `AC_PROG_CXX' was expanded before it was required
../../lib/autoconf/c.m4:667: AC_LANG_COMPILER(C++) is expanded from...
../../lib/autoconf/lang.m4:330: AC_LANG_COMPILER_REQUIRE is expanded from...
../../lib/autoconf/general.m4:2749: AC_RUN_IFELSE is expanded from...
../../lib/autoconf/general.m4:2765: AC_TRY_RUN is expanded from...
aclocal.m4:120: LF_CPP_PORTABILITY is expanded from...
aclocal.m4:97: LF_CONFIGURE_CXX is expanded from...
configure.ac:17: the top level
configure.ac:12: required directory ./config does not exist
configure.ac:18: installing `config/config.guess'; error while making link: No such file or directory
configure.ac:18: installing `config/config.sub'; error while making link: No such file or directory
configure.ac:14: installing `config/install-sh'; error while making link: No such file or directory
configure.ac:14: installing `config/missing'; error while making link: No such file or directory
src/Makefile.am: installing `config/depcomp'; error while making link: No such file or directory
Makefile.am: required file `./README' not found
configure.ac:13: required file `config.h.in' not found

NevemTeve 08-04-2012 09:44 AM

As far as I know autoconf/automake/configure is far beyond human understanding... For your project a well-written Makefile would be suffice, especially if you comment carefully the places where to end-user could/should make their system-dependent modifications.

ntubski 08-04-2012 10:24 AM

It seems like autotoolset hasn't been updated since 2007; it's out of date. For instance
Quote:

LF_CONFIGURE_CC
This macro is equivalent to the following invocation:
AC_PROG_CC
AC_PROG_CPP
AC_AIX
AC_ISC_POSIX
AC_MINIX
AC_HEADER_STDC
http://autotoolset.sourceforge.net/tutorial.html#SEC70
Quote:

18.4 Obsolete Macros
...
Macro: AC_AIX
This macro is a platform-specific subset of AC_USE_SYSTEM_EXTENSIONS (see AC_USE_SYSTEM_EXTENSIONS).
...
Macro: AC_ISC_POSIX
This macro adds -lcposix to output variable LIBS if necessary for Posix facilities. Sun dropped support for the obsolete INTERACTIVE Systems Corporation Unix on 2006-07-23. New programs need not use this macro. It is implemented as AC_SEARCH_LIBS([strerror], [cposix]) (see AC_SEARCH_LIBS).
...
Macro: AC_MINIX
This macro is a platform-specific subset of AC_USE_SYSTEM_EXTENSIONS (see AC_USE_SYSTEM_EXTENSIONS).


Quote:

Originally Posted by NevemTeve
As far as I know autoconf/automake/configure is far beyond human understanding...

I woudn't go that far, but it is overkill for something you just want to share with your friends (assuming your friends are not running some obscure UNIX variant).



Quote:

Originally Posted by greendream
$ ./configure
$ make
$ make install

Oh, and please don't use orange, it's really hard to read. Actually, please avoid all colours and prefer [code][/code] to [quote][/quote] when posting code.

greendream 08-04-2012 10:48 AM

Quote:

Originally Posted by NevemTeve (Post 4745803)
As far as I know autoconf/automake/configure is far beyond human understanding... For your project a well-written Makefile would be suffice, especially if you comment carefully the places where to end-user could/should make their system-dependent modifications.

Thank guy, I'm newbie, maybe I not enough experience to show problem. You can show me I need give for everybody clues or info to get the best solve for my problem.

Thank!

greendream 08-04-2012 11:15 AM

Quote:

ntubski
Oh, and please don't use orange, it's really hard to read. Actually, please avoid all colours and prefer [code][/code] to when posting code.
Thank I have just fixed it.

Quote:

ntubski
I woudn't go that far, but it is overkill for something you just want to share with your friends (assuming your friends are not running some obscure UNIX variant).
Maybe that, but I want join FSF to study and lear, maybe one day I can contribute for community one good software but I don't know how to make an install package, that crazy:):):)

I want study step by step, maybe it hard at the first time but I never give up !

Somebody can, please show me step by step.
Thank so much !

ntubski 08-04-2012 02:30 PM

Well I think the first step would be to create a plain Makefile for your software. automake just uses some macro expansions to write a Makefile, so to use it properly you need a good understanding of Makefiles. Start with the GNU Make manual, if you get stuck let us know.

theNbomr 08-05-2012 10:07 AM

I agree with ntubski. For now, focus on the actual application, and allow the autotools stuff to absorb by osmosis as you develop this and other packages. For a simple application that doesn't do anything exotic and isn't target host dependent, an adequately commented Makefile is just fine. There is great value in learning about make, a lot less value in knowing autotools, IMHO.
--- rod


All times are GMT -5. The time now is 06:10 PM.