N
N
nick88hello2014-05-27 08:21:43
linux
nick88hello, 2014-05-27 08:21:43

How to add/fix missing headers when compiling?

It is necessary to correct the paths to some header files:

./modules/zip.a:php_zip.o:00000000 r .rdata
./modules/zip.a:php_zip.o:00000000 r .rdata$zzz
./modules/zip.a:php_zip.o:00000000 t .text
./modules/zip.a:php_zip.o:         U ___chkstk_ms
./modules/zip.a:php_zip.o:         U __array_init
./modules/zip.a:php_zip.o:         U __convert_to_string
./modules/zip.a:php_zip.o:         U __efree
./modules/zip.a:php_zip.o:         U __emalloc
./modules/zip.a:php_zip.o:         U __erealloc
./modules/zip.a:php_zip.o:         U __estrndup
./modules/zip.a:php_zip.o:         U __imp__glob
./modules/zip.a:php_zip.o:         U __imp__globfree
./modules/zip.a:php_zip.o:         U __php_stream_free
./modules/zip.a:php_zip.o:         U __php_stream_mkdir
./modules/zip.a:php_zip.o:         U __php_stream_open_wrapper_ex
./modules/zip.a:php_zip.o:         U __php_stream_scandir
./modules/zip.a:php_zip.o:         U __php_stream_stat_path
./modules/zip.a:php_zip.o:         U __php_stream_write
./modules/zip.a:php_zip.o:         U __safe_emalloc
./modules/zip.a:php_zip.o:         U __zend_hash_add_or_update
./modules/zip.a:php_zip.o:         U __zend_hash_init
./modules/zip.a:php_zip.o:         U __zend_list_delete
./modules/zip.a:php_zip.o:         U __zval_copy_ctor_func
./modules/zip.a:php_zip.o:         U __zval_dtor_func
./modules/zip.a:php_zip.o:         U __zval_ptr_dtor
./modules/zip.a:php_zip.o:         U _add_assoc_long_ex
./modules/zip.a:php_zip.o:         U _add_assoc_string_ex
./modules/zip.a:php_zip.o:         U _add_next_index_string
./modules/zip.a:php_zip.o:         U _ap_php_snprintf
./modules/zip.a:php_zip.o:00001a20 r _arginfo_zip_close

Tried doing it manually:
//было
  #include "php.h"
  //стало
  #include "../../main/php.h"

But no effect, maybe you need to make changes to the makefile?
//Переменные , объявленные в makefile :
 
srcdir = /usr/local/include/php/ext/zip
builddir = /usr/local/include/php/ext/zip
top_srcdir = /usr/local/include/php/ext/zip
top_builddir = /usr/local/include/php/ext/zip
EGREP = /usr/bin/grep -E
SED = /usr/bin/sed
CONFIGURE_COMMAND = './configure' '--disable-static' '--enable-shared' '--enable-zip'
CONFIGURE_OPTIONS = '--disable-static' '--enable-shared' '--enable-zip'
SHLIB_SUFFIX_NAME = so
SHLIB_DL_SUFFIX_NAME = so
ZEND_EXT_TYPE = zend_extension
RE2C = exit 0;
AWK = gawk
shared_objects_zip = php_zip.lo zip_stream.lo lib/zip_add.lo lib/zip_add_dir.lo lib/zip_add_entry.lo lib/zip_close.lo lib/zip_delete.lo lib/zip_dir_add.lo lib/zip_dirent.lo lib/zip_discard.lo lib/zip_entry.lo lib/zip_err_str.lo lib/zip_error.lo lib/zip_error_clear.lo lib/zip_error_get.lo lib/zip_error_get_sys_type.lo lib/zip_error_strerror.lo lib/zip_error_to_str.lo lib/zip_extra_field.lo lib/zip_extra_field_api.lo lib/zip_fclose.lo lib/zip_fdopen.lo lib/zip_file_add.lo lib/zip_file_error_clear.lo lib/zip_file_error_get.lo lib/zip_file_get_comment.lo lib/zip_file_get_offset.lo lib/zip_file_rename.lo lib/zip_file_replace.lo lib/zip_file_set_comment.lo lib/zip_file_strerror.lo lib/zip_filerange_crc.lo lib/zip_fopen.lo lib/zip_file_get_external_attributes.lo lib/zip_file_set_external_attributes.lo lib/zip_fopen_encrypted.lo lib/zip_fopen_index.lo lib/zip_fopen_index_encrypted.lo lib/zip_fread.lo lib/zip_get_archive_comment.lo lib/zip_get_archive_flag.lo lib/zip_get_compression_implementation.lo lib/zip_get_encryption_implementation.lo lib/zip_get_file_comment.lo lib/zip_get_name.lo lib/zip_get_num_entries.lo lib/zip_get_num_files.lo lib/zip_memdup.lo lib/zip_name_locate.lo lib/zip_new.lo lib/zip_open.lo lib/zip_rename.lo lib/zip_replace.lo lib/zip_set_archive_comment.lo lib/zip_set_archive_flag.lo lib/zip_set_default_password.lo lib/zip_set_file_comment.lo lib/zip_set_file_compression.lo lib/zip_set_name.lo lib/zip_source_buffer.lo lib/zip_source_close.lo lib/zip_source_crc.lo lib/zip_source_deflate.lo lib/zip_source_error.lo lib/zip_source_file.lo lib/zip_source_filep.lo lib/zip_source_free.lo lib/zip_source_function.lo lib/zip_source_layered.lo lib/zip_source_open.lo lib/zip_source_pkware.lo lib/zip_source_pop.lo lib/zip_source_read.lo lib/zip_source_stat.lo lib/zip_source_window.lo lib/zip_source_zip.lo lib/zip_source_zip_new.lo lib/zip_stat.lo lib/zip_stat_index.lo lib/zip_stat_init.lo lib/zip_strerror.lo lib/zip_string.lo lib/zip_unchange.lo lib/zip_unchange_all.lo lib/zip_unchange_archive.lo lib/zip_unchange_data.lo lib/zip_utf-8.lo lib/mkstemp.lo
PHP_PECL_EXTENSION = zip
ZIP_SHARED_LIBADD = -lz
PHP_MODULES = $(phplibdir)/zip.la
PHP_ZEND_EX =
all_targets = $(PHP_MODULES) $(PHP_ZEND_EX)
install_targets = install-modules install-headers
prefix = /usr/local
exec_prefix = $(prefix)
libdir = ${exec_prefix}/lib
prefix = /usr/local
phplibdir = /usr/local/include/php/ext/zip/modules
phpincludedir = /usr/local/include/php
CC = cc
CFLAGS = -g -O2
CFLAGS_CLEAN = $(CFLAGS)
CPP = cc -E
CPPFLAGS = -DHAVE_CONFIG_H
CXX =
CXXFLAGS =
CXXFLAGS_CLEAN = $(CXXFLAGS)
EXTENSION_DIR = /usr/local/lib/php/extensions/no-debug-non-zts-20121212
PHP_EXECUTABLE = /usr/local/bin/php.exe
EXTRA_LDFLAGS =
EXTRA_LIBS =
INCLUDES = -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/php/ext/zip/lib
LFLAGS =
LDFLAGS =
SHARED_LIBTOOL =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
SHELL = /bin/sh
INSTALL_HEADERS =
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
cmx, 2014-05-27
@nick88hello

If you want to add the php.h file and the main library, which is, for example, in /usr/local/include/main/php.h , then in the cpp file:
And in the makefile:
INCLUDES = ... -I/usr/local/include

E
EXL, 2014-05-27
@EXL

But no effect, maybe you need to make changes to the makefile?

Certainly. It's bad form to fix paths to headers in sources. Change the variable in the Makefile:
By adding the correct path to the header files to it. In general, such problems should be solved at the configuration stage, i.e. you should put the path to the necessary files before generating the Makefile:
CPPFLAGS="-I/usr/include/ -I/usr/include/php" ./configure ...

D
Denis, 2014-05-27
@Ayahuaska

It looks like it's a matter of linking.
The -L and -l flags.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question