0

I'm trying to compile and example file which needs the required library libmusicxml.

I compiled the library as they said (cmake, make, make install) and it made and installed a bunch of files:

Install the project... -- Install configuration: "" -- Installing: /usr/local/lib/libmusicxml2.so.3.00 -- Installing: /usr/local/lib/libmusicxml2.so -- Installing: /usr/local/include/libmusicxml/musicxmlfactory.h -- Installing: /usr/local/include/libmusicxml/sortvisitor.h -- Installing: /usr/local/include/libmusicxml/xmlreader.h ... etc 

Now I want to compile one of their sample files so I run g+ filename.cpp and it gives me the following error:

libmusicxml.h: No such file or directory 

Does this mean it's not seeing the library in /usr/local? Can I specify this somewhere? Set a path or something?

I have made sure to have the latest version of the libmusicxml library from here and did the same (cmake followed by make).

When I go to the gives samples and try to make one (with the provided make file, which work according to the developer) it doesn't want to do it:

dorien@XP:~/bin/libmusicxml-master/samples$ make gcc -g -O3 -Wall -Wuninitialized -I../src/elements -I../src/interface -I../src/files -I../src/lib -I../src/parser -I../src/visitors -I../src/guido -I../src/operations countnotes.cpp ../libmusicxml2.a -lstdc++ -o countnotes gcc: error: ../libmusicxml2.a: No such file or directory Makefile:14: recipe for target 'countnotes' failed 

-> I tried to locate libmusicxml2.a and that doesn't seem to exist.

When I run xml2guido (which seems to have a compiled version in the root directory of the package), I get:

xml2guido: error while loading shared libraries: libmusicxml2.so.3.00: cannot open shared object file: No such file or directory 

However, there is a libmusicxml2.so.3.00 in the same directory

Maybe it's that the package is not linked correctly? Or something about the missing .a file?

I do think it was built correctly:

 make [ 73%] Built target musicxml2 [ 75%] Built target RandomMusic [ 78%] Built target countnotes [ 80%] Built target partsummary [ 82%] Built target readunrolled [ 85%] Built target xml2guido [ 87%] Built target xml2midi [ 90%] Built target xmlclone [ 92%] Built target xmlfactory [ 95%] Built target xmliter [ 97%] Built target xmlread [100%] Built target xmltranspose dorien@XP:~/bin/libmusicxml-master$ sudo make install [ 73%] Built target musicxml2 [ 75%] Built target RandomMusic [ 78%] Built target countnotes [ 80%] Built target partsummary [ 82%] Built target readunrolled [ 85%] Built target xml2guido [ 87%] Built target xml2midi [ 90%] Built target xmlclone [ 92%] Built target xmlfactory [ 95%] Built target xmliter [ 97%] Built target xmlread [100%] Built target xmltranspose Install the project... -- Install configuration: "" -- Up-to-date: /usr/local/lib/libmusicxml2.so.3.00 -- Up-to-date: /usr/local/lib/libmusicxml2.so -- Up-to-date: /usr/local/include/libmusicxml/musicxmlfactory.h -- Up-to-date: /usr/local/include/libmusicxml/sortvisitor.h -- Up-to-date: /usr/local/include/libmusicxml/xmlreader.h -- Up-to-date: /usr/local/include/libmusicxml/xmlfile.h -- Up-to-date: /usr/local/include/libmusicxml/libmusicxml.h -- Up-to-date: /usr/local/include/libmusicxml/unrolled_xml_tree_browser.h -- Up-to-date: /usr/local/include/libmusicxml/xml.h -- Up-to-date: /usr/local/include/libmusicxml/elements.h -- Up-to-date: /usr/local/include/libmusicxml/factory.h -- Up-to-date: /usr/local/include/libmusicxml/types.h -- Up-to-date: /usr/local/include/libmusicxml/typedefs.h -- Up-to-date: /usr/local/include/libmusicxml/xml_tree_browser.h -- Up-to-date: /usr/local/include/libmusicxml/versions.h -- Up-to-date: /usr/local/include/libmusicxml/exports.h 
9
  • This means it doesn't see the file libmusicxml.h in /usr/local/include/libmusicxml/ Maybe you Need to write #include <libmusicxml/libmusicxml.h> Commented Oct 28, 2015 at 16:41
  • You should use -I to specify the search path as -I/usr/local/include. Commented Oct 28, 2015 at 16:42
  • -L won't work. this is a missing header not a library. Commented Oct 28, 2015 at 16:43
  • @skypjack The error is not about the *.so file but about the *.h file. So it should be -I/usr/local/include/libmusicxml... But /usr/local/include is a Standard include path. it should work without -I Commented Oct 28, 2015 at 16:43
  • you are right, fixed. it could be that the file is under libmusicxml indeed. Commented Oct 28, 2015 at 16:46

2 Answers 2

1

Does this mean it's not seeing the library in /usr/local?

It means that it didn't find the header libmusicxml.h. You didn't tell the compiler to look for it in /usr/local/include/libmusicxml.

Can I specify this somewhere? Set a path or something?

See the documentation of your compiler. In gcc, the option for include search paths is -I.

Instead of searching for the header libmusicxml.h from /usr/local/include/libmusicxml/, I would recommend including libmusicxml/libmusicxml.h and searching from /usr/local/include. That would be simpler since g++ searches from /usr/local/include by default, so no compiler options would be required.

Sign up to request clarification or add additional context in comments.

2 Comments

oh waw, of course, I'm too used to having automatic make files... will try it right away.
When compiling with g++ xml2guido.cpp -I/usr/local/include/libmusicxml It gives me a different error now. It can't find a function that's specified int the libmusicxml header. In function main': xml2guido.cpp:(.text+0xf9): undefined reference to musicxmlfd2guido' xml2guido.cpp:(.text+0x115): undefined reference to `musicxmlfile2guido' collect2: error: ld returned 1 exit status
0

The library (and headers) weren't recognised until I ran:

export LD_LIBRARY_PATH=/addressto/libmusicxml-master 

That fixed it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.