我正在尝试编译媒体渲染器在 Ubuntu 12.04 上。我在 make 过程中遇到错误:
gcc -Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -L/usr/lib -o gmediarender main.o upnp.o upnp_control.o upnp_connmgr.o upnp_transport.o upnp_device.o upnp_renderer.o webserver.o output_gstreamer.o xmlescape.o -pthread -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lglib-2.0 -lupnp
/usr/bin/ld: upnp.o: undefined reference to symbol 'ixmlDocument_createElementNS'
/usr/bin/ld: note: 'ixmlDocument_createElementNS' is defined in DSO /usr/lib/libixml.so.2 so try adding it to the linker command line
/usr/lib/libixml.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [gmediarender] Error 1
我尝试添加-lixml2
和-L/usr/lib/libixml.so.2
,但得到了这个:
gcc -Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -L/usr/lib -L/usr/lib/libixml.so.2 -o gmediarender main.o upnp.o upnp_control.o upnp_connmgr.o upnp_transport.o upnp_device.o upnp_renderer.o webserver.o output_gstreamer.o xmlescape.o -pthread -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lglib-2.0 -lupnp -lrt -lixml2
/usr/bin/ld: cannot find -lixml2
collect2: ld returned 1 exit status
请帮助我离开这里 - 我是新手
答案1
最后我找到了这个问题的解决方案在本页所以我/usr/lib/libixml.so.2
明确地添加到了 gcc 参数中:
gcc -Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -L/usr/lib -o gmediarender main.o upnp.o upnp_control.o upnp_connmgr.o upnp_transport.o upnp_device.o upnp_renderer.o webserver.o output_gstreamer.o xmlescape.o /usr/lib/libixml.so.2 -pthread -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lglib-2.0 -lupnp