CFLAGS and assign more than one reference?

Mar*_*osé 0 c c++ makefile

I'm not used to working with C or C++ and I'm trying to let the compiler where to find references losses.

I have a configuration file called configure which creates the makefile.

Then to create the makefile I run:

CFLAGS=-I/usr/include/libxml2 ./configure  --enable-murder
Run Code Online (Sandbox Code Playgroud)

As I run this line but given two references in CFLAGS?.

To be clear mais, compiling want to point to the references:

  • /usr/include/libxml2
  • /usr/include/libical

in CFLAGS.

This is because I can not edit the makefile and I want to fix the following errors:

http_caldav.o: In function `is_valid_timerange':
http_caldav.c:(.text+0x3c86): undefined reference to `icaltime_is_valid_time'
http_caldav.c:(.text+0x3cd8): undefined reference to `icaltime_is_valid_time'
http_caldav.c:(.text+0x3d2a): undefined reference to `icaltime_is_date'
http_caldav.c:(.text+0x3d7c): undefined reference to `icaltime_is_date'
http_caldav.c:(.text+0x3dce): undefined reference to `icaltime_is_utc'
http_caldav.c:(.text+0x3e23): undefined reference to `icaltime_is_utc'
http_caldav.o: In function `parse_comp_filter':
http_caldav.c:(.text+0x3e7d): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3e98): undefined reference to `xmlGetProp'
http_caldav.c:(.text+0x3eb7): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f02): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f19): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f46): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x3f71): undefined reference to `xmlStrcmp'
http_caldav.o:http_caldav.c:(.text+0x3f9c): more undefined references to `xmlStrcmp' follow
http_caldav.o: In function `parse_comp_filter':
http_caldav.c:(.text+0x4077): undefined reference to `xmlFree'
http_caldav.c:(.text+0x40cc): undefined reference to `xmlStrcmp'
http_caldav.c:(.text+0x40d9): undefined reference to `icaltimezone_get_utc_timezone'
http_caldav.c:(.text+0x410f): undefined reference to `xmlGetProp'
http_caldav.c:(.text+0x412d): undefined reference to `icaltime_from_string'
http_caldav.c:(.text+0x4171): undefined reference to `xmlFree'
http_caldav.c:(.text+0x41a0): undefined reference to `icaltime_from_timet_with_zone'
http_caldav.c:(.text+0x41f2): undefined reference to `xmlGetProp'
http_caldav.c:(.text+0x4210): undefined reference to `icaltime_from_string'
http_caldav.c:(.text+0x4254): undefined reference to `xmlFree'
http_caldav.c:(.text+0x4283): undefined reference to `icaltime_from_timet_with_zone'
Run Code Online (Sandbox Code Playgroud)

config.log

gcc-4.7.real: error: unrecognized command line option '-V'
gcc-4.7.real: fatal error: no input files
compilation terminated.
configure:3214: $? = 4
configure:3203: gcc -qversion >&5
gcc-4.7.real: error: unrecognized command line option '-qversion'
gcc-4.7.real: fatal error: no input files
compilation terminated.
conftest.c:13:28: fatal error: ac_nonexistent.h: No such file or directory
conftest.c:56:26: fatal error: minix/config.h: No such file or directory
conftest.c:37:9: error: unknown type name 'not'
conftest.c:37:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'universal'
conftest.c:37:15: error: unknown type name 'universal'
gcc-4.7.real: error: unrecognized option '-R'
Run Code Online (Sandbox Code Playgroud)

My OS is Debian 7.

Ola*_*che 5

If you want to add two include paths, enclose them in quotes

CFLAGS="-I/usr/include/libxml2 -I/usr/include/libical" ./configure --enable-murder
Run Code Online (Sandbox Code Playgroud)

To fix the linker errors, you must add the libraries with LDLIBS, e.g.

CFLAGS="..." LDLIBS="-lxml2 -lical" ./configure --enable-murder
Run Code Online (Sandbox Code Playgroud)

  • 通常最好将变量作为 _arguments_ 添加到 `configure` 脚本中,而不是添加到环境中。所以,`./configure --enable-murder CFLAGS="..." LDLIBS="..."` (2认同)