[PPL-devel] Static linking and running on both windows and linux

anoninus wundermonk at gmail.com
Sat Mar 12 05:24:04 CET 2022


Hi Roberto,

Your suggestions in this thread worked and I was indeed able to confirm on
a windows machine that my pure PPL code worked just fine. Unfortunately,
for us (and no fault of PPL), the rest of our code which uses CPLEX and
MinGW is just impossibly difficult to configure correctly in Visual Studio
IDE. In any case, we have put that on the back burner for now.

On WSL (on this same windows machine), I installed through the procedure
specified in README.configure which is:

 $ tar jxf ppl-x.y.tar.bz2 (after downloading the .bz2 file from bugseng
website)
 $ ./configure
 $ make
 $ su
 Password: <root password>
 $ make install

My PPL C/C++ code (available at https://godbolt.org/z/qq8oxqb9W) worked
perfectly there. (If it would help other users of PPL, they can freely use
the code suitably modified for their purposes. It provides a clean C++
example of performing V to H conversion via PPL) My makefile performs the
following compiling/linking commands:

g++ -m64 -fno-common -fPIC -fno-strict-aliasing -fexceptions -fopenmp
-DVSCODE   -c -g -DIL_STD -D_LINDEBUG -I. -std=c++14 -MMD -MP -MF
"build/Debug/GNU-Linux/_ext/511e4115/Main.o.d" -o
build/Debug/GNU-Linux/_ext/511e4115/Main.o ../src/Main.cpp
mkdir -p dist/Debug/GNU-Linux
g++ -m64 -fno-common -fPIC -fno-strict-aliasing -fexceptions -fopenmp
-DVSCODE    -o dist/Debug/GNU-Linux/linux
build/Debug/GNU-Linux/_ext/511e4115/Main.o  -lm -lpthread -ldl -lppl -lgmp

The above workflow works perfectly fine and I am able to obtain the
facetial representation of the vertices. So far, so good.

Now, however, I recall you mentioning earlier in the thread that the above
method of installation is NOT recommended. You had suggested to use the git
development branch instead. So, I removed libppl files from /usr/local/lib
and tried to redo it along your suggested recommendation. That is:

I navigated to home.
git clone git://git.bugseng.com/ppl/ppl.git
Navigate to ppl subfolder.
run "autoreconf"
./configure --with-cxxflags=-std=c++11 --enable-optimization
--disable-debugging --disable-documentation --enable-interfaces="c cxx"
--enable-ppl_lcdd --disable-ppl_lpsol --disable-ppl_pips
--enable-instantiations=Polyhedron --disable-shared --enable-static
--disable-assertions
Run "make"
Run "sudo make install"

With this done, I tried to compile the same code. Now, I get a series of
undefined references during linking stage:

g++ -m64 -fno-common -fPIC -fno-strict-aliasing -fexceptions -fopenmp
-DVSCODE    -o dist/Debug/GNU-Linux/linux
build/Debug/GNU-Linux/_ext/511e4115/Main.o  -lm -lpthread -ldl -lppl -lgmp
/usr/bin/ld: /usr/local/lib/libppl.a(Constraint.o): in function
`Parma_Polyhedra_Library::IO_Operators::operator<<(std::ostream&,
Parma_Polyhedra_Library::Constraint const&)':
Constraint.cc:(.text+0x1597): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: Constraint.cc:(.text+0x1641): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: Constraint.cc:(.text+0x1793): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Generator.o): in function
`Parma_Polyhedra_Library::Generator::fancy_print(std::ostream&) const':
Generator.cc:(.text+0x166f): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: Generator.cc:(.text+0x16eb): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld:
/usr/local/lib/libppl.a(Linear_Expression.o):Linear_Expression.cc:(.text._ZNK23Parma_Polyhedra_Library22Linear_Expression_ImplINS_9Dense_RowEE10ascii_dumpERSo[_ZNK23Parma_Polyhedra_Library22Linear_Expression_ImplINS_9Dense_RowEE10ascii_dumpERSo]+0x8f):
more undefined references to `operator<<(std::ostream&, __mpz_struct
const*)' follow
/usr/bin/ld: /usr/local/lib/libppl.a(Linear_Expression.o): in function
`Parma_Polyhedra_Library::Linear_Expression_Impl<Parma_Polyhedra_Library::Sparse_Row>::ascii_load(std::istream&)':
Linear_Expression.cc:(.text._ZN23Parma_Polyhedra_Library22Linear_Expression_ImplINS_10Sparse_RowEE10ascii_loadERSi[_ZN23Parma_Polyhedra_Library22Linear_Expression_ImplINS_10Sparse_RowEE10ascii_loadERSi]+0x196):
undefined reference to `operator>>(std::istream&, __mpz_struct*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Linear_Expression.o): in function
`Parma_Polyhedra_Library::Linear_Expression_Impl<Parma_Polyhedra_Library::Dense_Row>::ascii_load(std::istream&)':
Linear_Expression.cc:(.text._ZN23Parma_Polyhedra_Library22Linear_Expression_ImplINS_9Dense_RowEE10ascii_loadERSi[_ZN23Parma_Polyhedra_Library22Linear_Expression_ImplINS_9Dense_RowEE10ascii_loadERSi]+0x12d):
undefined reference to `operator>>(std::istream&, __mpz_struct*)'
/usr/bin/ld: /usr/local/lib/libppl.a(CO_Tree.o): in function
`Parma_Polyhedra_Library::CO_Tree::dump_subtree(Parma_Polyhedra_Library::CO_Tree::tree_iterator)':
CO_Tree.cc:(.text+0x98c): undefined reference to `operator<<(std::ostream&,
__mpz_struct const*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Sparse_Row.o): in function
`Parma_Polyhedra_Library::Sparse_Row::ascii_dump(std::ostream&) const':
Sparse_Row.cc:(.text+0x3a48): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Sparse_Row.o): in function
`Parma_Polyhedra_Library::Sparse_Row::ascii_load(std::istream&)':
Sparse_Row.cc:(.text+0x63b9): undefined reference to
`operator>>(std::istream&, __mpz_struct*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Dense_Row.o): in function
`Parma_Polyhedra_Library::Dense_Row::ascii_dump(std::ostream&) const':
Dense_Row.cc:(.text+0xe43): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Dense_Row.o): in function
`Parma_Polyhedra_Library::Dense_Row::ascii_load(std::istream&)':
Dense_Row.cc:(.text+0x105f): undefined reference to
`operator>>(std::istream&, __mpz_struct*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Congruence.o): in function
`Parma_Polyhedra_Library::Congruence::ascii_dump(std::ostream&) const':
Congruence.cc:(.text+0x346): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Congruence.o): in function
`Parma_Polyhedra_Library::Congruence::ascii_load(std::istream&)':
Congruence.cc:(.text+0x483): undefined reference to
`operator>>(std::istream&, __mpz_struct*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Congruence.o): in function
`Parma_Polyhedra_Library::IO_Operators::operator<<(std::ostream&,
Parma_Polyhedra_Library::Congruence const&)':
Congruence.cc:(.text+0x131f): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: Congruence.cc:(.text+0x1368): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: Congruence.cc:(.text+0x13b9): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: Congruence.cc:(.text+0x1451): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld: /usr/local/lib/libppl.a(Grid_Generator.o): in function
`Parma_Polyhedra_Library::Grid_Generator::fancy_print(std::ostream&) const':
Grid_Generator.cc:(.text+0x137f): undefined reference to
`operator<<(std::ostream&, __mpz_struct const*)'
/usr/bin/ld:
/usr/local/lib/libppl.a(Grid_Generator.o):Grid_Generator.cc:(.text+0x141e):
more undefined references to `operator<<(std::ostream&, __mpz_struct
const*)' follow
collect2: error: ld returned 1 exit status

Is there a way these undefined references can be resolved? In this method,
I did not get any error in the ./configure, make or sudo make install step.
If needed, I can share the log of these commands.

Thanks again for your patient help.
Tryer

On Thu, Mar 10, 2022 at 1:02 AM Roberto Bagnara <bagnara at cs.unipr.it> wrote:

> Hello Tryer.
>
> You need to help yourself more: in the repository there is
> a README file at the top level, which points to README.configure,
> which contains a section
>
> 10. Using the Git Sources
>
> Kind regards,
>
>     Roberto
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20220312/612c7cd3/attachment.htm>


More information about the PPL-devel mailing list