Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X
On Wed, 18 Jun 2014, Jose L Walteros wrote: In the Linux machine I don't have access to root so, when I installed GLPK, I configured it as: ./configure --disable-shared --prefix=/home/jwalteros/GLPK/GLPK-4.54-ins/ That why it linked. Exported symbols are a dynamic library thing. With your static library, all non-local symbols are visible. -- Michael henne...@web.cs.ndsu.nodak.edu "SCSI is NOT magic. There are *fundamental technical reasons* why it is necessary to sacrifice a young goat to your SCSI chain now and then." -- John Woods ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X
In the Linux machine I don't have access to root so, when I installed GLPK, I configured it as: ./configure --disable-shared --prefix=/home/jwalteros/GLPK/GLPK-4.54-ins/ The makefile I used to compile the files I sent before (in the Linux machine) is bellow. The only difference is that GLPKLIBPATH points to a different folder besides /usr/local I have not done anything else, besides this. I know it works because the main application I am working on works as well. I also managed to make it work using Visual Studio on a windows computer that someone borrowed me. do you think it is something else? Thanks in advance -- CPP = g++ CPPARGS = -m64 -g GLPKPATH = /home/jwalteros/GLPK/glpk-4.54 GLPKLIBPATH = /home/jwalteros/GLPK/GLPK-4.54-ins INCGLPK = $(GLPKLIBPATH)/include/ INCGLPKSRC = $(GLPKPATH)/src/ INCGLPKCGLIB= $(GLPKPATH)/src/cglib/ INCGLPKENV = $(GLPKPATH)/src/env/ INCGLPKMISC = $(GLPKPATH)/src/misc/ CPPLIBGLPK = -L$(GLPKLIBPATH)/lib/ all: main1 main2 main1: $(CPP) $(CPPARGS) -o main1 main1.cpp -I$(INCGLPK) -I$(INCGLPKSRC) -I$(INCGLPKCGLIB) \ -I$(INCGLPKENV) -I$(INCGLPKENV) -I$(INCGLPKMISC) $(CPPLIBGLPK) -lglpk main2: $(CPP) $(CPPARGS) -o main2 main2.cpp -I$(INCGLPK) -I$(INCGLPKSRC) -I$(INCGLPKCGLIB) \ -I$(INCGLPKENV) -I$(INCGLPKENV) -I$(INCGLPKMISC) $(CPPLIBGLPK) -lglpk clean: rm -rf *o main1 main2 On Wed, Jun 18, 2014 at 1:55 PM, Heinrich Schuchardt wrote: > Hello Jose, > > when I ran > nm -g /usr/local/lib/libglpk.so | grep graph > on Linux it showed that cfg_build_graph is not an exported symbol. > > cfg_build_graph is not a function described in doc/glpk.pdf, and is not > meant to be used by an external program. > > > The code compiles perfectly in a Linux machine. > Your example does not compile on my Linux system: > ~/temp$ g++ -m64 -g main1.cpp -o main1 -I/home/user/src/glpk-4.54/src/cglib > -I/home/user/src/glpk-4.54/src/misc/ -I/home/user/src/glpk-4.54/src/env/ > -I/home/user/src/glpk-4.54/src/ -lglpk > /tmp/cceieEVB.o: In function `main': > /home/user/temp/main1.cpp:17: undefined reference to `_glp_cfg_build_graph' > collect2: error: ld returned 1 exit status > > So I wonder how you made you program compile on your Linux machine. Did > you manipulate the list of exported symbols? > > Best regards > > Heinrich > > > On 18.06.2014 07:26, Jose Walteros wrote: > >> Dear Heinrich, >> >> Thank you for your early response. I just checked the paths and the >> version and it is 4.54, which is the one I am actually using. >> >> The same goes for the path to /src/cglib, It points to the 4.54. >> >> Is there anything else that might be happening? >> >> Thanks >> >> On Jun 17, 2014, at 11:50 PM, "Heinrich Schuchardt" >>> wrote: >>> >>> Hello Jose, >>> >>> The errors you report look like you are linking to an old version of >>> GLPK which does not contain the library function you want to use, >>> >>> You could check the output of glp_version. >>> >>> You can influence the library loadpath on OS X by exporting >>> DYLD_LIBRARY_PATH. >>> >>> >>> Best regards >>> >>> Heinrich Schuchardt >>> >>> http://www.xypron.de >>> >>> >>> >>> Jose L Walteros schrieb: >>> Hi all, I tried to send this before and I think it didn't work. I am sorry if you receive it again. I have been working on a code for a while that uses the conflict graph libraries of GLPK. The code compiles perfectly in a Linux machine. However, when I try to compile it on a MacOS X (via the console) I get some linking errors. To give you an idea of my problem, I attached bellow a makefile and two trivial applications: main1.cpp is an application that reads clique4.lp, generates the conflict graph, and prints the number of vertices of such graph. As I mentioned, the code compiles perfectly in Linux using the same makefile (after updating the corresponding paths). In MacOS X, I get the following error: - Undefined symbols for architecture x86_64: "__glp_cfg_build_graph", referenced from: _main in main1-5183c5.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main1] Error 1 - To make sure there was no issues with the installation of GLPK or the path to the libraries, I created main2.cpp, which is an applications that simply reads and solves clique4.lp. Contrary to the previous case, main2.cpp compiles and runs perfectly. I have tried many things, but I haven't been able to make it work. I hope you guys can help. Regards, Attachments: - main1.cpp - #include extern
Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X
On Wed, 18 Jun 2014, Heinrich Schuchardt wrote: So I wonder how you made you program compile on your Linux machine. Did you manipulate the list of exported symbols? I think that exporting non-local symbols is the default on Linux. Occasionally I see threads about making dynamic libraries work on Windows without peppering the source with Windows-isms. This is likely the reason. I do not recall a good solution. -- Michael henne...@web.cs.ndsu.nodak.edu "SCSI is NOT magic. There are *fundamental technical reasons* why it is necessary to sacrifice a young goat to your SCSI chain now and then." -- John Woods ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X
Hello Jose, when I ran nm -g /usr/local/lib/libglpk.so | grep graph on Linux it showed that cfg_build_graph is not an exported symbol. cfg_build_graph is not a function described in doc/glpk.pdf, and is not meant to be used by an external program. The code compiles perfectly in a Linux machine. Your example does not compile on my Linux system: ~/temp$ g++ -m64 -g main1.cpp -o main1 -I/home/user/src/glpk-4.54/src/cglib -I/home/user/src/glpk-4.54/src/misc/ -I/home/user/src/glpk-4.54/src/env/ -I/home/user/src/glpk-4.54/src/ -lglpk /tmp/cceieEVB.o: In function `main': /home/user/temp/main1.cpp:17: undefined reference to `_glp_cfg_build_graph' collect2: error: ld returned 1 exit status So I wonder how you made you program compile on your Linux machine. Did you manipulate the list of exported symbols? Best regards Heinrich On 18.06.2014 07:26, Jose Walteros wrote: Dear Heinrich, Thank you for your early response. I just checked the paths and the version and it is 4.54, which is the one I am actually using. The same goes for the path to /src/cglib, It points to the 4.54. Is there anything else that might be happening? Thanks On Jun 17, 2014, at 11:50 PM, "Heinrich Schuchardt" wrote: Hello Jose, The errors you report look like you are linking to an old version of GLPK which does not contain the library function you want to use, You could check the output of glp_version. You can influence the library loadpath on OS X by exporting DYLD_LIBRARY_PATH. Best regards Heinrich Schuchardt http://www.xypron.de Jose L Walteros schrieb: Hi all, I tried to send this before and I think it didn't work. I am sorry if you receive it again. I have been working on a code for a while that uses the conflict graph libraries of GLPK. The code compiles perfectly in a Linux machine. However, when I try to compile it on a MacOS X (via the console) I get some linking errors. To give you an idea of my problem, I attached bellow a makefile and two trivial applications: main1.cpp is an application that reads clique4.lp, generates the conflict graph, and prints the number of vertices of such graph. As I mentioned, the code compiles perfectly in Linux using the same makefile (after updating the corresponding paths). In MacOS X, I get the following error: - Undefined symbols for architecture x86_64: "__glp_cfg_build_graph", referenced from: _main in main1-5183c5.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main1] Error 1 - To make sure there was no issues with the installation of GLPK or the path to the libraries, I created main2.cpp, which is an applications that simply reads and solves clique4.lp. Contrary to the previous case, main2.cpp compiles and runs perfectly. I have tried many things, but I haven't been able to make it work. I hope you guys can help. Regards, Attachments: - main1.cpp - #include extern "C" { #include #include "cfg.h" #include "env.h" #include "prob.h" } int main(int argc, const char * argv[]) { glp_prob *P; CFG *G; int nV, v, u, degree; P = glp_create_prob(); glp_read_lp(P, NULL, "./clique4.lp"); G = cfg_build_graph(P); nV = G->nv; std::cout<<"# vertices: "neg; int *pos = G->pos; for (v = 1; v <= nV; v++){ std::cout<<"vertex "< variable "< extern "C" { #include } int main(int argc, const char * argv[]) { glp_prob *P; P = glp_create_prob(); glp_read_lp(P, NULL, "./clique4.lp"); glp_simplex(P, NULL); return 0; } - Makefile - CPP = g++ ARGS = -m64 -g GLPKPATH = /Users/jwalteros/Applications/GLPK/glpk-4.54 GLPKLIBPATH = /usr/local GLPK = $(GLPKLIBPATH)/include/ GLPKSRC = $(GLPKPATH)/src/ GLPKCGLIB= $(GLPKPATH)/src/cglib/ GLPKENV = $(GLPKPATH)/src/env/ GLPKMISC = $(GLPKPATH)/src/misc/ LIBGLPK = $(GLPKLIBPATH)/lib/ all: main1 main2 main1: $(CPP) $(ARGS) -o main1 main1.cpp -I$(GLPK) -I$(GLPKSRC) -I$(GLPKCGLIB) \ -I$(GLPKENV) -I$(GLPKENV) -I$(GLPKMISC) -L$(LIBGLPK) -lglpk main2: $(CPP) $(ARGS) -o main2 main2.cpp -I$(GLPK) -L$(LIBGLPK) -lglpk - ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X
Dear Heinrich, Thank you for your early response. I just checked the paths and the version and it is 4.54, which is the one I am actually using. The same goes for the path to /src/cglib, It points to the 4.54. Is there anything else that might be happening? Thanks > On Jun 17, 2014, at 11:50 PM, "Heinrich Schuchardt" > wrote: > > Hello Jose, > > The errors you report look like you are linking to an old version of GLPK > which does not contain the library function you want to use, > > You could check the output of glp_version. > > You can influence the library loadpath on OS X by exporting DYLD_LIBRARY_PATH. > > > Best regards > > Heinrich Schuchardt > > http://www.xypron.de > > > > Jose L Walteros schrieb: >> >> Hi all, >> >> I tried to send this before and I think it didn't work. I am sorry if you >> receive it again. >> >> I have been working on a code for a while that uses the conflict graph >> libraries of GLPK. The code compiles perfectly in a Linux machine. However, >> when I try to compile it on a MacOS X (via the console) I get some linking >> errors. >> >> To give you an idea of my problem, I attached bellow a makefile and two >> trivial applications: main1.cpp is an application that reads clique4.lp, >> generates the conflict graph, and prints the number of vertices of such >> graph. As I mentioned, the code compiles perfectly in Linux using the same >> makefile (after updating the corresponding paths). In MacOS X, I get the >> following error: >> >> - >> Undefined symbols for architecture x86_64: >> "__glp_cfg_build_graph", referenced from: >> _main in main1-5183c5.o >> ld: symbol(s) not found for architecture x86_64 >> clang: error: linker command failed with exit code 1 (use -v to see >> invocation) >> make: *** [main1] Error 1 >> - >> >> To make sure there was no issues with the installation of GLPK or the path >> to the libraries, I created main2.cpp, which is an applications that simply >> reads and solves clique4.lp. Contrary to the previous case, main2.cpp >> compiles and runs perfectly. >> >> I have tried many things, but I haven't been able to make it work. I hope >> you guys can help. >> >> Regards, >> >> Attachments: >> >> - >> main1.cpp >> - >> #include >> extern "C" { >> #include >> #include "cfg.h" >> #include "env.h" >> #include "prob.h" >> } >> >> int main(int argc, const char * argv[]) >> { >> glp_prob *P; >> CFG *G; >> int nV, v, u, degree; >> >> P = glp_create_prob(); >> glp_read_lp(P, NULL, "./clique4.lp"); >> G = cfg_build_graph(P); >> >> nV = G->nv; >> >> std::cout<<"# vertices: "<> >> int *ref = G->ref; >> int *neg = G->neg; >> int *pos = G->pos; >> >> for (v = 1; v <= nV; v++){ >> std::cout<<"vertex "< variable "<> std::cout<<" pos "<> } >> >> return 0; >> } >> - >> main2.cpp >> - >> >> #include >> extern "C" { >> #include >> } >> >> int main(int argc, const char * argv[]) >> { >> glp_prob *P; >> >> P = glp_create_prob(); >> glp_read_lp(P, NULL, "./clique4.lp"); >> glp_simplex(P, NULL); >> >> return 0; >> } >> - >> Makefile >> - >> >> CPP = g++ >> ARGS = -m64 -g >> GLPKPATH = /Users/jwalteros/Applications/GLPK/glpk-4.54 >> GLPKLIBPATH = /usr/local >> GLPK = $(GLPKLIBPATH)/include/ >> GLPKSRC = $(GLPKPATH)/src/ >> GLPKCGLIB= $(GLPKPATH)/src/cglib/ >> GLPKENV = $(GLPKPATH)/src/env/ >> GLPKMISC = $(GLPKPATH)/src/misc/ >> LIBGLPK = $(GLPKLIBPATH)/lib/ >> >> all: main1 main2 >> >> main1: >> $(CPP) $(ARGS) -o main1 main1.cpp -I$(GLPK) -I$(GLPKSRC) -I$(GLPKCGLIB) >> \ >> -I$(GLPKENV) -I$(GLPKENV) -I$(GLPKMISC) -L$(LIBGLPK) -lglpk >> >> main2: >> $(CPP) $(ARGS) -o main2 main2.cpp -I$(GLPK) -L$(LIBGLPK) -lglpk >> >> - >> ___ Help-glpk mailing list >> Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Linking errors when using cfg.h in a MacOs X
Hello Jose, The errors you report look like you are linking to an old version of GLPK which does not contain the library function you want to use, You could check the output of glp_version. You can influence the library loadpath on OS X by exporting DYLD_LIBRARY_PATH. Best regards Heinrich Schuchardt http://www.xypron.de Jose L Walteros schrieb: Hi all, I tried to send this before and I think it didn't work. I am sorry if you receive it again. I have been working on a code for a while that uses the conflict graph libraries of GLPK. The code compiles perfectly in a Linux machine. However, when I try to compile it on a MacOS X (via the console) I get some linking errors. To give you an idea of my problem, I attached bellow a makefile and two trivial applications: main1.cpp is an application that reads clique4.lp, generates the conflict graph, and prints the number of vertices of such graph. As I mentioned, the code compiles perfectly in Linux using the same makefile (after updating the corresponding paths). In MacOS X, I get the following error: - Undefined symbols for architecture x86_64: "__glp_cfg_build_graph", referenced from: _main in main1-5183c5.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main1] Error 1 - To make sure there was no issues with the installation of GLPK or the path to the libraries, I created main2.cpp, which is an applications that simply reads and solves clique4.lp. Contrary to the previous case, main2.cpp compiles and runs perfectly. I have tried many things, but I haven't been able to make it work. I hope you guys can help. Regards, Attachments: - main1.cpp - #include extern "C" { #include #include "cfg.h" #include "env.h" #include "prob.h" } int main(int argc, const char * argv[]) { glp_prob *P; CFG *G; int nV, v, u, degree; P = glp_create_prob(); glp_read_lp(P, NULL, "./clique4.lp"); G = cfg_build_graph(P); nV = G->nv; std::cout<<"# vertices: "< int *ref = G->ref; int *neg = G->neg; int *pos = G->pos; for (v = 1; v <= nV; v++){ std::cout<<"vertex "< variable "< std::cout<<" pos "< } return 0; } - main2.cpp - #include extern "C" { #include } int main(int argc, const char * argv[]) { glp_prob *P; P = glp_create_prob(); glp_read_lp(P, NULL, "./clique4.lp"); glp_simplex(P, NULL); return 0; } - Makefile - CPP = g++ ARGS = -m64 -g GLPKPATH = /Users/jwalteros/Applications/GLPK/glpk-4.54 GLPKLIBPATH = /usr/local GLPK = $(GLPKLIBPATH)/include/ GLPKSRC = $(GLPKPATH)/src/ GLPKCGLIB = $(GLPKPATH)/src
[Help-glpk] Linking errors when using cfg.h in a MacOs X
Hi all, I tried to send this before and I think it didn't work. I am sorry if you receive it again. I have been working on a code for a while that uses the conflict graph libraries of GLPK. The code compiles perfectly in a Linux machine. However, when I try to compile it on a MacOS X (via the console) I get some linking errors. To give you an idea of my problem, I attached bellow a makefile and two trivial applications: main1.cpp is an application that reads clique4.lp, generates the conflict graph, and prints the number of vertices of such graph. As I mentioned, the code compiles perfectly in Linux using the same makefile (after updating the corresponding paths). In MacOS X, I get the following error: - Undefined symbols for architecture x86_64: "__glp_cfg_build_graph", referenced from: _main in main1-5183c5.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [main1] Error 1 - To make sure there was no issues with the installation of GLPK or the path to the libraries, I created main2.cpp, which is an applications that simply reads and solves clique4.lp. Contrary to the previous case, main2.cpp compiles and runs perfectly. I have tried many things, but I haven't been able to make it work. I hope you guys can help. Regards, Attachments: - main1.cpp - #include extern "C" { #include #include "cfg.h" #include "env.h" #include "prob.h" } int main(int argc, const char * argv[]) { glp_prob *P; CFG *G; int nV, v, u, degree; P = glp_create_prob(); glp_read_lp(P, NULL, "./clique4.lp"); G = cfg_build_graph(P); nV = G->nv; std::cout<<"# vertices: "neg; int *pos = G->pos; for (v = 1; v <= nV; v++){ std::cout<<"vertex "< variable "< extern "C" { #include } int main(int argc, const char * argv[]) { glp_prob *P; P = glp_create_prob(); glp_read_lp(P, NULL, "./clique4.lp"); glp_simplex(P, NULL); return 0; } - Makefile - CPP = g++ ARGS = -m64 -g GLPKPATH = /Users/jwalteros/Applications/GLPK/glpk-4.54 GLPKLIBPATH = /usr/local GLPK = $(GLPKLIBPATH)/include/ GLPKSRC = $(GLPKPATH)/src/ GLPKCGLIB= $(GLPKPATH)/src/cglib/ GLPKENV = $(GLPKPATH)/src/env/ GLPKMISC = $(GLPKPATH)/src/misc/ LIBGLPK = $(GLPKLIBPATH)/lib/ all: main1 main2 main1: $(CPP) $(ARGS) -o main1 main1.cpp -I$(GLPK) -I$(GLPKSRC) -I$(GLPKCGLIB) \ -I$(GLPKENV) -I$(GLPKENV) -I$(GLPKMISC) -L$(LIBGLPK) -lglpk main2: $(CPP) $(ARGS) -o main2 main2.cpp -I$(GLPK) -L$(LIBGLPK) -lglpk - ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk