Compiling Sphere_2.6a library on Mac OS X - c++

I am trying to compiling sphere_2.6a library on Mac OS X. At the beginning the following parameters are required:
Defined Commands and Options:
Compiler = gcc
Compiler options = -g -m32 -DNARCH_UNIX
Install = cp
Ranlib = ranlib
Archiver = ar ru
The is that I get the following error output:
Undefined symbols for architecture i386:
"_hs_getopt", referenced from:
_main in cc36C6uK.o
"_hs_optind", referenced from:
_main in cc36C6uK.o
"_sp_create_header", referenced from:
_main in cc36C6uK.o
"_sp_fpcopy", referenced from:
_main in cc36C6uK.o
"_sp_get_version", referenced from:
_main in cc36C6uK.o
"_sp_verbose", referenced from:
_main in cc36C6uK.o
"_sp_write_header", referenced from:
_main in cc36C6uK.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [h_add] Error 1
Does anybody know where is the problem?
Thanks a lot,
Giovanni

Related

SDL2 is not linking anymore on macOS Big Sur (M1)

I have created a small C++ SDL2 project with CMake under macOS Big Sur (m1).
This is the CMakeLists.txt:
cmake_minimum_required(VERSION 3.22.2)
project(sdl2gamepad)
add_library(sdl2lib SHARED IMPORTED)
set_property(TARGET sdl2lib PROPERTY IMPORTED_LOCATION "/opt/homebrew/lib/libSDL2.dylib")
include_directories("/opt/homebrew/include")
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ${sdl2lib})
I installed SDL2 and CMake with homebrew.
The project was initially compiled and linked with the Makefile without problems and I was able to run it.
I then wanted to structure my project with an src and build folder and had adapted the CMakeLists.txt. Unfortunately, CMake/Make was no longer able to link the SDL2 lib.
Linking error message:
[ 50%] Linking CXX executable sdl2gamepad
Undefined symbols for architecture arm64:
"_SDL_CreateWindow", referenced from:
_main in main.cpp.o
"_SDL_DestroyWindow", referenced from:
_main in main.cpp.o
"_SDL_GetError", referenced from:
_main in main.cpp.o
"_SDL_GetWindowSurface", referenced from:
_main in main.cpp.o
"_SDL_Init", referenced from:
_main in main.cpp.o
"_SDL_LoadBMP_RW", referenced from:
_main in main.cpp.o
"_SDL_PollEvent", referenced from:
_main in main.cpp.o
"_SDL_Quit", referenced from:
_main in main.cpp.o
"_SDL_RWFromFile", referenced from:
_main in main.cpp.o
"_SDL_UpdateWindowSurface", referenced from:
_main in main.cpp.o
"_SDL_UpperBlit", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sdl2gamepad] Error 1
make[1]: *** [CMakeFiles/sdl2gamepad.dir/all] Error 2
make: *** [all] Error 2
I then reset the CMakeLists.txt to the status where it had worked (code above). But unfortunately, the problem still exists.
But I can compile the code with this command, it is probably due to a CMake misconfiguration.
$ clang++ main.cpp -o main /opt/homebrew/lib/libSDL2.dylib -I /opt/homebrew/include
CMake Version is 3.22.2.
SDL2 Version is 2.0.20.
Many thanks for your help!

FTDI Chip ID on Mac OS Yosemite

I'm trying to get run Sample App from
http://www.ftdichip.com/Support/SoftwareExamples/FTDIChip-ID.htm
for Mac OS.
My problem is to get it compiled for Mac OS Yosemite.
I get this errors after "making" it :
ld: warning: ignoring file ./libftchipid.dylib, missing required architecture x86_64 in file ./libftchipid.dylib (2 slices)
Undefined symbols for architecture x86_64:
"_FTID_Constructor", referenced from:
_main in ChipID-3efebc.o
"_FTID_Destructor", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetChipIDFromHandle", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDeviceChipID", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDeviceDescription", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDeviceSerialNumber", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDllVersion", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetErrorCodeString", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetNumDevices", referenced from:
_main in ChipID-3efebc.o
ld: symbol(s) not found for architecture x86_64
can someone help?
I have found the way how to read the ID without this library. it is written in EEPROM.
FT_ReadEE (ftHandle, 0x43, &wTemp)
(FT_ReadEE (ftHandle, 0x44, &wTemp)

installing a c++ wrapper for libcurl on OS X [duplicate]

Really stupid C question.
I'm trying to build the source code here so I can start on modifying it for myself
http://curl.haxx.se/libcurl/c/ftpget.html
I download the file, then run
gcc -o test ftpget.c
and get
Undefined symbols:
"_curl_global_init", referenced from:
_main in ccFchguB.o
"_curl_easy_perform", referenced from:
_main in ccFchguB.o
"_curl_easy_setopt", referenced from:
_main in ccFchguB.o
_main in ccFchguB.o
_main in ccFchguB.o
_main in ccFchguB.o
"_curl_easy_cleanup", referenced from:
_main in ccFchguB.o
"_curl_easy_init", referenced from:
_main in ccFchguB.o
"_curl_global_cleanup", referenced from:
_main in ccFchguB.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
which makes no sense to me, because
/usr/local/include/curl/curl.h
exists and has these functions. I'm sure this is some basic c compilation thing I'm missing.
Many thanks for any pointers.
You need to link with the curl library:
gcc -o test ftpget.c -lcurl

Compiling zathura pdf plugin on mac ld error

I am trying to install zathura-pdf-poppler-0.2.5 on a Mac OS X running Yosemite. When I try and make, I get the following error:
LD pdf.so
Undefined symbols for architecture x86_64:
"_zathura_document_get_data", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_document_get_password", referenced from:
_pdf_document_open in document.o
"_zathura_document_get_path", referenced from:
_pdf_document_open in document.o
"_zathura_document_information_entry_list_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_information_entry_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_set_data", referenced from:
_pdf_document_open in document.o
_pdf_document_free in document.o
"_zathura_document_set_number_of_pages", referenced from:
_pdf_document_open in document.o
"_zathura_index_element_new", referenced from:
_pdf_document_index_generate in index.o
_build_index in index.o
"_zathura_link_free", referenced from:
_pdf_page_links_get in links.o
"_zathura_link_new", referenced from:
_poppler_link_to_zathura_link in utils.o
"_zathura_page_get_document", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_page_get_height", referenced from:
_pdf_page_links_get in links.o
_pdf_page_search_text in search.o
"_zathura_page_get_index", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_data", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_height", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_width", referenced from:
_pdf_page_init in page.o
"_zathura_plugin_add_mimetype", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_name", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_register_functions_function", referenced from:
_zathura_plugin_register in plugin.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: *** [pdf.so] Error 1
I have the following path set in $PKG_CONFIG_PATH:
/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10
Does anyone know how to fix the problem.
Many thanks
I don't know the exact reason that this happens, but I have applied a patch to makefiles and config.mk from MacPort. You can download them in plaintext and use patch Makefile < make.diff and patch config.mk < config.diff to apply the patch.
patch files
I had to change /usr/lib/zathura/pdf.dylib to /usr/lib/zathura/pdf.so after the make install in order to make zathura display pdf files.

C++ compile - GSL on x86_64

I am trying to compile the following code: http://www-personal.umich.edu/~mejn/dcbm/KLOptimization.cpp
But I get the following error message from g++:
> Undefined symbols for architecture x86_64: "_gsl_rng_uniform_int",
> referenced from:
> Initialize() in ccDEqovL.o
> _main in ccDEqovL.o "_gsl_rng_default_seed", referenced from:
> _main in ccDEqovL.o "_gsl_rng_default", referenced from:
> _main in ccDEqovL.o "_gsl_rng_alloc", referenced from:
> _main in ccDEqovL.o "_gsl_rng_name", referenced from:
> _main in ccDEqovL.o "_gsl_rng_get", referenced from:
> _main in ccDEqovL.o "_gsl_rng_uniform", referenced from:
> _main in ccDEqovL.o "ComputeVI()", referenced from:
> _main in ccDEqovL.o "ComputeNMI()", referenced from:
> _main in ccDEqovL.o "_gsl_rng_free", referenced from:
> _main in ccDEqovL.o ld: symbol(s) not found for architecture x86_64
I have MacBook Air, running iOS 10.7.3. g++ is i686-apple-darwin11-llvm-g++-4.2.
I installed GSL using "brew install gsl", which gave the following output:
==> Downloading http://ftpmirror.gnu.org/gsl/gsl-1.15.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gsl/1.15
==> make
==> make install
Warning: m4 macros were installed to "share/aclocal".
Homebrew does not append "/usr/local/share/aclocal"
to "/usr/share/aclocal/dirlist". If an autoconf script you use
requires these m4 macros, you'll need to add this path manually.
==> Summary
/usr/local/Cellar/gsl/1.15: 237 files, 7.0M, built in 81 seconds
It seems you forgot to link the GSL library. Just add the -lgsl and it should work (assuming gsl is in your library path).