Recent

Author Topic: [CLOSED] Undefined symbols for architecture x86_64 on travis build for macos  (Read 736 times)

julkas

  • Guest
I have problem building on travis (https://travis-ci.org/github/JulStrat/primesieve-pas/jobs/704278728) for macos -
Code: Text  [Select][+][-]
  1. Undefined symbols for architecture x86_64:
  2.   "_primesieve_generate_next_primes", referenced from:
  3.       _PRIMESIEVE_$$_PRIMESIEVE_NEXT_PRIME$PRIMESIEVE_ITERATOR$$QWORD in primesieve.o
  4.   "_primesieve_generate_prev_primes", referenced from:
  5.       _PRIMESIEVE_$$_PRIMESIEVE_PREV_PRIME$PRIMESIEVE_ITERATOR$$QWORD in primesieve.o
  6.   "_primesieve_nth_prime", referenced from:
  7.       _PASCALMAIN in nth_prime.o
  8.   "_primesieve_version", referenced from:
  9.       _PASCALMAIN in nth_prime.o
  10. ld: symbol(s) not found for architecture x86_64
  11. An error occurred while linking
  12. nth_prime.pas(20,35) Error: Error while linking
  13. nth_prime.pas(20,35) Fatal: There were 1 errors compiling module, stopping
  14. Fatal: Compilation aborted
  15. Error: /usr/local/bin/ppcx64 returned an error exitcode
  16.  
Any hint? Thanks.
« Last Edit: July 03, 2020, 11:26:51 am by julkas »

Bi0T1N

  • Jr. Member
  • **
  • Posts: 85
Re: Undefined symbols for architecture x86_64 on travis build for macos
« Reply #1 on: July 02, 2020, 10:20:19 pm »
I assume the linker doesn't find the library due to an issue in your setup.
It seems your script isn't fully executed as it contains
Code: Text  [Select][+][-]
  1.         brew install primesieve;
  2.         echo $DYLD_LIBRARY_PATH;
  3.         sudo update_dyld_shared_cache;
  4.         nm /usr/local/lib/libprimesieve.dylib;
  5.         file /usr/local/lib/libprimesieve.dylib;        
  6.         fpc dynlibdemo.pas;
but looks like it stops after doing echo $DYLD_LIBRARY_PATH;
Code: Text  [Select][+][-]
  1. ==> Downloading https://homebrew.bintray.com/bottles/primesieve-7.5.high_sierra.
  2.  
  3. ######################################################################## 100.0%
  4.  
  5. ==> Pouring primesieve-7.5.high_sierra.bottle.tar.gz
  6.  
  7. 🍺  /usr/local/Cellar/primesieve/7.5: 24 files, 563.8KB
  8.  
  9. DYLD_LIBRARY_PATH
  10.  
  11. 0.05s$ cd examples
  12.  
  13. The command "cd examples" exited with 0.
  14.  
  15. 0.49s$ fpc -Fu../ nth_prime.pas
  16.  
  17. Free Pascal Compiler version 3.2.0 [2020/06/21] for x86_64
echo $DYLD_LIBRARY_PATH; should print the path you set.

EDIT:
Just saw that you made some changes (so probably the current script doesn't match the the old job anymore) in your repo and thus there are new builds which contain more infos.
The issue is that you've a /usr/local/lib/libprimesieve.dylib: Mach-O 64-bit dynamically linked shared library x86_64 but trying to link it statically. Use dynamic loading as you do in dynlibdemo.pas and it'll work. ;D
« Last Edit: July 02, 2020, 10:36:00 pm by Bi0T1N »

 

TinyPortal © 2005-2018