DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 27th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default How to link after compiling?

Hello,

I am trying to build Astrolog. The following instruction for macOS is my guide:

Code:
$ cc -I /usr/X11R6/include/ -c -O -Wno-write-strings *.cpp; cc -o astrolog *.o -lm -lX11 -v

OpenBSD clang version 10.0.1 
Target: amd64-unknown-openbsd6.8
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o astrolog /usr/bin/../lib/crt0.o /usr/bin/../lib/crtbegin.o -L/usr/bin/../lib -L/usr/lib astrolog.o atlas.o calc.o charts0.o charts1.o charts2.o charts3.o data.o data2.o express.o general.o intrpret.o io.o matrix.o placalc.o placalc2.o swecl.o swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swemptab.o sweph.o swephlib.o wdialog.o wdriver.o xcharts0.o xcharts1.o xcharts2.o xdata.o xdevice.o xgeneral.o xscreen.o -lm -lX11 -lcompiler_rt -lc -lcompiler_rt /usr/bin/../lib/crtend.o
ld: error: unable to find library -lX11
cc: error: linker command failed with exit code 1 (use -v to see invocation)
How do I properly set the linker in order to build the executable?

PS
I am aware that OpenBSD provides a package for Astrolog but unfortunately it is quite outdated.
Reply With Quote
  #2   (View Single Post)  
Old 27th January 2021
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 269
Default

-L tells it where to look for libraries. You need to add the path to the X libraries.
Reply With Quote
  #3   (View Single Post)  
Old 27th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default

I tried the following command without success:
Code:
$cc -o astrolog *.o -lm -L /usr/X11R6/lib/ -v

OpenBSD clang version 10.0.1 
Target: amd64-unknown-openbsd6.8
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o astrolog /usr/bin/../lib/crt0.o /usr/bin/../lib/crtbegin.o -L/usr/X11R6/lib/ -L/usr/bin/../lib -L/usr/lib astrolog.o atlas.o calc.o charts0.o charts1.o charts2.o charts3.o data.o data2.o express.o general.o intrpret.o io.o matrix.o placalc.o placalc2.o swecl.o swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swemptab.o sweph.o swephlib.o wdialog.o wdriver.o xcharts0.o xcharts1.o xcharts2.o xdata.o xdevice.o xgeneral.o xscreen.o -lm -lcompiler_rt -lc -lcompiler_rt /usr/bin/../lib/crtend.o
ld: error: duplicate symbol: rStarBright
>>> defined at data.cpp
>>>            data.o:(rStarBright)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1640)

ld: error: duplicate symbol: rStarDist
>>> defined at data.cpp
>>>            data.o:(rStarDist)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x17C0)

ld: error: duplicate symbol: szCnstlAbbrev
>>> defined at data.cpp
>>>            data.o:(szCnstlAbbrev)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x2D0)

ld: error: duplicate symbol: szCnstlGenitive
>>> defined at data.cpp
>>>            data.o:(szCnstlGenitive)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x870)

ld: error: duplicate symbol: szCnstlMeaning
>>> defined at data.cpp
>>>            data.o:(szCnstlMeaning)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x5A0)

ld: error: duplicate symbol: szCnstlName
>>> defined at data.cpp
>>>            data.o:(szCnstlName)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x0)

ld: error: duplicate symbol: szDesc
>>> defined at data.cpp
>>>            data.o:(szDesc)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1AA0)

ld: error: duplicate symbol: szDesire
>>> defined at data.cpp
>>>            data.o:(szDesire)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1B10)

ld: error: duplicate symbol: szInteract
>>> defined at data.cpp
>>>            data.o:(szInteract)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1BF0)

ld: error: duplicate symbol: szLifeArea
>>> defined at data.cpp
>>>            data.o:(szLifeArea)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1B80)

ld: error: duplicate symbol: szMindPart
>>> defined at data.cpp
>>>            data.o:(szMindPart)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1940)

ld: error: duplicate symbol: szModify
>>> defined at data.cpp
>>>            data.o:(szModify)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1D30)

ld: error: duplicate symbol: szStarCustom
>>> defined at data.cpp
>>>            data.o:(szStarCustom)
>>> defined at data2.cpp
>>>            data2.o:(.bss+0x0)

ld: error: duplicate symbol: szTherefore
>>> defined at data.cpp
>>>            data.o:(szTherefore)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1C90)

ld: error: duplicate symbol: rStarBrightMatrix
>>> defined at data2.cpp
>>>            data2.o:(rStarBrightMatrix)
>>> defined at matrix.cpp
>>>            matrix.o:(.rodata+0x0)

ld: error: duplicate symbol: rStarData
>>> defined at data2.cpp
>>>            data2.o:(rStarData)
>>> defined at matrix.cpp
>>>            matrix.o:(.rodata+0x180)

ld: error: duplicate symbol: rgoe
>>> defined at data2.cpp
>>>            data2.o:(rgoe)
>>> defined at matrix.cpp
>>>            matrix.o:(.data+0x0)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Isn’t /usr/X11R6/lib/ the right path to the X libraries or am I doing something else wrong?
Reply With Quote
  #4   (View Single Post)  
Old 27th January 2021
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 269
Default

You need both -L and -l for X11. One tells it where to look for libriaries, the other tells it which libraries you want to link.

But dupicate symbols might be another problem. You might need to clean to start over will all the parameters correct.

I don't know why the instructions have you compile and link in 2 sperate steps...
Reply With Quote
  #5   (View Single Post)  
Old 27th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default

With my limited technical skills (it is actually the first time I am compiling something) I am struggling to figure out the proper command for building this program. May I ask if you have a suggestion for me?
Reply With Quote
  #6   (View Single Post)  
Old 27th January 2021
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 269
Default

It's hard without having done it myself.

Code:
# clean up
$ rm -r *.o
# redo with both X11 parameters
$ cc -I /usr/X11R6/include/ -c -O -Wno-write-strings *.cpp; cc -o astrolog *.o -lm -lX11 -L/usr/X11R6/lib -v
Reply With Quote
  #7   (View Single Post)  
Old 27th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default

Thank you but it did not work… The output for the first part is here. And the output of the second part looks like this:
Code:
$cc -o astrolog *.o -lm -lX11 -L/usr/X11R6/lib -v

OpenBSD clang version 10.0.1 
Target: amd64-unknown-openbsd6.8
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o astrolog /usr/bin/../lib/crt0.o /usr/bin/../lib/crtbegin.o -L/usr/X11R6/lib -L/usr/bin/../lib -L/usr/lib astrolog.o atlas.o calc.o charts0.o charts1.o charts2.o charts3.o data.o data2.o express.o general.o intrpret.o io.o matrix.o placalc.o placalc2.o swecl.o swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swemptab.o sweph.o swephlib.o wdialog.o wdriver.o xcharts0.o xcharts1.o xcharts2.o xdata.o xdevice.o xgeneral.o xscreen.o -lm -lX11 -lcompiler_rt -lc -lcompiler_rt /usr/bin/../lib/crtend.o
ld: error: duplicate symbol: rStarBright
>>> defined at data.cpp
>>>            data.o:(rStarBright)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1640)

ld: error: duplicate symbol: rStarDist
>>> defined at data.cpp
>>>            data.o:(rStarDist)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x17C0)

ld: error: duplicate symbol: szCnstlAbbrev
>>> defined at data.cpp
>>>            data.o:(szCnstlAbbrev)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x2D0)

ld: error: duplicate symbol: szCnstlGenitive
>>> defined at data.cpp
>>>            data.o:(szCnstlGenitive)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x870)

ld: error: duplicate symbol: szCnstlMeaning
>>> defined at data.cpp
>>>            data.o:(szCnstlMeaning)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x5A0)

ld: error: duplicate symbol: szCnstlName
>>> defined at data.cpp
>>>            data.o:(szCnstlName)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x0)

ld: error: duplicate symbol: szDesc
>>> defined at data.cpp
>>>            data.o:(szDesc)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1AA0)

ld: error: duplicate symbol: szDesire
>>> defined at data.cpp
>>>            data.o:(szDesire)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1B10)

ld: error: duplicate symbol: szInteract
>>> defined at data.cpp
>>>            data.o:(szInteract)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1BF0)

ld: error: duplicate symbol: szLifeArea
>>> defined at data.cpp
>>>            data.o:(szLifeArea)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1B80)

ld: error: duplicate symbol: szMindPart
>>> defined at data.cpp
>>>            data.o:(szMindPart)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1940)

ld: error: duplicate symbol: szModify
>>> defined at data.cpp
>>>            data.o:(szModify)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1D30)

ld: error: duplicate symbol: szStarCustom
>>> defined at data.cpp
>>>            data.o:(szStarCustom)
>>> defined at data2.cpp
>>>            data2.o:(.bss+0x0)

ld: error: duplicate symbol: szTherefore
>>> defined at data.cpp
>>>            data.o:(szTherefore)
>>> defined at data2.cpp
>>>            data2.o:(.data+0x1C90)

ld: error: duplicate symbol: rStarBrightMatrix
>>> defined at data2.cpp
>>>            data2.o:(rStarBrightMatrix)
>>> defined at matrix.cpp
>>>            matrix.o:(.rodata+0x0)

ld: error: duplicate symbol: rStarData
>>> defined at data2.cpp
>>>            data2.o:(rStarData)
>>> defined at matrix.cpp
>>>            matrix.o:(.rodata+0x180)

ld: error: duplicate symbol: rgoe
>>> defined at data2.cpp
>>>            data2.o:(rgoe)
>>> defined at matrix.cpp
>>>            matrix.o:(.data+0x0)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Reply With Quote
  #8   (View Single Post)  
Old 27th January 2021
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 269
Default

Ok. Forget their weird instructions.

Change the Makefile to this:

Code:
NAME = astrolog
OBJ = astrolog.o atlas.o calc.o charts0.o charts1.o charts2.o charts3.o\
 data.o express.o general.o intrpret.o io.o matrix.o placalc.o placalc2.o\
 xdata.o xgeneral.o xdevice.o xcharts0.o xcharts1.o xcharts2.o xscreen.o\
 swecl.o swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o sweph.o\
 swephlib.o

# If you don't have X windows, delete the "-lX11" part from the line below:
# If not compiling with GNUC, delete the "-ldl" part from the line below:
LIBS = -lm -lX11 -L/usr/lib -L/usr/X11R6/lib
CPPFLAGS = -O -Wno-write-strings -Wno-narrowing -Wno-comment -I/usr/include -I/usr/X11R6/include

astrolog:: $(OBJ)
        cc -o $(NAME) $(OBJ) $(LIBS)
        strip $(NAME)
Clean up with 'rm *.o'

And just use 'make'

Last edited by TronDD; 28th January 2021 at 12:01 AM.
Reply With Quote
  #9   (View Single Post)  
Old 28th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default

This gives me the following:
Code:
$ make
*** Parse error in /home/nasser/Astrologie/Astrolog-64-7.10: Need an operator in '-L/usr/X11R6/lib' (Makefile:14)
*** Parse error: Need an operator in 'astrolog' (Makefile:14)
Reply With Quote
Old 28th January 2021
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 269
Default

Copy/paste issue? Upload your whole Makefile somewhere.

You can try putting the original Makefile back and just manually edit it. You only need to change LIBS and CPPFLAGS lines.
Reply With Quote
Old 28th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default

You were right about the copy/paste issue. After resolving that I could successfully build it. Thank you very much!
However “make install” does not seem to work…
Code:
$ doas make install

make: don't know how to make install
Stop in /home/nasser/Astrolog-64-7.10
Reply With Quote
Old 28th January 2021
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 269
Default

There is no install target provided in the Makefile.

Looking at the existing port, files must be manually installed.

I just cloned the project out of git and I don't have the files mentioned in the port so I don't know what needs to be installed or not. Can't help you there. But if you know what's important, you can just copy them in place.

http://cvsweb.openbsd.org/ports/misc...-cvsweb-markup

${PREFIX} is /usr/local, of course.
Reply With Quote
Old 28th January 2021
nasser nasser is offline
Port Guard
 
Join Date: Nov 2013
Posts: 24
Default

Alright, I will ask the author of the program what needs to be placed in which directories. Thank you again for your help!
Reply With Quote
Old 24th February 2021
bradley bradley is offline
Port Guard
 
Join Date: Jul 2020
Posts: 42
Default

@nasser Did you maybe figure it out?

Some hints might be helpful if someone is going to try the same.
Reply With Quote
Reply

Tags
building

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No link....... sleeping illiterate OpenBSD General 6 26th February 2013 05:12 PM
NetBSD on D-Link DIR-100/300/320 Lexus45 NetBSD General 3 1st February 2011 12:24 PM
zyd0: no link ........... sleeping kallistoteles OpenBSD Installation and Upgrading 3 25th June 2010 02:38 PM
D-link (DI-524) router c0mrade General software and network 3 26th January 2009 08:14 AM
kde .desktop file link doesn't act like a link when opening files caesius FreeBSD Ports and Packages 3 14th October 2008 07:35 AM


All times are GMT. The time now is 05:18 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick