Перейти к содержимому

Рекомендованные сообщения

Опубликовано:

помогите плз. нужен консольный конфигуратор для новой версии стг, но он не собирается из дистрибутива. надо под фрю4.10.

 

намекните пожалуйста, куда копнуть?

  • 2 weeks later...
Опубликовано:

дык до установки оно ругается на отсутствие, а после установки - на конфлик объявлений

 

/usr/include/unistd.h:112: error: declaration of C function `int getopt(int, char* const*, const char*)' conflicts with

/usr/local/include/getopt.h:136: error: previous declaration `int getopt()' here

Опубликовано:

В самой первой строчке main.cpp, перед всеми директивами #include вставь строчку:

#define HAVE_DECL_GETOPT 1

PS: опять фришники собаку подложили...

Опубликовано:

одному богу известными манипуляциями довел сборку до состояния:

 

g++ -c parser.cpp -O2 -Wall -I /usr/home/napTu/stg-2.404.9.7-wo_netflow_patch/projects/sgconf/../../include -DFREE_BSD

g++ main.o parser.o /usr/home/napTu/stg-2.404.9.7-wo_netflow_patch/projects/sgconf/../../lib/libconffiles.so /usr/home/napTu/stg-2.404.9.7-wo_netflow_patch/projects/sgconf/../../lib/libstg_common.so /usr/home/napTu/stg-2.404.9.7-wo_netflow_patch/projects/sgconf/../../lib/libsrvconf.so /usr/lib/libexpat.so /usr/lib/libc_r.so /usr/lib/libc.so -Wl,-E -L/usr/home/napTu/stg-2.404.9.7-wo_netflow_patch/projects/sgconf/../../lib -Wl,-rpath,//usr/lib/stg -Wl,-rpath-link,/usr/home/napTu/stg-2.404.9.7-wo_netflow_patch/projects/sgconf/../../lib -o sgconf

/usr/lib/libc.so: WARNING! setkey(3) not present in the system!

/usr/lib/libc.so: warning: this program uses gets(), which is unsafe.

/usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp()

/usr/lib/libc.so: WARNING! des_setkey(3) not present in the system!

/usr/lib/libc.so: WARNING! encrypt(3) not present in the system!

/usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp()

/usr/lib/libc.so: warning: this program uses f_prealloc(), which is not recommended.

/usr/lib/libc.so: WARNING! des_cipher(3) not present in the system!

/usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp()

main.o: In function `main':

main.o(.text+0x1538): undefined reference to `getopt_long'

collect2: ld returned 1 exit status

gmake: *** [sgconf] Ошибка 1

 

указание на #define HAVE_DECL_GETOPT 1 при этом уже ни на что не влияет.

Опубликовано:

убирал, но сейчас всё вернул назад.

сначала убрал из usr/include/unistd.h объявление getopt,

с этого момента стало говорить main.o(.text+0x1538): undefined reference to `getopt_long'.

 

потом обновил getopt с 2.1 до 2.1_1

потом вернул объявление getopt в usr/include/unistd.h

 

так и выдает main.o(.text+0x1538): undefined reference to `getopt_long'.

Опубликовано:

вернул старую getopt.h

добавил #define HAVE_DECL_GETOPT 1

всё равно ругается на /usr/local/include/getopt.h:136: error: previous declaration `int getopt()' here

  • 2 weeks later...
Опубликовано:

блиииин.

getopt.h сократил до непристойного вида:

extern "C" {

struct option
{
 const char *name;
 int has_arg;
 int *flag;
 int val;
};


extern int getopt_long (int argc, char *const *argv, const char *shortopts,
                       const struct option *longopts, int *longind);
}

а оно мне всё одно:

 

main.o: In function `main':
main.o(.text+0x1538): undefined reference to `getopt_long'
collect2: ld returned 1 exit status
gmake: *** [sgconf] Ошибка 1

 

как будто и не обращается туда, но с пустым файлом не компилится

g++ -c main.cpp -O2 -Wall -I /usr/home/napTu/stg-2.404.9.7/projects/sgconf/../../include -DFREE_BSD
main.cpp:87: error: elements of array `option long_options[]' have incomplete type
main.cpp:87: error: storage size of `long_options' isn't known
main.cpp: In function `int main(int, char**)':
main.cpp:541: error: `getopt_long' was not declared in this scope
main.cpp:541: warning: unused variable 'getopt_long'
main.cpp: At global scope:
main.cpp:52: error: storage size of `long_options' isn't known
gmake: *** [main.o] Ошибка 1

 

madf, чего делать, подскажи?

Опубликовано:

что самое интересное, не могу поставить getopt - /usr/ports/misc/getopt

говорит

gcc  -L/usr/local/lib -lintl -o getopt getopt.o
getopt.o: In function `generate_output':
getopt.o(.text+0x32a): undefined reference to `getopt_long'
getopt.o: In function `main':
getopt.o(.text+0xadc): undefined reference to `getopt_long'
collect2: ld returned 1 exit status
gmake: *** [getopt] Ошибка 1
*** Error code 2

 

но /usr/ports/devel/libgnugetopt поставилось и содержит getopt_long

 

какой еще getopt ставить?

Опубликовано:

Верни все хидеры в исходное состояние. Нечего их портить.

Все решается дефайнами.

Ты когда дефайн добавлял - ты его в самый верх файла ставил? Над инкладами?

Опубликовано:

да, #define HAVE_DECL_GETOPT 1 стоит в самом начале и в данном случае на повтор определения getopt() не ругается.

 

Дело в том что переменная HAVE_DECL_GETOPT 1 влияет только на определение функции getopt() , но не getopt_long().

А тут я getopt_long() уже задаю принудительно, безо всяких условий. да и при компиляции из cpp оно видится и обрабатывается без проблем.

Ошибка почемуто происходит уже при перекомпиливании обжекта - main.o(.text+0x1538): undefined reference to `getopt_long'

Такое впечатление что это определение уже не зависит от getopt.h, а задается гдето в другом месте.

 

Вопрос в каком?

Опубликовано:

"undefined reference" говорит об отсутствии символа на этапе компоновки, а не компиляции.

В Makefile добавь в LIBS -lgnugetopt

LIBS += -lexpat \ 
       -lc_r \ 
       -lc \
       -lgnugetopt

Опубликовано:

О БОГИ! СЛАВА ВАМ!

 

СПАСИБО madf !!!

 

Еще поставил gnugetopt.h и там ему задал #define __GNU_LIBRARY__ 1 и #include gnugetopt.h

  • 1 year later...
Опубликовано:

Помогите и мне

у меня не собирается с такой ошибкой

Система AltLinux 4,1

 

#############################################################################

Building sgconf for Linux

#############################################################################

Checking for -lexpat... yes

gmake -C /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../stglibs includes

gmake[1]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs'

gmake includes -C conffiles.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/conffiles.lib'

cp -p conffiles.h /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/conffiles.lib'

gmake includes -C crypto.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/crypto.lib'

cp -p ag_md5.h blowfish.h /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/crypto.lib'

gmake includes -C common.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/common.lib'

cp -p debug.h stg_error.h common.h /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/common.lib'

gmake includes -C srvconf.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/srvconf.lib'

cp -p servconf.h netunit.h /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/srvconf.lib'

gmake[1]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs'

gmake -C /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../stglibs

gmake[1]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs'

gmake -C conffiles.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/conffiles.lib'

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/conffiles.lib'

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/conffiles.lib'

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c conffiles.cpp

g++ -shared -Wl,-rpath,//usr/lib/stg -Wl,-soname,libconffiles.so conffiles.o -o libconffiles.so -L /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

ar rc libconffiles.a conffiles.o

ranlib libconffiles.a

cp *.so /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

cp *.a /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/conffiles.lib'

gmake -C crypto.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/crypto.lib'

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/crypto.lib'

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/crypto.lib'

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c ag_md5.c

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c blowfish.cpp

g++ -shared -Wl,-rpath,//usr/lib/stg -Wl,-soname,libstg_crypto.so ag_md5.o blowfish.o -o libstg_crypto.so -L /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

ar rc libstg_crypto.a ag_md5.o blowfish.o

ranlib libstg_crypto.a

cp *.so /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

cp *.a /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/crypto.lib'

gmake -C common.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/common.lib'

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/common.lib'

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/common.lib'

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c debug.c

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c stg_error.c

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c common.cpp

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c stg_strptime.cpp

g++ -shared -Wl,-rpath,//usr/lib/stg -Wl,-soname,libstg_common.so debug.o stg_error.o common.o stg_strptime.o -lstg_crypto -o libstg_common.so -L /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

ar rc libstg_common.a debug.o stg_error.o common.o stg_strptime.o

ranlib libstg_common.a

cp *.so /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

cp *.a /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/common.lib'

gmake -C srvconf.lib

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/srvconf.lib'

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/srvconf.lib'

gmake[2]: Entering directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/srvconf.lib'

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c netunit.cpp

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c parser.cpp

g++ -O2 -Wall -fPIC -I /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../include -I ./ -DLINUX -DSTG_TIME -c servconf.cpp

servconf.cpp: In function `int AnsRecv(void*, std::list<std::string, std::allocator<std::string> >*)':

servconf.cpp:68: warning: int format, XML_Size arg (arg 3)

g++ -shared -Wl,-rpath,//usr/lib/stg -Wl,-soname,libsrvconf.so netunit.o parser.o servconf.o -o libsrvconf.so -L /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

ar rc libsrvconf.a netunit.o parser.o servconf.o

ranlib libsrvconf.a

cp *.so /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

cp *.a /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib

gmake[2]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs/srvconf.lib'

gmake[1]: Leaving directory `/home/soft/Stargazer/stg-2.405.9.8/stglibs'

g++ main.o common_sg.o /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libconffiles.so /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libstg_common.so /home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so /usr/lib/libexpat.so /usr/lib/libpthread.so /usr/lib/libdl.so -Wl,-E -L/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib -Wl,-rpath,//usr/lib/stg -Wl,-rpath-link,/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib -o sgconf

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_ParserCreate'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_GetErrorCode'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_SetUserData'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_ParserReset'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_GetCurrentLineNumber'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_ErrorString'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_SetElementHandler'

/home/soft/Stargazer/stg-2.405.9.8/projects/sgconf/../../lib/libsrvconf.so: undefined reference to `XML_Parse'

collect2: ld returned 1 exit status

gmake: *** [sgconf] Ошибк

Опубликовано:

Добавь в stglibs/srvconf.lib/Makefile перед

include ../Makefile.in

строку

LIBS += -lexpat

как здесь:

LIB_NAME = srvconf
PROG = lib$(LIB_NAME)

SRCS = 	netunit.cpp \
	parser.cpp \
	servconf.cpp

INCS = servconf.h \
   netunit.h

LIBS += -lexpat

include ../Makefile.in

Опубликовано:

скомпилилось

но при запуске выдает ( либо надо строку параметров перечислить )

./sgconf: error while loading shared libraries: libsrvconf.so: cannot open shared object file: No such file or directory

Опубликовано:
скомпилилось

но при запуске выдает ( либо надо строку параметров перечислить )

./sgconf: error while loading shared libraries: libsrvconf.so: cannot open shared object file: No such file or directory

Скопируй lib/libsrvconf.so в /usr/lib/stg

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас
  • Сейчас на странице   0 пользователей

    • Нет пользователей, просматривающих эту страницу.
×
×
  • Создать...